linkedin-relay-mcp 3.24.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 +51 -13
- package/README.md +5 -2
- package/dist/cli.js +1382 -717
- package/dist/cli.js.map +1 -1
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +1164 -487
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp-shim.js
CHANGED
|
@@ -715,6 +715,17 @@ var CONTRACTS = {
|
|
|
715
715
|
provenance: "verified",
|
|
716
716
|
capturedAt: "2026-10-16"
|
|
717
717
|
},
|
|
718
|
+
// The owner's notifications, probed 2026-10-29: the cards the bell opens,
|
|
719
|
+
// newest first. The page itself also marks them seen; reading them here
|
|
720
|
+
// does not. See engine/notifications.ts.
|
|
721
|
+
notifications: {
|
|
722
|
+
name: "notifications",
|
|
723
|
+
transport: "voyager-restli",
|
|
724
|
+
path: `${VOYAGER}/voyagerIdentityDashNotificationCards`,
|
|
725
|
+
decorationId: "com.linkedin.voyager.dash.deco.identity.notifications.CardsCollectionWithInjectionsNoPills-25",
|
|
726
|
+
provenance: "verified",
|
|
727
|
+
capturedAt: "2026-10-29"
|
|
728
|
+
},
|
|
718
729
|
// A company page, captured 2026-10-14. The GraphQL company query by
|
|
719
730
|
// universalName answers only the company's urn, so this is the REST
|
|
720
731
|
// resource: by id (`/<id>`) or by name (`q=universalName`). It carries the
|
|
@@ -784,6 +795,24 @@ var CONTRACTS = {
|
|
|
784
795
|
provenance: "verified",
|
|
785
796
|
capturedAt: "2026-10-14"
|
|
786
797
|
},
|
|
798
|
+
// Premium job reads, captured 2026-11-22 from /jobs/collections/top-applicant/
|
|
799
|
+
// and a job's detail pane. See engine/job-premium.ts.
|
|
800
|
+
jobCollection: {
|
|
801
|
+
name: "jobCollection",
|
|
802
|
+
transport: "voyager-graphql",
|
|
803
|
+
path: `${VOYAGER}/graphql`,
|
|
804
|
+
queryId: "voyagerJobsDashJobCards.fc1f897bcf2dc9afd5184ef3e9ed589b",
|
|
805
|
+
provenance: "verified",
|
|
806
|
+
capturedAt: "2026-11-22"
|
|
807
|
+
},
|
|
808
|
+
jobDetailSections: {
|
|
809
|
+
name: "jobDetailSections",
|
|
810
|
+
transport: "voyager-graphql",
|
|
811
|
+
path: `${VOYAGER}/graphql`,
|
|
812
|
+
queryId: "voyagerJobsDashJobPostingDetailSections.bc2eee77d01abc6616b8c8855344dfd5",
|
|
813
|
+
provenance: "verified",
|
|
814
|
+
capturedAt: "2026-11-22"
|
|
815
|
+
},
|
|
787
816
|
jobPosting: {
|
|
788
817
|
name: "jobPosting",
|
|
789
818
|
transport: "voyager-restli",
|
|
@@ -858,25 +887,25 @@ function parseCompany(json) {
|
|
|
858
887
|
const data = root?.data;
|
|
859
888
|
if (data === void 0 || data === null) return drift("the company answer carried no data");
|
|
860
889
|
const included = root?.included ?? [];
|
|
861
|
-
const
|
|
890
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
862
891
|
let c = data;
|
|
863
892
|
if (!String(data.$type ?? "").endsWith("organization.Company")) {
|
|
864
893
|
const listed = urns(data["*elements"]);
|
|
865
894
|
if (listed.length === 0)
|
|
866
895
|
return { ok: false, code: "NOT_FOUND", message: "no company has that name on LinkedIn" };
|
|
867
|
-
c =
|
|
896
|
+
c = byUrn2.get(listed[0]);
|
|
868
897
|
if (c === void 0) return drift("the company was listed but not sent");
|
|
869
898
|
}
|
|
870
899
|
const id = idOf(c.entityUrn);
|
|
871
900
|
const name = str(c.name);
|
|
872
901
|
if (id === void 0 || name === void 0) return drift("the company carried no id or name");
|
|
873
902
|
const followersOf = (n) => {
|
|
874
|
-
const f =
|
|
903
|
+
const f = byUrn2.get(n["*followingInfo"]);
|
|
875
904
|
return typeof f?.followerCount === "number" ? f.followerCount : void 0;
|
|
876
905
|
};
|
|
877
906
|
const related = (list) => {
|
|
878
907
|
const pages = urns(list).flatMap((u) => {
|
|
879
|
-
const p =
|
|
908
|
+
const p = byUrn2.get(u);
|
|
880
909
|
const pid = idOf(u);
|
|
881
910
|
const pname = str(p?.name);
|
|
882
911
|
if (p === void 0 || pid === void 0 || pname === void 0) return [];
|
|
@@ -884,7 +913,7 @@ function parseCompany(json) {
|
|
|
884
913
|
});
|
|
885
914
|
return pages.length > 0 ? pages : void 0;
|
|
886
915
|
};
|
|
887
|
-
const industry = urns(c["*companyIndustries"]).map((u) => str(
|
|
916
|
+
const industry = urns(c["*companyIndustries"]).map((u) => str(byUrn2.get(u)?.localizedName)).find((x) => x !== void 0);
|
|
888
917
|
const locations = (Array.isArray(c.confirmedLocations) ? c.confirmedLocations : []).map(address).filter((x) => x !== void 0);
|
|
889
918
|
const specialties = Array.isArray(c.specialities) ? c.specialities.filter((x) => typeof x === "string") : [];
|
|
890
919
|
const founded = c.foundedOn?.year;
|
|
@@ -1084,6 +1113,7 @@ function classifyRedirect(location) {
|
|
|
1084
1113
|
return fail("FETCH_FAILED", `unexpected redirect to ${location || "(none)"}`);
|
|
1085
1114
|
}
|
|
1086
1115
|
function challengeIn(body) {
|
|
1116
|
+
if (!/^\s*</.test(body)) return null;
|
|
1087
1117
|
if (!CHALLENGE_MARKERS.test(body.slice(0, 4e3))) return null;
|
|
1088
1118
|
return fail("CHALLENGE_DETECTED", "a challenge page was returned with status 200", {
|
|
1089
1119
|
cooldown: "CHALLENGE_DETECTED",
|
|
@@ -1403,9 +1433,9 @@ function findRefs(data) {
|
|
|
1403
1433
|
}
|
|
1404
1434
|
function parseSingle(payload) {
|
|
1405
1435
|
const envelope = payload ?? {};
|
|
1406
|
-
const
|
|
1407
|
-
if (
|
|
1408
|
-
return
|
|
1436
|
+
const nodes2 = [...new Set(indexIncluded(envelope.included).values())];
|
|
1437
|
+
if (nodes2.length === 0) return void 0;
|
|
1438
|
+
return nodes2.find((n) => !isNoise(n) && !isDecoration(n)) ?? nodes2[0];
|
|
1409
1439
|
}
|
|
1410
1440
|
function parseCollection(payload, opts) {
|
|
1411
1441
|
const envelope = payload ?? {};
|
|
@@ -1815,10 +1845,10 @@ function balanced(s, start) {
|
|
|
1815
1845
|
return null;
|
|
1816
1846
|
}
|
|
1817
1847
|
function parseAt(s, start) {
|
|
1818
|
-
const
|
|
1819
|
-
if (
|
|
1848
|
+
const text7 = start < 0 ? null : balanced(s, start);
|
|
1849
|
+
if (text7 === null) return null;
|
|
1820
1850
|
try {
|
|
1821
|
-
return JSON.parse(
|
|
1851
|
+
return JSON.parse(text7);
|
|
1822
1852
|
} catch {
|
|
1823
1853
|
return null;
|
|
1824
1854
|
}
|
|
@@ -2012,22 +2042,56 @@ function postsPagerBody(q) {
|
|
|
2012
2042
|
}
|
|
2013
2043
|
};
|
|
2014
2044
|
}
|
|
2045
|
+
function unitsFor(stream, from, bytes) {
|
|
2046
|
+
let i = from;
|
|
2047
|
+
let left = bytes;
|
|
2048
|
+
while (left > 0 && i < stream.length) {
|
|
2049
|
+
const c = stream.codePointAt(i);
|
|
2050
|
+
left -= c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4;
|
|
2051
|
+
i += c > 65535 ? 2 : 1;
|
|
2052
|
+
}
|
|
2053
|
+
return i - from;
|
|
2054
|
+
}
|
|
2015
2055
|
var Rows = class {
|
|
2016
2056
|
constructor(stream) {
|
|
2017
2057
|
this.stream = stream;
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2058
|
+
const head = /([0-9a-f]+):(?:T([0-9a-f]+),)?/y;
|
|
2059
|
+
let pos = 0;
|
|
2060
|
+
while (pos < stream.length) {
|
|
2061
|
+
if (stream[pos] === "\n") {
|
|
2062
|
+
pos++;
|
|
2063
|
+
continue;
|
|
2064
|
+
}
|
|
2065
|
+
head.lastIndex = pos;
|
|
2066
|
+
const m = head.exec(stream);
|
|
2067
|
+
if (m === null) {
|
|
2068
|
+
const nl = stream.indexOf("\n", pos);
|
|
2069
|
+
pos = nl === -1 ? stream.length : nl + 1;
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
const id = m[1];
|
|
2073
|
+
const body = pos + m[0].length;
|
|
2074
|
+
this.starts.push({ id, at: pos });
|
|
2075
|
+
let end;
|
|
2076
|
+
if (m[2] !== void 0) {
|
|
2077
|
+
end = body + unitsFor(stream, body, Number.parseInt(m[2], 16));
|
|
2078
|
+
this.texts.add(id);
|
|
2079
|
+
} else {
|
|
2080
|
+
const nl = stream.indexOf("\n", body);
|
|
2081
|
+
end = nl === -1 ? stream.length : nl;
|
|
2082
|
+
}
|
|
2083
|
+
this.byId.set(id, stream.slice(body, end));
|
|
2084
|
+
pos = end;
|
|
2026
2085
|
}
|
|
2027
2086
|
}
|
|
2028
2087
|
stream;
|
|
2029
2088
|
byId = /* @__PURE__ */ new Map();
|
|
2030
2089
|
starts = [];
|
|
2090
|
+
texts = /* @__PURE__ */ new Set();
|
|
2091
|
+
/** Whether a row is raw text (a `T` row) rather than JSON. */
|
|
2092
|
+
isText(id) {
|
|
2093
|
+
return this.texts.has(id);
|
|
2094
|
+
}
|
|
2031
2095
|
/** The row a stream position falls in. */
|
|
2032
2096
|
at(pos) {
|
|
2033
2097
|
let lo = 0;
|
|
@@ -2149,13 +2213,13 @@ function readPost(rows, top, model) {
|
|
|
2149
2213
|
const subRow = sub === void 0 ? "" : rows.byId.get(sub.row) ?? "";
|
|
2150
2214
|
const posted = sub === void 0 ? void 0 : texts(subRow, subRow.indexOf('"viewName":"feed-actor-sub-description"'))[0];
|
|
2151
2215
|
const said = commentary === void 0 ? void 0 : firstIn(rows, commentary.under, (row) => texts(row)[0]);
|
|
2152
|
-
const
|
|
2216
|
+
const text7 = said?.v;
|
|
2153
2217
|
const post = {
|
|
2154
2218
|
id,
|
|
2155
2219
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
2156
2220
|
...author.fields,
|
|
2157
2221
|
...posted !== void 0 ? { posted } : {},
|
|
2158
|
-
...
|
|
2222
|
+
...text7 !== void 0 ? { text: text7 } : {},
|
|
2159
2223
|
...reactions !== void 0 ? { reactions } : {}
|
|
2160
2224
|
};
|
|
2161
2225
|
const comments = n(`commentCount-${id}`);
|
|
@@ -2265,25 +2329,25 @@ function splitLocation(line2) {
|
|
|
2265
2329
|
const kind = m?.[2] === void 0 ? void 0 : WORKPLACE_SUFFIX[m[2].toLowerCase()];
|
|
2266
2330
|
return kind === void 0 || m?.[1] === void 0 ? { location: line2 } : { location: m[1], workplace: kind };
|
|
2267
2331
|
}
|
|
2268
|
-
function cardToJob(
|
|
2269
|
-
const urn =
|
|
2332
|
+
function cardToJob(card2) {
|
|
2333
|
+
const urn = card2.jobPostingUrn ?? card2["*jobPosting"];
|
|
2270
2334
|
const id = typeof urn === "string" ? jobIdOf(urn) : void 0;
|
|
2271
|
-
const title = typeof
|
|
2335
|
+
const title = typeof card2.jobPostingTitle === "string" ? card2.jobPostingTitle : text2(card2.title);
|
|
2272
2336
|
if (id === void 0 || title === void 0) return void 0;
|
|
2273
|
-
const footer = Array.isArray(
|
|
2337
|
+
const footer = Array.isArray(card2.footerItems) ? card2.footerItems : [];
|
|
2274
2338
|
const listed = footer.find((f) => f.type === "LISTED_DATE");
|
|
2275
2339
|
const insights = footer.filter((f) => !["LISTED_DATE", "PROMOTED", "EASY_APPLY_TEXT"].includes(String(f.type))).map((f) => text2(f.text)).filter((t) => t !== void 0);
|
|
2276
|
-
const insight2 = text2(
|
|
2340
|
+
const insight2 = text2(card2.relevanceInsight?.text);
|
|
2277
2341
|
if (insight2 !== void 0) insights.push(insight2);
|
|
2278
2342
|
return defined3({
|
|
2279
2343
|
id,
|
|
2280
2344
|
title,
|
|
2281
|
-
company: text2(
|
|
2282
|
-
...splitLocation(text2(
|
|
2345
|
+
company: text2(card2.primaryDescription),
|
|
2346
|
+
...splitLocation(text2(card2.secondaryDescription)),
|
|
2283
2347
|
listed: day(listed?.timeAt),
|
|
2284
2348
|
easyApply: footer.some((f) => f.type === "EASY_APPLY_TEXT"),
|
|
2285
2349
|
promoted: footer.some((f) => f.type === "PROMOTED"),
|
|
2286
|
-
salary: text2(
|
|
2350
|
+
salary: text2(card2.tertiaryDescription),
|
|
2287
2351
|
insights: insights.length > 0 ? insights : void 0,
|
|
2288
2352
|
url: viewUrl(id)
|
|
2289
2353
|
});
|
|
@@ -2295,22 +2359,23 @@ var drift2 = (message) => ({
|
|
|
2295
2359
|
hint: "the job search response changed shape; re-capture it"
|
|
2296
2360
|
});
|
|
2297
2361
|
function readCards(elements, included) {
|
|
2298
|
-
const
|
|
2362
|
+
const byUrn2 = /* @__PURE__ */ new Map();
|
|
2299
2363
|
for (const node of included) {
|
|
2300
|
-
if (typeof node.entityUrn === "string")
|
|
2364
|
+
if (typeof node.entityUrn === "string") byUrn2.set(node.entityUrn, node);
|
|
2301
2365
|
}
|
|
2302
2366
|
const jobs = [];
|
|
2303
2367
|
const unknownTypes = {};
|
|
2304
2368
|
let unresolved = 0;
|
|
2305
2369
|
for (const el of elements) {
|
|
2306
|
-
const union = el.jobCardUnion ?? {};
|
|
2370
|
+
const union = el.jobCardUnion ?? el.jobCard ?? {};
|
|
2307
2371
|
const ref = union["*jobPostingCard"];
|
|
2308
2372
|
if (typeof ref !== "string") {
|
|
2309
|
-
for (const kind of Object.
|
|
2373
|
+
for (const [kind, v] of Object.entries(union))
|
|
2374
|
+
if (v !== null && !kind.startsWith("$")) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
|
|
2310
2375
|
continue;
|
|
2311
2376
|
}
|
|
2312
|
-
const
|
|
2313
|
-
const job =
|
|
2377
|
+
const card2 = byUrn2.get(ref);
|
|
2378
|
+
const job = card2 === void 0 ? void 0 : cardToJob(card2);
|
|
2314
2379
|
if (job === void 0) unresolved++;
|
|
2315
2380
|
else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
|
|
2316
2381
|
}
|
|
@@ -2408,10 +2473,10 @@ function parseJobBatch(json) {
|
|
|
2408
2473
|
if (results === null || typeof results !== "object")
|
|
2409
2474
|
return drift2("the batch job response carried no results");
|
|
2410
2475
|
const included = root?.included ?? [];
|
|
2411
|
-
const
|
|
2476
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2412
2477
|
const jobs = [];
|
|
2413
2478
|
for (const ref of Object.values(results)) {
|
|
2414
|
-
const node = typeof ref === "string" ?
|
|
2479
|
+
const node = typeof ref === "string" ? byUrn2.get(ref) : ref;
|
|
2415
2480
|
const job = node === void 0 ? void 0 : postingToJob(node, included);
|
|
2416
2481
|
if (job !== void 0) jobs.push(job);
|
|
2417
2482
|
}
|
|
@@ -2436,11 +2501,11 @@ function hiringTeamBody(jobId) {
|
|
|
2436
2501
|
};
|
|
2437
2502
|
}
|
|
2438
2503
|
var unquote = (s) => JSON.parse(`"${s}"`);
|
|
2439
|
-
function memberOf(
|
|
2440
|
-
const url =
|
|
2441
|
-
const name =
|
|
2504
|
+
function memberOf(card2, id) {
|
|
2505
|
+
const url = card2.match(/"url":"(https:\/\/www\.linkedin\.com\/in\/[^"/]+\/)"/)?.[1];
|
|
2506
|
+
const name = card2.match(/\[null,"((?:[^"\\]|\\.)+)"/)?.[1];
|
|
2442
2507
|
if (url === void 0 || name === void 0) return void 0;
|
|
2443
|
-
const lines = [...
|
|
2508
|
+
const lines = [...card2.matchAll(/"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g)].map(
|
|
2444
2509
|
(m) => unquote(m[1]).trim()
|
|
2445
2510
|
);
|
|
2446
2511
|
const degree = lines.find((l) => l.startsWith("\u2022"));
|
|
@@ -2452,7 +2517,7 @@ function memberOf(card, id) {
|
|
|
2452
2517
|
headline,
|
|
2453
2518
|
degree: degree?.replace(/^•\s*/, ""),
|
|
2454
2519
|
role: role2,
|
|
2455
|
-
verified: /"role":"img","aria-label"/.test(
|
|
2520
|
+
verified: /"role":"img","aria-label"/.test(card2) ? true : void 0
|
|
2456
2521
|
});
|
|
2457
2522
|
}
|
|
2458
2523
|
function parseHiringTeam(stream) {
|
|
@@ -2461,7 +2526,7 @@ function parseHiringTeam(stream) {
|
|
|
2461
2526
|
return drift2("the hiring team answer was not the hiring team component");
|
|
2462
2527
|
const rows = new Rows(stream);
|
|
2463
2528
|
const cards = [...rows.byId].filter(([, row]) => /linkedin\.com\\?\/in\\?\//.test(row));
|
|
2464
|
-
const at = (
|
|
2529
|
+
const at = (card2) => stream.indexOf(`"$L${card2}"`);
|
|
2465
2530
|
const placed = cards.map(([key]) => at(key)).sort((a, b) => a - b);
|
|
2466
2531
|
const members = [];
|
|
2467
2532
|
for (const [key, row] of cards) {
|
|
@@ -2712,7 +2777,7 @@ function classify2(item) {
|
|
|
2712
2777
|
return kinds.every((k) => FURNITURE.has(k)) ? "furniture" : kinds;
|
|
2713
2778
|
}
|
|
2714
2779
|
function readItems(c, included, toRow) {
|
|
2715
|
-
const
|
|
2780
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2716
2781
|
const people = [];
|
|
2717
2782
|
const unknownTypes = {};
|
|
2718
2783
|
let excluded = 0;
|
|
@@ -2725,7 +2790,7 @@ function readItems(c, included, toRow) {
|
|
|
2725
2790
|
} else if (Array.isArray(kind)) {
|
|
2726
2791
|
for (const k of kind) unknownTypes[k] = (unknownTypes[k] ?? 0) + 1;
|
|
2727
2792
|
} else {
|
|
2728
|
-
const row =
|
|
2793
|
+
const row = byUrn2.get(kind.ref);
|
|
2729
2794
|
const person = row === void 0 ? void 0 : toRow(row);
|
|
2730
2795
|
if (person === void 0) unresolved++;
|
|
2731
2796
|
else if (!people.some((p) => p.id === person.id)) people.push(person);
|
|
@@ -2805,11 +2870,11 @@ function parseOrgHits(json) {
|
|
|
2805
2870
|
const c = clustersOf(json);
|
|
2806
2871
|
if (c === void 0) return drift3("the organisation search returned no result list");
|
|
2807
2872
|
const included = json.included ?? [];
|
|
2808
|
-
const
|
|
2873
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2809
2874
|
const hits = [];
|
|
2810
2875
|
for (const el of c.elements ?? []) {
|
|
2811
2876
|
for (const { item } of el.items ?? []) {
|
|
2812
|
-
const row =
|
|
2877
|
+
const row = byUrn2.get(item?.["*entityResult"]);
|
|
2813
2878
|
const id = String(row?.entityUrn ?? "").match(/urn:li:fsd_company:(\d+)/)?.[1];
|
|
2814
2879
|
const name = text3(row?.title);
|
|
2815
2880
|
if (id !== void 0 && name !== void 0 && !hits.some((h) => h.id === id))
|
|
@@ -3216,13 +3281,13 @@ function compactPost(p) {
|
|
|
3216
3281
|
p.comments !== void 0 ? `${p.comments} comments` : void 0,
|
|
3217
3282
|
p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
|
|
3218
3283
|
].filter(Boolean);
|
|
3219
|
-
const
|
|
3284
|
+
const text7 = p.text?.replace(/\s+/g, " ");
|
|
3220
3285
|
return line([
|
|
3221
3286
|
p.id,
|
|
3222
3287
|
p.author,
|
|
3223
3288
|
p.posted,
|
|
3224
3289
|
counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
|
|
3225
|
-
|
|
3290
|
+
text7 !== void 0 && text7.length > 160 ? `${text7.slice(0, 157)}\u2026` : text7,
|
|
3226
3291
|
p.url,
|
|
3227
3292
|
p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
|
|
3228
3293
|
]);
|
|
@@ -3474,14 +3539,14 @@ var txt = (v) => {
|
|
|
3474
3539
|
if (t !== null && typeof t === "object") return txt(t);
|
|
3475
3540
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
3476
3541
|
};
|
|
3477
|
-
function organizerOf(e,
|
|
3542
|
+
function organizerOf(e, byUrn2) {
|
|
3478
3543
|
const o = e.organizer ?? {};
|
|
3479
|
-
const company =
|
|
3544
|
+
const company = byUrn2.get(o["*organizingCompanyUrn"]);
|
|
3480
3545
|
if (typeof company?.name === "string") {
|
|
3481
3546
|
const id = String(company.entityUrn).split(":").pop();
|
|
3482
3547
|
return { name: company.name, kind: "company", url: `https://www.linkedin.com/company/${id}/` };
|
|
3483
3548
|
}
|
|
3484
|
-
const person =
|
|
3549
|
+
const person = byUrn2.get(o["*organizingProfileUrn"] ?? o.organizingProfileUrn);
|
|
3485
3550
|
const name = [person?.firstName, person?.lastName].filter((x) => typeof x === "string").join(" ");
|
|
3486
3551
|
if (name !== "") {
|
|
3487
3552
|
const vanity = person?.publicIdentifier;
|
|
@@ -3505,11 +3570,11 @@ function parseEvent(json) {
|
|
|
3505
3570
|
hint: "re-capture the event page"
|
|
3506
3571
|
};
|
|
3507
3572
|
}
|
|
3508
|
-
const
|
|
3573
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3509
3574
|
const range2 = e.timeRange ?? {};
|
|
3510
3575
|
const address2 = e.address ?? null;
|
|
3511
3576
|
const place = address2 === null ? void 0 : [address2.city, address2.geographicArea, address2.country].filter((x) => typeof x === "string" && x !== "").join(", ");
|
|
3512
|
-
const status =
|
|
3577
|
+
const status = byUrn2.get(e["*viewerStatus"])?.scheduledContentViewerStatus;
|
|
3513
3578
|
const attendees = Number(
|
|
3514
3579
|
txt(e.socialProof)?.match(/^(\d[\d,.\s]*)/)?.[1]?.replace(/[,.\s]/g, "")
|
|
3515
3580
|
);
|
|
@@ -3532,7 +3597,7 @@ function parseEvent(json) {
|
|
|
3532
3597
|
set("state", typeof e.lifecycleState === "string" ? e.lifecycleState : void 0);
|
|
3533
3598
|
if (e.cancelled === true) out.cancelled = true;
|
|
3534
3599
|
set("attendees", Number.isFinite(attendees) ? attendees : void 0);
|
|
3535
|
-
set("organizer", organizerOf(e,
|
|
3600
|
+
set("organizer", organizerOf(e, byUrn2));
|
|
3536
3601
|
set("place", place);
|
|
3537
3602
|
set("site", typeof e.externalUrl === "string" ? e.externalUrl : void 0);
|
|
3538
3603
|
if (e.privateEvent === true) out.private = true;
|
|
@@ -3640,6 +3705,158 @@ async function runEvent(inputs, opts = {}, fetch2) {
|
|
|
3640
3705
|
});
|
|
3641
3706
|
}
|
|
3642
3707
|
|
|
3708
|
+
// src/engine/job-premium.ts
|
|
3709
|
+
function graphql(name) {
|
|
3710
|
+
const c = CONTRACTS[name];
|
|
3711
|
+
if (c?.queryId === void 0) throw new Error(`job contract '${name}' is missing`);
|
|
3712
|
+
return { path: c.path, queryId: c.queryId };
|
|
3713
|
+
}
|
|
3714
|
+
var COLLECTION_PAGE = 100;
|
|
3715
|
+
function jobCollectionUrl(slug, start, count3) {
|
|
3716
|
+
const c = graphql("jobCollection");
|
|
3717
|
+
const variables = `(count:${count3},jobCollectionSlug:${slug},query:(origin:GENERIC_JOB_COLLECTIONS_LANDING),start:${start})`;
|
|
3718
|
+
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
3719
|
+
}
|
|
3720
|
+
function jobInsightsUrl(id) {
|
|
3721
|
+
const c = graphql("jobDetailSections");
|
|
3722
|
+
const urn = encodeURIComponent(`urn:li:fsd_jobPosting:${id}`);
|
|
3723
|
+
const variables = `(cardSectionTypes:List(JOB_APPLICANT_INSIGHTS,COMPANY_INSIGHTS_CARD),jobPostingUrn:${urn},includeSecondaryActionsV2:true)`;
|
|
3724
|
+
return `${c.path}?includeWebMetadata=true&variables=${variables}&queryId=${c.queryId}`;
|
|
3725
|
+
}
|
|
3726
|
+
var drift4 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
3727
|
+
var text4 = (v) => {
|
|
3728
|
+
const t = v?.text;
|
|
3729
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
3730
|
+
};
|
|
3731
|
+
var nodes = (v) => Array.isArray(v) ? v : [];
|
|
3732
|
+
function defined5(obj) {
|
|
3733
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
3734
|
+
return obj;
|
|
3735
|
+
}
|
|
3736
|
+
function parseJobCollection(json) {
|
|
3737
|
+
const root = json;
|
|
3738
|
+
const collection2 = root?.data?.data?.jobsDashJobCardsByJobCollections;
|
|
3739
|
+
if (collection2 === void 0 || collection2 === null) {
|
|
3740
|
+
const why = nodes(root?.data?.errors)[0]?.message;
|
|
3741
|
+
return drift4(`the job collection was not served${typeof why === "string" ? `: ${why}` : ""}`);
|
|
3742
|
+
}
|
|
3743
|
+
return parseJobCards({ data: collection2, included: root?.included ?? [] });
|
|
3744
|
+
}
|
|
3745
|
+
function byUrn(included) {
|
|
3746
|
+
const map = /* @__PURE__ */ new Map();
|
|
3747
|
+
for (const n of included) if (typeof n.entityUrn === "string") map.set(n.entityUrn, n);
|
|
3748
|
+
return map;
|
|
3749
|
+
}
|
|
3750
|
+
var nameOf = (urns2, urn) => {
|
|
3751
|
+
const n = typeof urn === "string" ? urns2.get(urn)?.name : void 0;
|
|
3752
|
+
return typeof n === "string" ? n : void 0;
|
|
3753
|
+
};
|
|
3754
|
+
function applicantsOf(a, urns2) {
|
|
3755
|
+
const seniority = nodes(a.seniorityDetails).flatMap((s) => {
|
|
3756
|
+
const level = nameOf(urns2, s["*seniority"]);
|
|
3757
|
+
return level === void 0 || typeof s.percentage !== "number" ? [] : [defined5({ level, share: s.percentage, count: s.count })];
|
|
3758
|
+
});
|
|
3759
|
+
const education = nodes(a.degreeDetails).flatMap((d) => {
|
|
3760
|
+
const degree = nameOf(urns2, d["*degree"]);
|
|
3761
|
+
return degree === void 0 || typeof d.percentage !== "number" ? [] : [{ degree, share: d.percentage }];
|
|
3762
|
+
});
|
|
3763
|
+
const skills = nodes(a.skillDetails);
|
|
3764
|
+
const locations = nodes(a.locationDetails);
|
|
3765
|
+
return defined5({
|
|
3766
|
+
total: a.applicantCount,
|
|
3767
|
+
lastDay: typeof a.applicantsInPastDay === "number" ? a.applicantsInPastDay : void 0,
|
|
3768
|
+
seniority: seniority.length > 0 ? seniority : void 0,
|
|
3769
|
+
education: education.length > 0 ? education : void 0,
|
|
3770
|
+
rankPercentile: typeof a.applicantRankPercentile === "number" ? a.applicantRankPercentile : void 0,
|
|
3771
|
+
skills: skills.length > 0 ? skills : void 0,
|
|
3772
|
+
locations: locations.length > 0 ? locations : void 0
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
function headcountOf(growth) {
|
|
3776
|
+
const months = nodes(growth?.headcountGrowth).flatMap((m) => {
|
|
3777
|
+
const on = m.startedOn;
|
|
3778
|
+
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 }] : [];
|
|
3779
|
+
});
|
|
3780
|
+
const latest = months[0];
|
|
3781
|
+
if (latest === void 0) return void 0;
|
|
3782
|
+
const back = (n) => months[n]?.count;
|
|
3783
|
+
const yearAgo = back(12);
|
|
3784
|
+
return defined5({
|
|
3785
|
+
asOf: latest.month,
|
|
3786
|
+
now: latest.count,
|
|
3787
|
+
sixMonthsAgo: back(6),
|
|
3788
|
+
yearAgo,
|
|
3789
|
+
twoYearsAgo: back(24),
|
|
3790
|
+
growth1y: yearAgo !== void 0 && yearAgo > 0 ? Math.round((latest.count - yearAgo) / yearAgo * 1e3) / 10 : void 0
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
var str3 = (v) => typeof v === "string" ? v : void 0;
|
|
3794
|
+
function trendOf(s, urns2) {
|
|
3795
|
+
const company = urns2.get(String(s["*company"]));
|
|
3796
|
+
const fn = str3(s.formattedJobFunction);
|
|
3797
|
+
return defined5({
|
|
3798
|
+
name: str3(company?.name),
|
|
3799
|
+
url: str3(company?.url),
|
|
3800
|
+
headcount: headcountOf(s.employeeGrowth),
|
|
3801
|
+
function: fn !== void 0 ? { name: fn, ...headcountOf(s.employeeGrowthForFunction) } : void 0,
|
|
3802
|
+
medianTenure: text4(s.employeeGrowth?.medianTenureYears)
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3805
|
+
function landscapeOf(s) {
|
|
3806
|
+
const competitors = nodes(s.competitors).flatMap((c) => {
|
|
3807
|
+
const name = text4(c.title);
|
|
3808
|
+
return name === void 0 ? [] : [defined5({ name, industry: text4(c.subtitle), url: str3(c.navigationUrl) })];
|
|
3809
|
+
});
|
|
3810
|
+
return defined5({
|
|
3811
|
+
landscape: text4(s.aiqInsightsText),
|
|
3812
|
+
competitors: competitors.length > 0 ? competitors : void 0
|
|
3813
|
+
});
|
|
3814
|
+
}
|
|
3815
|
+
var SECTIONS = {
|
|
3816
|
+
jobPostingCompanyInsights: trendOf,
|
|
3817
|
+
headcountAIQInsights: (s) => defined5({ hiring: text4(s.aiqInsightsText) }),
|
|
3818
|
+
strategicPrioritiesAIQInsights: (s) => defined5({ priorities: text4(s.insightsText) }),
|
|
3819
|
+
competitiveLandscapeAIQInsights: landscapeOf
|
|
3820
|
+
};
|
|
3821
|
+
function companyOf(card2, urns2, unknown) {
|
|
3822
|
+
const out = {};
|
|
3823
|
+
for (const el of nodes(card2.elements)) {
|
|
3824
|
+
for (const [kind, section] of Object.entries(el.companyInsights ?? {})) {
|
|
3825
|
+
if (section === null || kind.startsWith("$")) continue;
|
|
3826
|
+
const read = SECTIONS[kind];
|
|
3827
|
+
if (read === void 0) unknown[kind] = (unknown[kind] ?? 0) + 1;
|
|
3828
|
+
else Object.assign(out, read(section, urns2));
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
return out;
|
|
3832
|
+
}
|
|
3833
|
+
function parseJobInsights(json) {
|
|
3834
|
+
const root = json;
|
|
3835
|
+
const sections = root?.data?.data?.jobsDashJobPostingDetailSectionsByCardSectionTypes;
|
|
3836
|
+
if (sections === void 0 || sections === null || !Array.isArray(sections.elements))
|
|
3837
|
+
return drift4("the job detail sections were not in the answer");
|
|
3838
|
+
const urns2 = byUrn(root?.included ?? []);
|
|
3839
|
+
const unknownSections = {};
|
|
3840
|
+
let applicants;
|
|
3841
|
+
let company;
|
|
3842
|
+
for (const el of nodes(sections.elements)) {
|
|
3843
|
+
for (const part2 of nodes(el.jobPostingDetailSection)) {
|
|
3844
|
+
const a = urns2.get(String(part2["*jobApplicantInsightsUrn"]));
|
|
3845
|
+
if (a !== void 0 && typeof a.applicantCount === "number")
|
|
3846
|
+
applicants = applicantsOf(a, urns2);
|
|
3847
|
+
const posting = urns2.get(String(part2["*companyInsightsCard"]));
|
|
3848
|
+
const card2 = posting?.companyInsightsCard;
|
|
3849
|
+
if (card2 !== void 0 && card2 !== null) company = companyOf(card2, urns2, unknownSections);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
return {
|
|
3853
|
+
ok: true,
|
|
3854
|
+
...applicants !== void 0 ? { applicants } : {},
|
|
3855
|
+
...company !== void 0 && Object.keys(company).length > 0 ? { company } : {},
|
|
3856
|
+
unknownSections
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3643
3860
|
// src/commands/jobs.ts
|
|
3644
3861
|
function liveFetch5(command, quiet) {
|
|
3645
3862
|
const session = loadSession();
|
|
@@ -3716,6 +3933,7 @@ async function addDetails(get, rows, withDescription) {
|
|
|
3716
3933
|
return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
|
|
3717
3934
|
}
|
|
3718
3935
|
async function runJobs(req, opts = {}, fetch2) {
|
|
3936
|
+
if (req.collection !== void 0) return runCollection(req, req.collection, opts, fetch2);
|
|
3719
3937
|
const sets = keywordSets(req.keywords);
|
|
3720
3938
|
const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
|
|
3721
3939
|
if (!hasQuery) {
|
|
@@ -3782,6 +4000,65 @@ async function runJobs(req, opts = {}, fetch2) {
|
|
|
3782
4000
|
meta
|
|
3783
4001
|
});
|
|
3784
4002
|
}
|
|
4003
|
+
async function runCollection(req, collection2, opts, fetch2) {
|
|
4004
|
+
const searched = keywordSets(req.keywords).length > 0 || req.location || req.geoId;
|
|
4005
|
+
const selection3 = jobFilterSelection(req.filter ?? {});
|
|
4006
|
+
const filtered = !selection3.ok || Object.keys(selection3.filters).length > 0;
|
|
4007
|
+
if (searched || filtered)
|
|
4008
|
+
return err(
|
|
4009
|
+
"jobs",
|
|
4010
|
+
"INVALID_INPUT",
|
|
4011
|
+
`--${collection2} is LinkedIn's own list: it takes no keywords, location or filters`
|
|
4012
|
+
);
|
|
4013
|
+
const get = fetch2 ?? liveFetch5("jobs", opts.quiet === true);
|
|
4014
|
+
if (typeof get !== "function") return get;
|
|
4015
|
+
const first = Math.max(0, req.start ?? 0);
|
|
4016
|
+
const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
|
|
4017
|
+
const fetchPage = async (_keywords, start) => {
|
|
4018
|
+
const res = await get(jobCollectionUrl(collection2, start, COLLECTION_PAGE), "jobSearch");
|
|
4019
|
+
const page = res.ok ? parseJobCollection(res.json) : res;
|
|
4020
|
+
if (!page.ok) return page;
|
|
4021
|
+
return {
|
|
4022
|
+
ok: true,
|
|
4023
|
+
items: page.jobs,
|
|
4024
|
+
...page.total !== void 0 ? { total: page.total } : {},
|
|
4025
|
+
unknownTypes: page.unknownTypes
|
|
4026
|
+
};
|
|
4027
|
+
};
|
|
4028
|
+
const merged = await searchAll(fetchPage, [void 0], first, want, PAGING3);
|
|
4029
|
+
if (merged.rows.length === 0 && merged.failure !== void 0) {
|
|
4030
|
+
const f = merged.failure;
|
|
4031
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
4032
|
+
}
|
|
4033
|
+
let extra = {};
|
|
4034
|
+
if (req.details === true) {
|
|
4035
|
+
const added = await addDetails(get, merged.rows, req.description === true);
|
|
4036
|
+
extra = {
|
|
4037
|
+
unread: added.unread,
|
|
4038
|
+
...added.stoppedBy !== void 0 ? { readStop: added.stoppedBy } : {}
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
return ok("jobs", {
|
|
4042
|
+
collection: collection2,
|
|
4043
|
+
items: shape2(merged.rows, opts, compactJob),
|
|
4044
|
+
meta: metaOf("jobs", merged, true, first, { unread: 0, ...extra })
|
|
4045
|
+
});
|
|
4046
|
+
}
|
|
4047
|
+
async function addInsights(get, jobs) {
|
|
4048
|
+
for (const job of jobs) {
|
|
4049
|
+
const res = await get(jobInsightsUrl(job.id), "jobRead");
|
|
4050
|
+
const read = res.ok ? parseJobInsights(res.json) : res;
|
|
4051
|
+
if (!read.ok) {
|
|
4052
|
+
job.premiumError = `${read.code}: ${read.message}`;
|
|
4053
|
+
continue;
|
|
4054
|
+
}
|
|
4055
|
+
const { ok: _ok, unknownSections, ...insights } = read;
|
|
4056
|
+
job.premium = {
|
|
4057
|
+
...insights,
|
|
4058
|
+
...Object.keys(unknownSections).length > 0 ? { unknownSections } : {}
|
|
4059
|
+
};
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
3785
4062
|
async function addTeams(get, jobs) {
|
|
3786
4063
|
for (const job of jobs) {
|
|
3787
4064
|
const res = await get(HIRING_TEAM_URL, "page", hiringTeamBody(job.id));
|
|
@@ -3810,8 +4087,10 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
3810
4087
|
if (!res.ok) return err("job", res.code, res.message, res.hint);
|
|
3811
4088
|
const detail = parseJobDetail(res.json);
|
|
3812
4089
|
if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
|
|
3813
|
-
|
|
3814
|
-
|
|
4090
|
+
const job = detail.job;
|
|
4091
|
+
if (req.team === true) await addTeams(get, [job]);
|
|
4092
|
+
if (req.insights === true) await addInsights(get, [job]);
|
|
4093
|
+
return ok("job", job);
|
|
3815
4094
|
}
|
|
3816
4095
|
const read = await readJobs(get, wanted);
|
|
3817
4096
|
if (read.jobs.size === 0 && read.stoppedBy !== void 0)
|
|
@@ -3819,6 +4098,7 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
3819
4098
|
const unread = wanted.filter((id) => !read.jobs.has(id));
|
|
3820
4099
|
const jobs = wanted.flatMap((id) => read.jobs.get(id) ?? []);
|
|
3821
4100
|
if (req.team === true) await addTeams(get, jobs);
|
|
4101
|
+
if (req.insights === true) await addInsights(get, jobs);
|
|
3822
4102
|
return ok("job", {
|
|
3823
4103
|
items: shape2(
|
|
3824
4104
|
jobs,
|
|
@@ -3894,7 +4174,7 @@ var TEXT = /"viewName":"mini-update-container"[\s\S]*?"textProps":\{[^{}]*?"chil
|
|
|
3894
4174
|
function parseScheduledPage(stream) {
|
|
3895
4175
|
const count3 = stream.match(COUNT2);
|
|
3896
4176
|
if (count3?.[1] === void 0) {
|
|
3897
|
-
return
|
|
4177
|
+
return drift5("the scheduled-posts page carried no post count");
|
|
3898
4178
|
}
|
|
3899
4179
|
const claimedCount = Number(count3[1]);
|
|
3900
4180
|
const posts = [];
|
|
@@ -3905,7 +4185,7 @@ function parseScheduledPage(stream) {
|
|
|
3905
4185
|
posts.push({ urn, scheduledAt: Number(at), text: null });
|
|
3906
4186
|
}
|
|
3907
4187
|
if (claimedCount > 0 && posts.length === 0) {
|
|
3908
|
-
return
|
|
4188
|
+
return drift5(`LinkedIn counts ${claimedCount} scheduled posts but no row could be read`);
|
|
3909
4189
|
}
|
|
3910
4190
|
const texts3 = [...stream.matchAll(TEXT)].map((m) => JSON.parse(`"${m[1]}"`));
|
|
3911
4191
|
if (texts3.length === posts.length) {
|
|
@@ -3915,7 +4195,7 @@ function parseScheduledPage(stream) {
|
|
|
3915
4195
|
}
|
|
3916
4196
|
return { ok: true, claimedCount, posts };
|
|
3917
4197
|
}
|
|
3918
|
-
function
|
|
4198
|
+
function drift5(message) {
|
|
3919
4199
|
return {
|
|
3920
4200
|
ok: false,
|
|
3921
4201
|
code: "SCHEMA_DRIFT",
|
|
@@ -4275,7 +4555,7 @@ var txt2 = (v) => {
|
|
|
4275
4555
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
4276
4556
|
};
|
|
4277
4557
|
var iso = (ms) => typeof ms === "number" ? new Date(ms).toISOString() : void 0;
|
|
4278
|
-
function
|
|
4558
|
+
function defined6(obj) {
|
|
4279
4559
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
4280
4560
|
return obj;
|
|
4281
4561
|
}
|
|
@@ -4285,7 +4565,7 @@ function participantOf(p) {
|
|
|
4285
4565
|
const m = t.member;
|
|
4286
4566
|
const name = [txt2(m.firstName), txt2(m.lastName)].filter(Boolean).join(" ");
|
|
4287
4567
|
const url = typeof m.profileUrl === "string" ? `${m.profileUrl.replace(/\/$/, "")}/` : void 0;
|
|
4288
|
-
return
|
|
4568
|
+
return defined6({
|
|
4289
4569
|
name: name !== "" ? name : "LinkedIn Member",
|
|
4290
4570
|
kind: "person",
|
|
4291
4571
|
headline: txt2(m.headline),
|
|
@@ -4295,7 +4575,7 @@ function participantOf(p) {
|
|
|
4295
4575
|
}
|
|
4296
4576
|
if (t.organization) {
|
|
4297
4577
|
const o = t.organization;
|
|
4298
|
-
return
|
|
4578
|
+
return defined6({
|
|
4299
4579
|
name: txt2(o.name) ?? "an organization",
|
|
4300
4580
|
kind: "organization",
|
|
4301
4581
|
url: typeof o.pageUrl === "string" ? o.pageUrl : void 0
|
|
@@ -4305,12 +4585,12 @@ function participantOf(p) {
|
|
|
4305
4585
|
return void 0;
|
|
4306
4586
|
}
|
|
4307
4587
|
var isMe = (urn, mailbox2) => typeof urn === "string" && urn.includes(mailbox2);
|
|
4308
|
-
function messageOf(m,
|
|
4588
|
+
function messageOf(m, byUrn2, mailbox2) {
|
|
4309
4589
|
const sender = m["*sender"] ?? m["*actor"];
|
|
4310
4590
|
const fromMe = isMe(sender, mailbox2);
|
|
4311
|
-
const who = fromMe ? void 0 : participantOf(
|
|
4591
|
+
const who = fromMe ? void 0 : participantOf(byUrn2.get(sender));
|
|
4312
4592
|
const render2 = Array.isArray(m.renderContent) ? m.renderContent : [];
|
|
4313
|
-
return
|
|
4593
|
+
return defined6({
|
|
4314
4594
|
from: fromMe ? "you" : who?.name ?? "unknown",
|
|
4315
4595
|
fromMe,
|
|
4316
4596
|
at: iso(m.deliveredAt),
|
|
@@ -4319,7 +4599,7 @@ function messageOf(m, byUrn, mailbox2) {
|
|
|
4319
4599
|
sponsored: render2.some((r) => r.conversationAdsMessageContent) ? true : void 0
|
|
4320
4600
|
});
|
|
4321
4601
|
}
|
|
4322
|
-
var
|
|
4602
|
+
var drift6 = (message) => ({
|
|
4323
4603
|
ok: false,
|
|
4324
4604
|
code: "SCHEMA_DRIFT",
|
|
4325
4605
|
message,
|
|
@@ -4339,26 +4619,26 @@ function refsOf(top) {
|
|
|
4339
4619
|
function parseConversations(json, mailbox2) {
|
|
4340
4620
|
const top = collectionOf(json);
|
|
4341
4621
|
const refs = refsOf(top);
|
|
4342
|
-
if (refs === void 0) return
|
|
4622
|
+
if (refs === void 0) return drift6("the conversation list was missing");
|
|
4343
4623
|
const included = json.included ?? [];
|
|
4344
|
-
const
|
|
4624
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4345
4625
|
const conversations = [];
|
|
4346
4626
|
for (const ref of refs) {
|
|
4347
|
-
const c =
|
|
4627
|
+
const c = byUrn2.get(ref);
|
|
4348
4628
|
if (c === void 0) continue;
|
|
4349
|
-
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(
|
|
4629
|
+
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(byUrn2.get(u))).filter((p) => p !== void 0);
|
|
4350
4630
|
const lastRef = c.messages?.["*elements"]?.[0];
|
|
4351
|
-
const last = lastRef === void 0 ? void 0 :
|
|
4631
|
+
const last = lastRef === void 0 ? void 0 : byUrn2.get(lastRef);
|
|
4352
4632
|
const categories = Array.isArray(c.categories) ? c.categories : [];
|
|
4353
4633
|
conversations.push(
|
|
4354
|
-
|
|
4634
|
+
defined6({
|
|
4355
4635
|
id: String(c.entityUrn),
|
|
4356
4636
|
url: typeof c.conversationUrl === "string" ? c.conversationUrl : void 0,
|
|
4357
4637
|
with: parts,
|
|
4358
4638
|
title: c.groupChat === true ? txt2(c.title) : void 0,
|
|
4359
4639
|
unread: typeof c.unreadCount === "number" ? c.unreadCount : 0,
|
|
4360
4640
|
lastActivity: iso(c.lastActivityAt),
|
|
4361
|
-
last: last === void 0 ? void 0 : messageOf(last,
|
|
4641
|
+
last: last === void 0 ? void 0 : messageOf(last, byUrn2, mailbox2),
|
|
4362
4642
|
// PRIMARY_INBOX sits inside INBOX; report the folder a person would name.
|
|
4363
4643
|
folders: categories.map((k) => FOLDER_OF[k]).filter(
|
|
4364
4644
|
(f) => f !== void 0 && !(f === "primary" && categories.includes("INBOX"))
|
|
@@ -4368,7 +4648,7 @@ function parseConversations(json, mailbox2) {
|
|
|
4368
4648
|
);
|
|
4369
4649
|
}
|
|
4370
4650
|
if (refs.length > 0 && conversations.length === 0)
|
|
4371
|
-
return
|
|
4651
|
+
return drift6(`${refs.length} conversations were listed but none were sent`);
|
|
4372
4652
|
const cursor = top?.metadata?.nextCursor;
|
|
4373
4653
|
return {
|
|
4374
4654
|
ok: true,
|
|
@@ -4379,17 +4659,17 @@ function parseConversations(json, mailbox2) {
|
|
|
4379
4659
|
function parseMessages(json, mailbox2) {
|
|
4380
4660
|
const top = collectionOf(json);
|
|
4381
4661
|
const refs = refsOf(top);
|
|
4382
|
-
if (refs === void 0) return
|
|
4662
|
+
if (refs === void 0) return drift6("the message list was missing");
|
|
4383
4663
|
const included = json.included ?? [];
|
|
4384
|
-
const
|
|
4664
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4385
4665
|
const messages = [];
|
|
4386
4666
|
for (const ref of refs) {
|
|
4387
|
-
const m =
|
|
4667
|
+
const m = byUrn2.get(ref);
|
|
4388
4668
|
if (m === void 0 || typeof m.deliveredAt !== "number") continue;
|
|
4389
|
-
messages.push({ id: String(m.entityUrn), ...messageOf(m,
|
|
4669
|
+
messages.push({ id: String(m.entityUrn), ...messageOf(m, byUrn2, mailbox2) });
|
|
4390
4670
|
}
|
|
4391
4671
|
if (refs.length > 0 && messages.length === 0)
|
|
4392
|
-
return
|
|
4672
|
+
return drift6(`${refs.length} messages were listed but none were sent`);
|
|
4393
4673
|
messages.sort((a, b) => a.at.localeCompare(b.at));
|
|
4394
4674
|
return { ok: true, messages };
|
|
4395
4675
|
}
|
|
@@ -4544,8 +4824,8 @@ function loadDrafts() {
|
|
|
4544
4824
|
};
|
|
4545
4825
|
return Array.isArray(loaded.value) ? loaded.value : [];
|
|
4546
4826
|
}
|
|
4547
|
-
async function runDraft(conversation,
|
|
4548
|
-
const body =
|
|
4827
|
+
async function runDraft(conversation, text7, fetch2, opts = {}) {
|
|
4828
|
+
const body = text7?.trim() ?? "";
|
|
4549
4829
|
if (body === "")
|
|
4550
4830
|
return err(
|
|
4551
4831
|
"draft",
|
|
@@ -4645,14 +4925,14 @@ function itemsUrl(list, q) {
|
|
|
4645
4925
|
});
|
|
4646
4926
|
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
4647
4927
|
}
|
|
4648
|
-
var
|
|
4928
|
+
var text5 = (v) => {
|
|
4649
4929
|
const t = v?.text;
|
|
4650
4930
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
4651
4931
|
};
|
|
4652
4932
|
var inner = (urn) => String(urn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
4653
4933
|
var clean = (url) => typeof url === "string" && url.startsWith("https://") ? url.split("?")[0] : void 0;
|
|
4654
|
-
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) =>
|
|
4655
|
-
function
|
|
4934
|
+
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) => text5(i.simpleInsight?.title)).find((t) => t !== void 0);
|
|
4935
|
+
function defined7(obj) {
|
|
4656
4936
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
4657
4937
|
return obj;
|
|
4658
4938
|
}
|
|
@@ -4664,40 +4944,40 @@ var WORKPLACE = {
|
|
|
4664
4944
|
function postRow(row) {
|
|
4665
4945
|
const id = inner(row.entityUrn);
|
|
4666
4946
|
if (id === void 0 || !/^urn:li:(activity|ugcPost|share):/.test(id)) return void 0;
|
|
4667
|
-
const posted =
|
|
4668
|
-
return
|
|
4947
|
+
const posted = text5(row.secondarySubtitle)?.replace(/\s*•\s*$/, "");
|
|
4948
|
+
return defined7({
|
|
4669
4949
|
id,
|
|
4670
4950
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
4671
|
-
author:
|
|
4672
|
-
authorHeadline:
|
|
4951
|
+
author: text5(row.title),
|
|
4952
|
+
authorHeadline: text5(row.primarySubtitle),
|
|
4673
4953
|
posted,
|
|
4674
|
-
text:
|
|
4954
|
+
text: text5(row.summary)
|
|
4675
4955
|
});
|
|
4676
4956
|
}
|
|
4677
4957
|
function courseRow(row) {
|
|
4678
4958
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
4679
|
-
const name =
|
|
4959
|
+
const name = text5(row.title);
|
|
4680
4960
|
if (id === void 0 || name === void 0) return void 0;
|
|
4681
|
-
return
|
|
4961
|
+
return defined7({
|
|
4682
4962
|
id,
|
|
4683
4963
|
name,
|
|
4684
|
-
length:
|
|
4685
|
-
detail:
|
|
4686
|
-
progress:
|
|
4964
|
+
length: text5(row.primarySubtitle),
|
|
4965
|
+
detail: text5(row.secondarySubtitle),
|
|
4966
|
+
progress: text5(row.summary),
|
|
4687
4967
|
url: clean(row.navigationUrl)
|
|
4688
4968
|
});
|
|
4689
4969
|
}
|
|
4690
4970
|
function jobRow(row, stage) {
|
|
4691
4971
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
4692
|
-
const title =
|
|
4972
|
+
const title = text5(row.title);
|
|
4693
4973
|
if (id === void 0 || title === void 0) return void 0;
|
|
4694
|
-
const place =
|
|
4974
|
+
const place = text5(row.secondarySubtitle);
|
|
4695
4975
|
const m = place?.match(/^(.*?)\s*\(([^()]+)\)$/);
|
|
4696
4976
|
const workplace = m?.[2] === void 0 ? void 0 : WORKPLACE[m[2].toLowerCase()];
|
|
4697
|
-
return
|
|
4977
|
+
return defined7({
|
|
4698
4978
|
id,
|
|
4699
4979
|
title,
|
|
4700
|
-
company:
|
|
4980
|
+
company: text5(row.primarySubtitle),
|
|
4701
4981
|
location: workplace !== void 0 ? m?.[1] : place,
|
|
4702
4982
|
workplace,
|
|
4703
4983
|
stage,
|
|
@@ -4857,7 +5137,7 @@ function searchUrl(q) {
|
|
|
4857
5137
|
kind: SEARCH_KINDS[q.kind]
|
|
4858
5138
|
});
|
|
4859
5139
|
}
|
|
4860
|
-
var
|
|
5140
|
+
var text6 = (v) => {
|
|
4861
5141
|
const t = v?.text;
|
|
4862
5142
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
4863
5143
|
};
|
|
@@ -4871,13 +5151,13 @@ function cleanUrl2(nav) {
|
|
|
4871
5151
|
}
|
|
4872
5152
|
function rowToFound(row) {
|
|
4873
5153
|
const id = idOf2(row.entityUrn);
|
|
4874
|
-
const name =
|
|
5154
|
+
const name = text6(row.title);
|
|
4875
5155
|
if (id === void 0 || name === void 0) return void 0;
|
|
4876
5156
|
const found = { id, name };
|
|
4877
5157
|
const fields = [
|
|
4878
|
-
["subtitle",
|
|
4879
|
-
["detail",
|
|
4880
|
-
["summary",
|
|
5158
|
+
["subtitle", text6(row.primarySubtitle)],
|
|
5159
|
+
["detail", text6(row.secondarySubtitle)],
|
|
5160
|
+
["summary", text6(row.summary)],
|
|
4881
5161
|
["url", cleanUrl2(row.navigationUrl)]
|
|
4882
5162
|
];
|
|
4883
5163
|
for (const [k, v] of fields)
|
|
@@ -4885,7 +5165,7 @@ function rowToFound(row) {
|
|
|
4885
5165
|
if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
|
|
4886
5166
|
return found;
|
|
4887
5167
|
}
|
|
4888
|
-
var
|
|
5168
|
+
var drift7 = (message) => ({
|
|
4889
5169
|
ok: false,
|
|
4890
5170
|
code: "SCHEMA_DRIFT",
|
|
4891
5171
|
message,
|
|
@@ -4894,7 +5174,7 @@ var drift6 = (message) => ({
|
|
|
4894
5174
|
function parseResults(json) {
|
|
4895
5175
|
const c = clustersOf(json);
|
|
4896
5176
|
if (c === void 0 || !Array.isArray(c.elements))
|
|
4897
|
-
return
|
|
5177
|
+
return drift7("the search returned no result list");
|
|
4898
5178
|
const included = json.included ?? [];
|
|
4899
5179
|
const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
|
|
4900
5180
|
const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
|
|
@@ -4902,7 +5182,7 @@ function parseResults(json) {
|
|
|
4902
5182
|
const claimedRaw = c.metadata?.totalResultCount;
|
|
4903
5183
|
const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
|
|
4904
5184
|
if (unresolved > 0 && items.length === 0)
|
|
4905
|
-
return
|
|
5185
|
+
return drift7(`${unresolved} results were listed but none could be read`);
|
|
4906
5186
|
if (items.length === 0 && total !== void 0 && total > start) {
|
|
4907
5187
|
return {
|
|
4908
5188
|
ok: false,
|
|
@@ -4973,15 +5253,15 @@ function parseSentInvitations(json) {
|
|
|
4973
5253
|
if (!Array.isArray(refs))
|
|
4974
5254
|
return { ok: false, code: "SCHEMA_DRIFT", message: "the sent invitations list was missing" };
|
|
4975
5255
|
const included = json.included ?? [];
|
|
4976
|
-
const
|
|
5256
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4977
5257
|
const invitations2 = [];
|
|
4978
5258
|
for (const ref of refs) {
|
|
4979
|
-
const view =
|
|
4980
|
-
const inv =
|
|
5259
|
+
const view = byUrn2.get(ref);
|
|
5260
|
+
const inv = byUrn2.get(view?.["*invitation"]) ?? included.find(
|
|
4981
5261
|
(n) => String(n.$type).endsWith(".Invitation") && typeof ref === "string" && ref.endsWith(String(n.entityUrn))
|
|
4982
5262
|
);
|
|
4983
5263
|
if (inv === void 0) continue;
|
|
4984
|
-
const who =
|
|
5264
|
+
const who = byUrn2.get(inv["*toMember"]);
|
|
4985
5265
|
const name = [who?.firstName, who?.lastName].filter((x) => typeof x === "string" && x !== "").join(" ");
|
|
4986
5266
|
const id = String(inv["*toMember"] ?? "").split(":").pop();
|
|
4987
5267
|
const note = typeof inv.message === "string" ? inv.message : inv.message?.text;
|
|
@@ -5116,6 +5396,106 @@ async function runNetwork(list, req, opts = {}, fetch2) {
|
|
|
5116
5396
|
});
|
|
5117
5397
|
}
|
|
5118
5398
|
|
|
5399
|
+
// src/engine/notifications.ts
|
|
5400
|
+
function notificationsUrl(count3, start) {
|
|
5401
|
+
const c = CONTRACTS.notifications;
|
|
5402
|
+
if (c?.decorationId === void 0) throw new Error("the 'notifications' contract is missing");
|
|
5403
|
+
return `${c.path}?decorationId=${c.decorationId}&q=filterVanityName&count=${count3}&start=${start}`;
|
|
5404
|
+
}
|
|
5405
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5406
|
+
var textOf = (v) => {
|
|
5407
|
+
const t = v?.text;
|
|
5408
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5409
|
+
};
|
|
5410
|
+
var absolute = (v) => typeof v === "string" && v !== "" ? v.startsWith("/") ? `https://www.linkedin.com${v}` : v : void 0;
|
|
5411
|
+
function card(n) {
|
|
5412
|
+
const text7 = textOf(n.headline);
|
|
5413
|
+
if (text7 === void 0) return void 0;
|
|
5414
|
+
const kind = String(n.entityUrn ?? "").match(/fsd_notificationCard:\(([^,]+),/)?.[1] ?? "UNKNOWN";
|
|
5415
|
+
const detail = [n.subHeadline, n.contentPrimaryText, n.contentSecondaryText, n.kickerText].map(textOf).filter((t) => t !== void 0).join(" \xB7 ");
|
|
5416
|
+
const at = typeof n.publishedAt === "number" ? new Date(n.publishedAt).toISOString() : void 0;
|
|
5417
|
+
const url = absolute(n.cardAction?.actionTarget);
|
|
5418
|
+
const from = absolute(n.headerImage?.actionTarget);
|
|
5419
|
+
return {
|
|
5420
|
+
kind,
|
|
5421
|
+
text: text7,
|
|
5422
|
+
...detail !== "" ? { detail } : {},
|
|
5423
|
+
...at !== void 0 ? { at } : {},
|
|
5424
|
+
read: n.read === true,
|
|
5425
|
+
...url !== void 0 ? { url } : {},
|
|
5426
|
+
...from !== void 0 ? { from } : {}
|
|
5427
|
+
};
|
|
5428
|
+
}
|
|
5429
|
+
function parseNotifications(json) {
|
|
5430
|
+
const root = json;
|
|
5431
|
+
const data = root?.data;
|
|
5432
|
+
const listed = data?.["*elements"] ?? data?.elements;
|
|
5433
|
+
if (!Array.isArray(listed)) return drift8("the notifications answer carried no card list");
|
|
5434
|
+
const byUrn2 = new Map((root?.included ?? []).map((n) => [n.entityUrn, n]));
|
|
5435
|
+
const items = listed.flatMap((u) => {
|
|
5436
|
+
const n = byUrn2.get(u);
|
|
5437
|
+
const c = n === void 0 ? void 0 : card(n);
|
|
5438
|
+
return c === void 0 ? [] : [c];
|
|
5439
|
+
});
|
|
5440
|
+
if (listed.length > 0 && items.length === 0)
|
|
5441
|
+
return drift8(`${listed.length} notifications were listed but none could be read`);
|
|
5442
|
+
const meta = data?.metadata ?? {};
|
|
5443
|
+
return {
|
|
5444
|
+
ok: true,
|
|
5445
|
+
items,
|
|
5446
|
+
...typeof meta.numUnseen === "number" ? { unseen: meta.numUnseen } : {},
|
|
5447
|
+
...typeof meta.nextStart === "number" ? { next: meta.nextStart } : {}
|
|
5448
|
+
};
|
|
5449
|
+
}
|
|
5450
|
+
|
|
5451
|
+
// src/commands/notifications.ts
|
|
5452
|
+
function liveFetch8(quiet) {
|
|
5453
|
+
const session = loadSession();
|
|
5454
|
+
if (session.state !== "ok")
|
|
5455
|
+
return err("notifications", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
5456
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
5457
|
+
return async (url, spendClass) => {
|
|
5458
|
+
const r = await client.request({ url, spendClass, operation: "notifications" });
|
|
5459
|
+
return r.ok ? { ok: true, json: r.json } : r;
|
|
5460
|
+
};
|
|
5461
|
+
}
|
|
5462
|
+
var PAGE = 25;
|
|
5463
|
+
var compactNotification = (n) => line([n.read ? void 0 : "unread", n.at, n.kind, n.text, n.detail, n.url]);
|
|
5464
|
+
async function runNotifications(req, opts = {}, fetch2) {
|
|
5465
|
+
const get = fetch2 ?? liveFetch8(opts.quiet === true);
|
|
5466
|
+
if (typeof get !== "function") return get;
|
|
5467
|
+
const limit = Math.max(1, req.limit);
|
|
5468
|
+
const items = [];
|
|
5469
|
+
let unseen;
|
|
5470
|
+
let start = 0;
|
|
5471
|
+
let stoppedBy;
|
|
5472
|
+
while (start !== void 0 && items.length < limit) {
|
|
5473
|
+
const res = await get(notificationsUrl(PAGE, start), "page");
|
|
5474
|
+
const page = res.ok ? parseNotifications(res.json) : res;
|
|
5475
|
+
if (!page.ok) {
|
|
5476
|
+
if (items.length === 0 && start === 0)
|
|
5477
|
+
return err("notifications", page.code, page.message, page.hint);
|
|
5478
|
+
stoppedBy = page.code;
|
|
5479
|
+
break;
|
|
5480
|
+
}
|
|
5481
|
+
unseen ??= page.unseen;
|
|
5482
|
+
items.push(...page.items.filter((n) => req.unread !== true || !n.read));
|
|
5483
|
+
start = page.next !== void 0 && page.next > start ? page.next : void 0;
|
|
5484
|
+
}
|
|
5485
|
+
const kept = items.slice(0, limit);
|
|
5486
|
+
const state = stoppedBy !== void 0 || start !== void 0 && kept.length === limit ? "partial" : "complete";
|
|
5487
|
+
return ok("notifications", {
|
|
5488
|
+
...unseen !== void 0 ? { unseen } : {},
|
|
5489
|
+
items: shape(kept, opts, compactNotification),
|
|
5490
|
+
meta: {
|
|
5491
|
+
state,
|
|
5492
|
+
operation: "notifications",
|
|
5493
|
+
returnedCount: kept.length,
|
|
5494
|
+
...stoppedBy !== void 0 ? { stoppedBy } : {}
|
|
5495
|
+
}
|
|
5496
|
+
});
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5119
5499
|
// src/engine/contact-info.ts
|
|
5120
5500
|
var SCREEN2 = "com.linkedin.sdui.flagshipnav.profile.ProfileContactDetailsOverlay";
|
|
5121
5501
|
var CONTACT_INFO_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/navigation?screenId=${SCREEN2}&sduiid=${SCREEN2}`;
|
|
@@ -5138,7 +5518,7 @@ function contactInfoBody(publicId, firstName, lastName) {
|
|
|
5138
5518
|
isModal: true
|
|
5139
5519
|
};
|
|
5140
5520
|
}
|
|
5141
|
-
var
|
|
5521
|
+
var drift9 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5142
5522
|
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
5143
5523
|
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
5144
5524
|
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
@@ -5176,13 +5556,13 @@ function fieldsOf(stream) {
|
|
|
5176
5556
|
}
|
|
5177
5557
|
var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
5178
5558
|
function put(contact, f) {
|
|
5179
|
-
const
|
|
5559
|
+
const text7 = f.texts.join(", ");
|
|
5180
5560
|
switch (f.view) {
|
|
5181
5561
|
case "your-profile":
|
|
5182
5562
|
return;
|
|
5183
5563
|
// `profile` already has the profile URL.
|
|
5184
5564
|
case "email":
|
|
5185
|
-
contact.email = f.links[0] ??
|
|
5565
|
+
contact.email = f.links[0] ?? text7;
|
|
5186
5566
|
return;
|
|
5187
5567
|
case "website":
|
|
5188
5568
|
contact.websites = [
|
|
@@ -5200,18 +5580,18 @@ function put(contact, f) {
|
|
|
5200
5580
|
contact.twitter = [...contact.twitter ?? [], ...f.texts];
|
|
5201
5581
|
return;
|
|
5202
5582
|
case void 0:
|
|
5203
|
-
if (/^connected since$/i.test(f.label)) contact.connectedSince =
|
|
5204
|
-
else contact.other = { ...contact.other, [f.label]:
|
|
5583
|
+
if (/^connected since$/i.test(f.label)) contact.connectedSince = text7;
|
|
5584
|
+
else contact.other = { ...contact.other, [f.label]: text7 };
|
|
5205
5585
|
return;
|
|
5206
5586
|
default:
|
|
5207
|
-
contact[camel(f.view)] =
|
|
5587
|
+
contact[camel(f.view)] = text7;
|
|
5208
5588
|
}
|
|
5209
5589
|
}
|
|
5210
5590
|
function parseContactInfo(stream) {
|
|
5211
5591
|
if (!stream.includes("profile-contact-info-details-view"))
|
|
5212
|
-
return
|
|
5592
|
+
return drift9("the contact info answer was not the contact info overlay");
|
|
5213
5593
|
const fields = fieldsOf(stream);
|
|
5214
|
-
if (fields.length === 0) return
|
|
5594
|
+
if (fields.length === 0) return drift9("the contact info overlay had no fields");
|
|
5215
5595
|
const contact = {};
|
|
5216
5596
|
for (const f of fields) put(contact, f);
|
|
5217
5597
|
return { ok: true, contact };
|
|
@@ -5232,10 +5612,10 @@ function positionsPageUrl(profileUrn, start) {
|
|
|
5232
5612
|
const c = contract3("profilePositions");
|
|
5233
5613
|
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
5234
5614
|
}
|
|
5235
|
-
var
|
|
5236
|
-
var
|
|
5615
|
+
var drift10 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5616
|
+
var str4 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
5237
5617
|
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
5238
|
-
function
|
|
5618
|
+
function defined8(obj) {
|
|
5239
5619
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5240
5620
|
return obj;
|
|
5241
5621
|
}
|
|
@@ -5250,7 +5630,7 @@ function range(v) {
|
|
|
5250
5630
|
const r = v;
|
|
5251
5631
|
const start = date(r?.start);
|
|
5252
5632
|
const end = date(r?.end);
|
|
5253
|
-
return
|
|
5633
|
+
return defined8({
|
|
5254
5634
|
start,
|
|
5255
5635
|
end,
|
|
5256
5636
|
current: start !== void 0 && end === void 0 ? true : void 0
|
|
@@ -5273,21 +5653,21 @@ var Index = class {
|
|
|
5273
5653
|
collection(urn) {
|
|
5274
5654
|
const c = this.get(urn);
|
|
5275
5655
|
const refs = Array.isArray(c?.["*elements"]) ? c?.["*elements"] : [];
|
|
5276
|
-
const
|
|
5656
|
+
const nodes2 = refs.flatMap((r) => this.list(r));
|
|
5277
5657
|
const total = c?.paging?.total;
|
|
5278
|
-
return typeof total === "number" ? { nodes, total } : { nodes };
|
|
5658
|
+
return typeof total === "number" ? { nodes: nodes2, total } : { nodes: nodes2 };
|
|
5279
5659
|
}
|
|
5280
5660
|
};
|
|
5281
5661
|
function role(p, group, ix) {
|
|
5282
5662
|
const companyUrn = p.companyUrn ?? group?.companyUrn;
|
|
5283
|
-
return
|
|
5284
|
-
title:
|
|
5285
|
-
company:
|
|
5663
|
+
return defined8({
|
|
5664
|
+
title: str4(p.title),
|
|
5665
|
+
company: str4(p.companyName) ?? str4(group?.companyName),
|
|
5286
5666
|
companyId: idOf3(companyUrn),
|
|
5287
|
-
employmentType:
|
|
5288
|
-
location:
|
|
5667
|
+
employmentType: str4(ix.get(p["*employmentType"])?.name),
|
|
5668
|
+
location: str4(p.locationName) ?? str4(p.geoLocationName),
|
|
5289
5669
|
...range(p.dateRange),
|
|
5290
|
-
description:
|
|
5670
|
+
description: str4(p.description)
|
|
5291
5671
|
});
|
|
5292
5672
|
}
|
|
5293
5673
|
function rolesOf(groups, ix) {
|
|
@@ -5297,39 +5677,39 @@ function rolesOf(groups, ix) {
|
|
|
5297
5677
|
});
|
|
5298
5678
|
}
|
|
5299
5679
|
function school(e) {
|
|
5300
|
-
return
|
|
5301
|
-
school:
|
|
5680
|
+
return defined8({
|
|
5681
|
+
school: str4(e.schoolName),
|
|
5302
5682
|
schoolId: idOf3(e.schoolUrn),
|
|
5303
|
-
degree:
|
|
5304
|
-
field:
|
|
5683
|
+
degree: str4(e.degreeName),
|
|
5684
|
+
field: str4(e.fieldOfStudy),
|
|
5305
5685
|
...range(e.dateRange),
|
|
5306
|
-
grade:
|
|
5307
|
-
activities:
|
|
5308
|
-
description:
|
|
5686
|
+
grade: str4(e.grade),
|
|
5687
|
+
activities: str4(e.activities),
|
|
5688
|
+
description: str4(e.description)
|
|
5309
5689
|
});
|
|
5310
5690
|
}
|
|
5311
5691
|
function entry(n) {
|
|
5312
|
-
const proficiency =
|
|
5313
|
-
return
|
|
5314
|
-
name:
|
|
5315
|
-
title:
|
|
5316
|
-
role:
|
|
5317
|
-
organization:
|
|
5318
|
-
authority:
|
|
5319
|
-
issuer:
|
|
5320
|
-
publisher:
|
|
5692
|
+
const proficiency = str4(n.proficiency);
|
|
5693
|
+
return defined8({
|
|
5694
|
+
name: str4(n.name),
|
|
5695
|
+
title: str4(n.title),
|
|
5696
|
+
role: str4(n.role),
|
|
5697
|
+
organization: str4(n.companyName),
|
|
5698
|
+
authority: str4(n.authority),
|
|
5699
|
+
issuer: str4(n.issuer),
|
|
5700
|
+
publisher: str4(n.publisher),
|
|
5321
5701
|
proficiency: proficiency?.toLowerCase().replace(/_/g, " "),
|
|
5322
|
-
number:
|
|
5323
|
-
score:
|
|
5324
|
-
cause:
|
|
5702
|
+
number: str4(n.number) ?? str4(n.licenseNumber) ?? str4(n.patentNumber),
|
|
5703
|
+
score: str4(n.score),
|
|
5704
|
+
cause: str4(n.cause)?.toLowerCase().replace(/_/g, " "),
|
|
5325
5705
|
...range(n.dateRange),
|
|
5326
5706
|
issued: date(n.issuedOn),
|
|
5327
5707
|
published: date(n.publishedOn),
|
|
5328
|
-
url:
|
|
5329
|
-
description:
|
|
5708
|
+
url: str4(n.url),
|
|
5709
|
+
description: str4(n.description)
|
|
5330
5710
|
});
|
|
5331
5711
|
}
|
|
5332
|
-
var
|
|
5712
|
+
var SECTIONS2 = {
|
|
5333
5713
|
certifications: "*profileCertifications",
|
|
5334
5714
|
languages: "*profileLanguages",
|
|
5335
5715
|
honors: "*profileHonors",
|
|
@@ -5345,13 +5725,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
|
5345
5725
|
function parseFullProfile(json) {
|
|
5346
5726
|
const root = json;
|
|
5347
5727
|
const listed = root?.data?.["*elements"];
|
|
5348
|
-
if (!Array.isArray(listed)) return
|
|
5728
|
+
if (!Array.isArray(listed)) return drift10("the profile answer carried no profile list");
|
|
5349
5729
|
if (listed.length === 0)
|
|
5350
5730
|
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
5351
5731
|
const ix = new Index(root?.included ?? []);
|
|
5352
5732
|
const p = ix.get(listed[0]);
|
|
5353
5733
|
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
5354
|
-
if (p === void 0 || urn === void 0) return
|
|
5734
|
+
if (p === void 0 || urn === void 0) return drift10("the profile was listed but not sent");
|
|
5355
5735
|
const counts2 = {};
|
|
5356
5736
|
const count3 = (key, shown, total) => {
|
|
5357
5737
|
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
@@ -5363,32 +5743,32 @@ function parseFullProfile(json) {
|
|
|
5363
5743
|
const education = schools.nodes.map(school);
|
|
5364
5744
|
const skillNodes = ix.collection(p["*profileSkills"]);
|
|
5365
5745
|
count3("skills", skillNodes.nodes.length, skillNodes.total);
|
|
5366
|
-
const skills = skillNodes.nodes.flatMap((s) =>
|
|
5746
|
+
const skills = skillNodes.nodes.flatMap((s) => str4(s.name) ?? []);
|
|
5367
5747
|
const sections = {};
|
|
5368
|
-
for (const [key, field] of Object.entries(
|
|
5748
|
+
for (const [key, field] of Object.entries(SECTIONS2)) {
|
|
5369
5749
|
const c = ix.collection(p[field]);
|
|
5370
5750
|
count3(key, c.nodes.length, c.total);
|
|
5371
5751
|
const rows = c.nodes.map(entry);
|
|
5372
5752
|
if (rows.length > 0) sections[key] = rows;
|
|
5373
5753
|
}
|
|
5374
|
-
const publicId =
|
|
5375
|
-
const name = [
|
|
5754
|
+
const publicId = str4(p.publicIdentifier);
|
|
5755
|
+
const name = [str4(p.firstName), str4(p.lastName)].filter(Boolean).join(" ");
|
|
5376
5756
|
const geo = ix.get(p.geoLocation?.["*geo"]);
|
|
5377
5757
|
const bool2 = (v) => v === true ? true : void 0;
|
|
5378
5758
|
return {
|
|
5379
5759
|
ok: true,
|
|
5380
|
-
profile:
|
|
5760
|
+
profile: defined8({
|
|
5381
5761
|
id: urn.split(":").pop(),
|
|
5382
5762
|
urn,
|
|
5383
5763
|
publicId,
|
|
5384
5764
|
name: name === "" ? void 0 : name,
|
|
5385
|
-
firstName:
|
|
5386
|
-
lastName:
|
|
5387
|
-
headline:
|
|
5765
|
+
firstName: str4(p.firstName),
|
|
5766
|
+
lastName: str4(p.lastName),
|
|
5767
|
+
headline: str4(p.headline),
|
|
5388
5768
|
url: publicId === void 0 ? void 0 : `https://www.linkedin.com/in/${publicId}/`,
|
|
5389
|
-
location:
|
|
5390
|
-
industry:
|
|
5391
|
-
about:
|
|
5769
|
+
location: str4(geo?.defaultLocalizedName),
|
|
5770
|
+
industry: str4(ix.get(p["*industry"])?.name),
|
|
5771
|
+
about: str4(p.summary),
|
|
5392
5772
|
title: experience[0]?.title,
|
|
5393
5773
|
company: experience[0]?.company,
|
|
5394
5774
|
school: education[0]?.school,
|
|
@@ -5406,11 +5786,11 @@ function parseFullProfile(json) {
|
|
|
5406
5786
|
function parsePositionsPage(json) {
|
|
5407
5787
|
const root = json;
|
|
5408
5788
|
const refs = root?.data?.["*elements"];
|
|
5409
|
-
if (!Array.isArray(refs)) return
|
|
5789
|
+
if (!Array.isArray(refs)) return drift10("the experience page carried no position groups");
|
|
5410
5790
|
const ix = new Index(root?.included ?? []);
|
|
5411
5791
|
const groups = refs.flatMap((r) => ix.list(r));
|
|
5412
5792
|
if (refs.length > 0 && groups.length === 0)
|
|
5413
|
-
return
|
|
5793
|
+
return drift10(`${refs.length} position groups were listed but none sent`);
|
|
5414
5794
|
const total = root?.data?.paging?.total;
|
|
5415
5795
|
return {
|
|
5416
5796
|
ok: true,
|
|
@@ -5420,66 +5800,443 @@ function parsePositionsPage(json) {
|
|
|
5420
5800
|
};
|
|
5421
5801
|
}
|
|
5422
5802
|
|
|
5423
|
-
// src/
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5803
|
+
// src/engine/recommendations.ts
|
|
5804
|
+
var PAGER = "com.linkedin.sdui.pagers.profile.details.recommendations";
|
|
5805
|
+
var SCREEN3 = "com.linkedin.sdui.flagshipnav.profile.ProfileRecommendationDetails";
|
|
5806
|
+
var RECOMMENDATIONS_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${PAGER}`;
|
|
5807
|
+
var RECOMMENDATIONS_PAGE = 15;
|
|
5808
|
+
function recommendationsBody(kind, vanityName, profileId2, start) {
|
|
5809
|
+
const args = {
|
|
5810
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
5811
|
+
requestedStateKeys: [],
|
|
5812
|
+
payload: {
|
|
5813
|
+
type: kind === "received" ? "Received" : "Given",
|
|
5814
|
+
vanityName,
|
|
5815
|
+
profileId: profileId2,
|
|
5816
|
+
start,
|
|
5817
|
+
detailScreenTabIndex: kind === "received" ? "0" : "1",
|
|
5818
|
+
count: RECOMMENDATIONS_PAGE
|
|
5819
|
+
},
|
|
5820
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
5438
5821
|
};
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
return slug;
|
|
5822
|
+
return {
|
|
5823
|
+
pagerId: PAGER,
|
|
5824
|
+
clientArguments: { ...args, states: [], screenId: SCREEN3, knownTemplateIds: [] },
|
|
5825
|
+
paginationRequest: {
|
|
5826
|
+
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
5827
|
+
pagerId: PAGER,
|
|
5828
|
+
retryCount: 2,
|
|
5829
|
+
requestedArguments: args
|
|
5448
5830
|
}
|
|
5449
|
-
}
|
|
5450
|
-
return s.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/)?.[1] ?? s;
|
|
5831
|
+
};
|
|
5451
5832
|
}
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
const
|
|
5468
|
-
if (
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5833
|
+
var drift11 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5834
|
+
var unquote3 = (s) => JSON.parse(`"${s}"`);
|
|
5835
|
+
var STR = '((?:[^"\\\\]|\\\\.)+)';
|
|
5836
|
+
var loading = (id) => new RegExp(
|
|
5837
|
+
`"id":"${id}"\\}\\},"namespace":"LoadingNamespace"\\},"value":\\{"\\$case":"stringValue","stringValue":"${STR}"`
|
|
5838
|
+
);
|
|
5839
|
+
var NAME = loading("profile_name_loading_state");
|
|
5840
|
+
var HEADLINE = loading("profile_headline_loading_state");
|
|
5841
|
+
var PROFILE_URL = /"url":"(https:\/\/www\.linkedin\.com\/in\/[^"]+)"/;
|
|
5842
|
+
var TEXT3 = /"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g;
|
|
5843
|
+
var FRAGMENT = /\["\$","\$9","\d+",\{"children":\[(?:null|\["\$","br",null,\{\}\]),"((?:[^"\\]|\\.)*)"\]/g;
|
|
5844
|
+
var REF = /"\$L([0-9a-f]+)"/g;
|
|
5845
|
+
var ANY_REF = /"\$L?([0-9a-f]+)"/g;
|
|
5846
|
+
function header(rows, id) {
|
|
5847
|
+
const row = rows.byId.get(id) ?? "";
|
|
5848
|
+
const name = row.match(NAME)?.[1];
|
|
5849
|
+
if (name === void 0) return void 0;
|
|
5850
|
+
const headline = row.match(HEADLINE)?.[1];
|
|
5851
|
+
const all = rows.reach(id).map((r) => rows.byId.get(r) ?? "").join("\n");
|
|
5852
|
+
const texts3 = [...all.matchAll(TEXT3)].map((m) => unquote3(m[1]).trim());
|
|
5853
|
+
const degree = texts3.find((t) => t.startsWith("\xB7"));
|
|
5854
|
+
const shown = /* @__PURE__ */ new Set([unquote3(name), headline === void 0 ? "" : unquote3(headline)]);
|
|
5855
|
+
const context = texts3.filter((t) => t !== degree && !shown.has(t)).pop();
|
|
5856
|
+
const url = row.match(PROFILE_URL)?.[1];
|
|
5857
|
+
return {
|
|
5858
|
+
name: unquote3(name).trim(),
|
|
5859
|
+
...url !== void 0 ? { url } : {},
|
|
5860
|
+
...headline !== void 0 ? { headline: unquote3(headline).trim() } : {},
|
|
5861
|
+
...degree !== void 0 ? { degree: degree.replace(/^·\s*/, "") } : {},
|
|
5862
|
+
...context !== void 0 ? { context } : {}
|
|
5863
|
+
};
|
|
5472
5864
|
}
|
|
5473
|
-
|
|
5474
|
-
if (
|
|
5475
|
-
|
|
5476
|
-
|
|
5865
|
+
function inlined(rows, segment, depth = 0) {
|
|
5866
|
+
if (depth > 3) return segment;
|
|
5867
|
+
return segment.replace(ANY_REF, (ref, id) => {
|
|
5868
|
+
const row = rows.byId.get(id);
|
|
5869
|
+
if (row === void 0) return ref;
|
|
5870
|
+
if (rows.isText(id)) return JSON.stringify(row);
|
|
5871
|
+
return row.startsWith('["$","$9"') ? inlined(rows, row, depth + 1) : ref;
|
|
5872
|
+
});
|
|
5873
|
+
}
|
|
5874
|
+
function bodyOf(segment) {
|
|
5875
|
+
const fragments = [...segment.matchAll(FRAGMENT)].map((m) => unquote3(m[1]));
|
|
5876
|
+
const lines = fragments.length > 0 ? fragments : [...segment.matchAll(TEXT3)].map((m) => unquote3(m[1]));
|
|
5877
|
+
return lines.map((l) => l.replace(/\r/g, "").trimEnd()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
5878
|
+
}
|
|
5879
|
+
function parseRecommendations(stream) {
|
|
5880
|
+
if (!stream.includes("isPartialPage") && !stream.includes(PAGER))
|
|
5881
|
+
return drift11("the recommendations answer was not the recommendations list");
|
|
5882
|
+
const rows = new Rows(stream);
|
|
5883
|
+
const headers = [...rows.byId].filter(([, row]) => NAME.test(row) && !row.startsWith('[["$"')).map(([id]) => id);
|
|
5884
|
+
const heads = new Set(headers);
|
|
5885
|
+
const placed = headers.flatMap((h) => {
|
|
5886
|
+
for (const [id, row] of rows.byId) {
|
|
5887
|
+
const at = row.indexOf(`"$L${h}"`);
|
|
5888
|
+
if (at !== -1) return [{ h, row: id, at }];
|
|
5889
|
+
}
|
|
5890
|
+
return [];
|
|
5891
|
+
});
|
|
5892
|
+
const holders = new Set(placed.map((p) => p.row));
|
|
5893
|
+
const items = [];
|
|
5894
|
+
for (const p of placed) {
|
|
5895
|
+
const row = rows.byId.get(p.row) ?? "";
|
|
5896
|
+
let end = row.length;
|
|
5897
|
+
for (const m of row.slice(p.at + 1).matchAll(REF)) {
|
|
5898
|
+
const id = m[1];
|
|
5899
|
+
if (heads.has(id) || holders.has(id) && id !== p.row) {
|
|
5900
|
+
end = p.at + 1 + (m.index ?? 0);
|
|
5901
|
+
break;
|
|
5902
|
+
}
|
|
5903
|
+
}
|
|
5904
|
+
const who = header(rows, p.h);
|
|
5905
|
+
const text7 = bodyOf(inlined(rows, row.slice(p.at, end)));
|
|
5906
|
+
if (who !== void 0 && text7 !== "") items.push({ ...who, text: text7 });
|
|
5477
5907
|
}
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5908
|
+
if (headers.length > 0 && items.length === 0)
|
|
5909
|
+
return drift11(`${headers.length} recommendations were shown but none could be read`);
|
|
5910
|
+
return { ok: true, items };
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5913
|
+
// src/engine/sdui-profile.ts
|
|
5914
|
+
var NAV_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/navigation";
|
|
5915
|
+
var ACTION_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
5916
|
+
var PROFILE_FIELDS = {
|
|
5917
|
+
headline: {
|
|
5918
|
+
name: "headline",
|
|
5919
|
+
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileEditIntroForm",
|
|
5920
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileIntroForm",
|
|
5921
|
+
binding: "headline",
|
|
5922
|
+
// The web form refuses more ("Exceeded maximum length of 220 characters").
|
|
5923
|
+
maxLength: 220
|
|
5924
|
+
},
|
|
5925
|
+
about: {
|
|
5926
|
+
name: "about",
|
|
5927
|
+
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileAboutForm",
|
|
5928
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileAboutForm",
|
|
5929
|
+
binding: "about",
|
|
5930
|
+
maxLength: 2600
|
|
5931
|
+
}
|
|
5932
|
+
};
|
|
5933
|
+
var drift12 = (message) => ({
|
|
5934
|
+
ok: false,
|
|
5935
|
+
code: "SCHEMA_DRIFT",
|
|
5936
|
+
message,
|
|
5937
|
+
hint: "Re-capture the profile form with scripts/observe-write.ts (edit one character, then revert)."
|
|
5938
|
+
});
|
|
5939
|
+
async function openForm(screen, payload, client, operation) {
|
|
5940
|
+
const result = await client.request({
|
|
5941
|
+
url: `${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
5942
|
+
method: "POST",
|
|
5943
|
+
body: navBody(screen, payload),
|
|
5944
|
+
spendClass: "page",
|
|
5945
|
+
operation
|
|
5946
|
+
});
|
|
5947
|
+
if (!result.ok) {
|
|
5948
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
5949
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
5950
|
+
return out;
|
|
5951
|
+
}
|
|
5952
|
+
return result.classification.raw ?? "";
|
|
5953
|
+
}
|
|
5954
|
+
async function sendAction(requestId, body, client, operation, spendClass = "write") {
|
|
5955
|
+
const result = await client.request({
|
|
5956
|
+
url: `${ACTION_URL}?sduiid=${requestId}`,
|
|
5957
|
+
method: "POST",
|
|
5958
|
+
body,
|
|
5959
|
+
spendClass,
|
|
5960
|
+
operation
|
|
5961
|
+
});
|
|
5962
|
+
if (!result.ok) {
|
|
5963
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
5964
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
5965
|
+
return out;
|
|
5966
|
+
}
|
|
5967
|
+
const raw = result.classification.raw ?? "";
|
|
5968
|
+
const errors = responseErrors(raw);
|
|
5969
|
+
if (errors !== null) {
|
|
5970
|
+
return { ok: false, code: "INVALID_INPUT", message: `LinkedIn refused it: ${errors}` };
|
|
5971
|
+
}
|
|
5972
|
+
return raw;
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
// src/engine/sdui-skill.ts
|
|
5976
|
+
var SKILL = {
|
|
5977
|
+
addScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillAddForm",
|
|
5978
|
+
editScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetailsEditForm",
|
|
5979
|
+
listScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetails",
|
|
5980
|
+
pager: "com.linkedin.sdui.pagers.profile.details.skills",
|
|
5981
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileSkillForm",
|
|
5982
|
+
delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
|
|
5983
|
+
};
|
|
5984
|
+
var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
|
|
5985
|
+
var TEXT4 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
5986
|
+
function skillsFromPage(stream) {
|
|
5987
|
+
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV) && !stream.includes("isPartialPage")) {
|
|
5988
|
+
return drift12("the skills page could not be read");
|
|
5989
|
+
}
|
|
5990
|
+
const skills = [];
|
|
5991
|
+
let from = 0;
|
|
5992
|
+
let i = 0;
|
|
5993
|
+
for (; ; ) {
|
|
5994
|
+
i = stream.indexOf(EDIT_NAV, i);
|
|
5995
|
+
if (i === -1) break;
|
|
5996
|
+
const text7 = balanced(stream, i);
|
|
5997
|
+
const end = i;
|
|
5998
|
+
i += EDIT_NAV.length;
|
|
5999
|
+
if (text7 === null) continue;
|
|
6000
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
6001
|
+
const id = payload?.skillId;
|
|
6002
|
+
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
6003
|
+
continue;
|
|
6004
|
+
const names = [...stream.slice(from, end).matchAll(TEXT4)].map(
|
|
6005
|
+
(m) => JSON.parse(`"${m[1]}"`)
|
|
6006
|
+
);
|
|
6007
|
+
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
6008
|
+
from = end + text7.length;
|
|
6009
|
+
}
|
|
6010
|
+
return { ok: true, skills };
|
|
6011
|
+
}
|
|
6012
|
+
var SKILL_COMPONENT = /"componentKey":"com\.linkedin\.sdui\.profile\.skill\([^)]+\)","children":\["\$","\$L[0-9a-f]+","[^"]+",\{"componentKey":"[^"]+","initialContent":"\$L([0-9a-f]+)"/g;
|
|
6013
|
+
var SKILL_NAME = /"fontSize":"medium","fontStyle":"normal","fontWeight":"bold","lineHeight":"[^"]*","textAlign":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]/;
|
|
6014
|
+
function skillNamesOf(stream) {
|
|
6015
|
+
const rows = new Rows(stream);
|
|
6016
|
+
return [...stream.matchAll(SKILL_COMPONENT)].flatMap((m) => {
|
|
6017
|
+
const name = rows.reach(m[1]).map((r) => rows.byId.get(r)?.match(SKILL_NAME)?.[1]).find((n) => n !== void 0);
|
|
6018
|
+
return name === void 0 ? [] : [JSON.parse(`"${name}"`)];
|
|
6019
|
+
});
|
|
6020
|
+
}
|
|
6021
|
+
function skillRowsOf(stream) {
|
|
6022
|
+
return [...stream.matchAll(SKILL_COMPONENT)].length;
|
|
6023
|
+
}
|
|
6024
|
+
function listPayloadOf(screen) {
|
|
6025
|
+
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
6026
|
+
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
6027
|
+
const text7 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
6028
|
+
return text7 === null ? null : JSON.parse(text7);
|
|
6029
|
+
}
|
|
6030
|
+
function pagerFrom(payload, start) {
|
|
6031
|
+
const args = {
|
|
6032
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
6033
|
+
requestedStateKeys: [],
|
|
6034
|
+
payload: { ...payload, start },
|
|
6035
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
6036
|
+
};
|
|
6037
|
+
return {
|
|
6038
|
+
pagerId: SKILL.pager,
|
|
6039
|
+
clientArguments: { ...args, states: [], screenId: SKILL.listScreen, knownTemplateIds: [] },
|
|
6040
|
+
paginationRequest: {
|
|
6041
|
+
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
6042
|
+
pagerId: SKILL.pager,
|
|
6043
|
+
retryCount: 0,
|
|
6044
|
+
requestedArguments: args
|
|
6045
|
+
}
|
|
6046
|
+
};
|
|
6047
|
+
}
|
|
6048
|
+
function readSkillForm(stream) {
|
|
6049
|
+
const model = readModel(stream);
|
|
6050
|
+
if (model === null) return drift12("the skill form carried no initial values");
|
|
6051
|
+
const save = findRequest(stream, SKILL.save);
|
|
6052
|
+
const del = findRequest(stream, SKILL.delete);
|
|
6053
|
+
if (save === null && del === null)
|
|
6054
|
+
return drift12("the skill form carried neither a save nor a delete");
|
|
6055
|
+
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
6056
|
+
}
|
|
6057
|
+
var PAGER_URL2 = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${SKILL.pager}`;
|
|
6058
|
+
var MAX_PAGES2 = 10;
|
|
6059
|
+
async function fetchSkills(vanityName, client) {
|
|
6060
|
+
const screen = await openForm(
|
|
6061
|
+
SKILL.listScreen,
|
|
6062
|
+
{ vanityName, isVanityNameResolved: true },
|
|
6063
|
+
client,
|
|
6064
|
+
"skills-screen"
|
|
6065
|
+
);
|
|
6066
|
+
if (typeof screen !== "string") return screen;
|
|
6067
|
+
const payload = listPayloadOf(screen);
|
|
6068
|
+
if (payload === null) return drift12("the Skills screen carried no list request");
|
|
6069
|
+
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
6070
|
+
const skills = [];
|
|
6071
|
+
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
6072
|
+
const result = await client.request({
|
|
6073
|
+
url: PAGER_URL2,
|
|
6074
|
+
method: "POST",
|
|
6075
|
+
body: pagerFrom(payload, skills.length),
|
|
6076
|
+
spendClass: "page",
|
|
6077
|
+
operation: "skills"
|
|
6078
|
+
});
|
|
6079
|
+
if (!result.ok) return { ok: false, code: result.code, message: result.message };
|
|
6080
|
+
const parsed = skillsFromPage(result.classification.raw ?? "");
|
|
6081
|
+
if (!parsed.ok) return parsed;
|
|
6082
|
+
const fresh = parsed.skills.filter((s) => !skills.some((k) => k.skillId === s.skillId));
|
|
6083
|
+
skills.push(...fresh);
|
|
6084
|
+
if (parsed.skills.length < count3 || fresh.length === 0) break;
|
|
6085
|
+
}
|
|
6086
|
+
return { ok: true, skills };
|
|
6087
|
+
}
|
|
6088
|
+
async function openSkillForm(payload, client, edit) {
|
|
6089
|
+
const stream = await openForm(
|
|
6090
|
+
edit ? SKILL.editScreen : SKILL.addScreen,
|
|
6091
|
+
{ ...payload, isVanityNameResolved: true },
|
|
6092
|
+
client,
|
|
6093
|
+
edit ? "skill-edit-form" : "skill-add-form"
|
|
6094
|
+
);
|
|
6095
|
+
return typeof stream === "string" ? readSkillForm(stream) : stream;
|
|
6096
|
+
}
|
|
6097
|
+
async function sendSkill(body, requestId, client) {
|
|
6098
|
+
const sent = await sendAction(
|
|
6099
|
+
requestId,
|
|
6100
|
+
body,
|
|
6101
|
+
client,
|
|
6102
|
+
requestId === SKILL.save ? "skill-add" : "skill-remove"
|
|
6103
|
+
);
|
|
6104
|
+
return typeof sent === "string" ? { ok: true } : sent;
|
|
6105
|
+
}
|
|
6106
|
+
|
|
6107
|
+
// src/commands/profile.ts
|
|
6108
|
+
function liveFetch9(quiet) {
|
|
6109
|
+
const session = loadSession();
|
|
6110
|
+
if (session.state !== "ok")
|
|
6111
|
+
return err("profile", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
6112
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
6113
|
+
return async (url, spendClass, body) => {
|
|
6114
|
+
const r = await client.request({
|
|
6115
|
+
url,
|
|
6116
|
+
...body !== void 0 ? { method: "POST", body } : {},
|
|
6117
|
+
spendClass,
|
|
6118
|
+
operation: "profile"
|
|
6119
|
+
});
|
|
6120
|
+
if (!r.ok) return r;
|
|
6121
|
+
return { ok: true, json: r.json, raw: r.classification.raw ?? "" };
|
|
6122
|
+
};
|
|
6123
|
+
}
|
|
6124
|
+
function memberIdOf(input) {
|
|
6125
|
+
const s = input.trim();
|
|
6126
|
+
const slug = s.match(/linkedin\.com\/in\/([^/?#]+)/)?.[1];
|
|
6127
|
+
if (slug !== void 0) {
|
|
6128
|
+
try {
|
|
6129
|
+
return decodeURIComponent(slug);
|
|
6130
|
+
} catch {
|
|
6131
|
+
return slug;
|
|
6132
|
+
}
|
|
6133
|
+
}
|
|
6134
|
+
return s.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/)?.[1] ?? s;
|
|
6135
|
+
}
|
|
6136
|
+
async function readRestOfExperience(get, p) {
|
|
6137
|
+
const want = p.counts?.experience;
|
|
6138
|
+
if (want === void 0) return;
|
|
6139
|
+
let start = want.shown;
|
|
6140
|
+
while (start < want.total) {
|
|
6141
|
+
const res = await get(positionsPageUrl(p.urn, start), "profile");
|
|
6142
|
+
const page = res.ok ? parsePositionsPage(res.json) : res;
|
|
6143
|
+
if (!page.ok) {
|
|
6144
|
+
p.experienceError = `${page.code}: ${page.message}`;
|
|
6145
|
+
return;
|
|
6146
|
+
}
|
|
6147
|
+
p.experience = [...p.experience ?? [], ...page.experience];
|
|
6148
|
+
start += page.groups;
|
|
6149
|
+
if (page.groups < POSITIONS_PAGE) break;
|
|
6150
|
+
}
|
|
6151
|
+
const counts2 = { ...p.counts };
|
|
6152
|
+
if (start >= want.total) delete counts2.experience;
|
|
6153
|
+
else counts2.experience = { shown: start, total: want.total };
|
|
6154
|
+
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
6155
|
+
else delete p.counts;
|
|
6156
|
+
}
|
|
6157
|
+
async function readContact(get, p) {
|
|
6158
|
+
if (p.publicId === void 0 || p.firstName === void 0) {
|
|
6159
|
+
p.contactError = "NOT_FOUND: the profile has no public id or name to ask with";
|
|
6160
|
+
return;
|
|
6161
|
+
}
|
|
6162
|
+
const body = contactInfoBody(p.publicId, p.firstName, p.lastName ?? "");
|
|
6163
|
+
const res = await get(CONTACT_INFO_URL, "profile", body);
|
|
6164
|
+
const read = res.ok ? parseContactInfo(res.raw ?? "") : res;
|
|
6165
|
+
if (read.ok) p.contact = read.contact;
|
|
6166
|
+
else p.contactError = `${read.code}: ${read.message}`;
|
|
6167
|
+
}
|
|
6168
|
+
var SKILL_PAGES = 10;
|
|
6169
|
+
async function readAllSkills(get, p) {
|
|
6170
|
+
const fail2 = (code, message) => {
|
|
6171
|
+
p.skillsError = `${code}: ${message}`;
|
|
6172
|
+
};
|
|
6173
|
+
if (p.publicId === void 0)
|
|
6174
|
+
return fail2("NOT_FOUND", "the profile has no public id to ask with");
|
|
6175
|
+
const screen = SKILL.listScreen;
|
|
6176
|
+
const nav = await get(
|
|
6177
|
+
`${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
6178
|
+
"page",
|
|
6179
|
+
navBody(screen, { vanityName: p.publicId, isVanityNameResolved: true })
|
|
6180
|
+
);
|
|
6181
|
+
if (!nav.ok) return fail2(nav.code, nav.message);
|
|
6182
|
+
const payload = listPayloadOf(nav.raw ?? "");
|
|
6183
|
+
if (payload === null) return fail2("SCHEMA_DRIFT", "the Skills screen carried no list request");
|
|
6184
|
+
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
6185
|
+
const total = p.counts?.skills?.total;
|
|
6186
|
+
const skills = [];
|
|
6187
|
+
let start = 0;
|
|
6188
|
+
for (let page = 0; page < SKILL_PAGES; page++) {
|
|
6189
|
+
const res = await get(PAGER_URL2, "page", pagerFrom(payload, start));
|
|
6190
|
+
if (!res.ok) return fail2(res.code, res.message);
|
|
6191
|
+
const rows = skillRowsOf(res.raw ?? "");
|
|
6192
|
+
const names = skillNamesOf(res.raw ?? "");
|
|
6193
|
+
if (rows > names.length)
|
|
6194
|
+
return fail2("SCHEMA_DRIFT", `${rows} skills were shown, ${names.length} read`);
|
|
6195
|
+
skills.push(...names);
|
|
6196
|
+
start += rows;
|
|
6197
|
+
if (rows < count3 || total !== void 0 && start >= total) break;
|
|
6198
|
+
}
|
|
6199
|
+
if (skills.length === 0) return fail2("SCHEMA_DRIFT", "the skills list held no skills");
|
|
6200
|
+
p.skills = skills;
|
|
6201
|
+
const counts2 = { ...p.counts };
|
|
6202
|
+
if (total === void 0 || skills.length >= total) delete counts2.skills;
|
|
6203
|
+
else counts2.skills = { shown: skills.length, total };
|
|
6204
|
+
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
6205
|
+
else delete p.counts;
|
|
6206
|
+
}
|
|
6207
|
+
var RECOMMENDATION_PAGES = 10;
|
|
6208
|
+
async function readRecommendations(get, p) {
|
|
6209
|
+
if (p.publicId === void 0) {
|
|
6210
|
+
p.recommendationsError = "NOT_FOUND: the profile has no public id to ask with";
|
|
6211
|
+
return;
|
|
6212
|
+
}
|
|
6213
|
+
const out = { received: [], given: [] };
|
|
6214
|
+
for (const kind of ["received", "given"]) {
|
|
6215
|
+
for (let page = 0; page < RECOMMENDATION_PAGES; page++) {
|
|
6216
|
+
const body = recommendationsBody(kind, p.publicId, p.id, out[kind].length);
|
|
6217
|
+
const res = await get(RECOMMENDATIONS_URL, "page", body);
|
|
6218
|
+
const read = res.ok ? parseRecommendations(res.raw ?? "") : res;
|
|
6219
|
+
if (!read.ok) {
|
|
6220
|
+
p.recommendationsError = `${read.code}: ${read.message}`;
|
|
6221
|
+
return;
|
|
6222
|
+
}
|
|
6223
|
+
out[kind].push(...read.items);
|
|
6224
|
+
if (read.items.length < RECOMMENDATIONS_PAGE) break;
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
p.recommendations = out;
|
|
6228
|
+
}
|
|
6229
|
+
async function readPosts(get, p, n, compact2) {
|
|
6230
|
+
const r = await runPostsSearch(
|
|
6231
|
+
{ from: [p.id], sort: "recent", limit: n },
|
|
6232
|
+
compact2 ? { compact: true } : {},
|
|
6233
|
+
async (url, body) => {
|
|
6234
|
+
const res = await get(url, "search", body);
|
|
6235
|
+
return res.ok ? { ok: true, raw: res.raw ?? "" } : res;
|
|
6236
|
+
}
|
|
6237
|
+
);
|
|
6238
|
+
if (r.ok) p.posts = r.data.items;
|
|
6239
|
+
else p.postsError = `${r.error.code}: ${r.error.message}`;
|
|
5483
6240
|
}
|
|
5484
6241
|
var span = (x) => x.start === void 0 && x.end === void 0 ? void 0 : `${x.start ?? "?"} \u2013 ${x.current === true ? "now" : x.end ?? "?"}`;
|
|
5485
6242
|
var roleLine = (r) => line([r.title, r.company, span(r), r.employmentType, r.location]);
|
|
@@ -5520,7 +6277,7 @@ async function runProfile(input, opts = {}, fetch2, req = {}) {
|
|
|
5520
6277
|
"a public id, profile URL or urn is required",
|
|
5521
6278
|
"lnrelay profile <public-id|url|urn>"
|
|
5522
6279
|
);
|
|
5523
|
-
const get = fetch2 ??
|
|
6280
|
+
const get = fetch2 ?? liveFetch9(opts.quiet === true);
|
|
5524
6281
|
if (typeof get !== "function") return get;
|
|
5525
6282
|
const res = await get(fullProfileUrl(memberIdOf(input)), "profile");
|
|
5526
6283
|
if (!res.ok) return err("profile", res.code, res.message, res.hint);
|
|
@@ -5528,7 +6285,11 @@ async function runProfile(input, opts = {}, fetch2, req = {}) {
|
|
|
5528
6285
|
if (!parsed.ok) return err("profile", parsed.code, parsed.message, parsed.hint);
|
|
5529
6286
|
const p = parsed.profile;
|
|
5530
6287
|
await readRestOfExperience(get, p);
|
|
6288
|
+
if (req.skills === true) await readAllSkills(get, p);
|
|
6289
|
+
if (req.recommendations === true) await readRecommendations(get, p);
|
|
5531
6290
|
if (req.contact === true) await readContact(get, p);
|
|
6291
|
+
if (req.posts !== void 0 && req.posts > 0)
|
|
6292
|
+
await readPosts(get, p, req.posts, opts.compact === true);
|
|
5532
6293
|
if (opts.raw === true) return ok("profile", { ...p, raw: res.json });
|
|
5533
6294
|
if (opts.fields !== void 0 && opts.fields !== "")
|
|
5534
6295
|
return ok("profile", project([p], opts.fields)[0]);
|
|
@@ -5587,9 +6348,9 @@ var COMMANDS = [
|
|
|
5587
6348
|
},
|
|
5588
6349
|
{
|
|
5589
6350
|
name: "profile",
|
|
5590
|
-
cost: "1 profile read (+1 per 50 companies past the first 10; --contact +1)",
|
|
5591
|
-
summary: "A profile in full: name, headline, about, every role with dates and descriptions, education, skills, honors, publications, volunteering and the other sections. --contact adds contact info: email, websites, phone, birthday, connected since.",
|
|
5592
|
-
usage: "lnrelay profile <public-id|profile-id|urn|url> [--contact] [--compact | --fields a,b,c] [--raw]",
|
|
6351
|
+
cost: "1 profile read (+1 per 50 companies past the first 10; --contact +1; --posts +1 search; --skills +1 page per 10; --recommendations +2 pages)",
|
|
6352
|
+
summary: "A profile in full: name, headline, about, every role with dates and descriptions, education, skills, honors, publications, volunteering and the other sections. --contact adds contact info: email, websites, phone, birthday, connected since. --posts N adds their N newest posts; --skills reads every skill past the top 20; --recommendations adds those they received and gave.",
|
|
6353
|
+
usage: "lnrelay profile <public-id|profile-id|urn|url> [--contact] [--posts N] [--skills]\n [--recommendations]\n [--compact | --fields a,b,c] [--raw]",
|
|
5593
6354
|
audience: ["cli", "mcp"],
|
|
5594
6355
|
risk: "read",
|
|
5595
6356
|
implemented: true
|
|
@@ -5634,16 +6395,16 @@ var COMMANDS = [
|
|
|
5634
6395
|
name: "jobs",
|
|
5635
6396
|
cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
|
|
5636
6397
|
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`.",
|
|
5637
|
-
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.',
|
|
6398
|
+
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.',
|
|
5638
6399
|
audience: ["cli", "mcp"],
|
|
5639
6400
|
risk: "read",
|
|
5640
6401
|
implemented: true
|
|
5641
6402
|
},
|
|
5642
6403
|
{
|
|
5643
6404
|
name: "job",
|
|
5644
|
-
cost: "1 job read per 100 jobs; --team adds 1 page call per job",
|
|
5645
|
-
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.",
|
|
5646
|
-
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--compact | --fields a,b,c]",
|
|
6405
|
+
cost: "1 job read per 100 jobs; --team adds 1 page call per job; --insights 1 job read per job",
|
|
6406
|
+
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.",
|
|
6407
|
+
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--insights] [--compact | --fields a,b,c]",
|
|
5647
6408
|
audience: ["cli", "mcp"],
|
|
5648
6409
|
risk: "read",
|
|
5649
6410
|
implemented: true
|
|
@@ -5748,11 +6509,20 @@ var COMMANDS = [
|
|
|
5748
6509
|
risk: "read",
|
|
5749
6510
|
implemented: true
|
|
5750
6511
|
},
|
|
6512
|
+
{
|
|
6513
|
+
name: "notifications",
|
|
6514
|
+
cost: "1 page call per 25",
|
|
6515
|
+
summary: "Your notifications, newest first: what each says, when, read or not, where it goes and who it is about. Reading them here does not mark them seen.",
|
|
6516
|
+
usage: "lnrelay notifications [--unread] [--limit N] [--compact | --fields a,b,c]",
|
|
6517
|
+
audience: ["cli", "mcp"],
|
|
6518
|
+
risk: "read",
|
|
6519
|
+
implemented: true
|
|
6520
|
+
},
|
|
5751
6521
|
{
|
|
5752
6522
|
name: "viewers",
|
|
5753
6523
|
cost: "2 page calls",
|
|
5754
|
-
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.",
|
|
5755
|
-
usage: "lnrelay viewers [--compact | --fields a,b,c]",
|
|
6524
|
+
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.",
|
|
6525
|
+
usage: "lnrelay viewers [--days 7|14|28|90|365] [--compact | --fields a,b,c]",
|
|
5756
6526
|
audience: ["cli", "mcp"],
|
|
5757
6527
|
risk: "read",
|
|
5758
6528
|
implemented: true
|
|
@@ -5953,68 +6723,6 @@ function mcpCommands() {
|
|
|
5953
6723
|
return COMMANDS.filter((c) => c.audience.includes("mcp") && c.risk !== "write");
|
|
5954
6724
|
}
|
|
5955
6725
|
|
|
5956
|
-
// src/engine/sdui-profile.ts
|
|
5957
|
-
var NAV_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/navigation";
|
|
5958
|
-
var ACTION_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
5959
|
-
var PROFILE_FIELDS = {
|
|
5960
|
-
headline: {
|
|
5961
|
-
name: "headline",
|
|
5962
|
-
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileEditIntroForm",
|
|
5963
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileIntroForm",
|
|
5964
|
-
binding: "headline",
|
|
5965
|
-
// The web form refuses more ("Exceeded maximum length of 220 characters").
|
|
5966
|
-
maxLength: 220
|
|
5967
|
-
},
|
|
5968
|
-
about: {
|
|
5969
|
-
name: "about",
|
|
5970
|
-
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileAboutForm",
|
|
5971
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileAboutForm",
|
|
5972
|
-
binding: "about",
|
|
5973
|
-
maxLength: 2600
|
|
5974
|
-
}
|
|
5975
|
-
};
|
|
5976
|
-
var drift9 = (message) => ({
|
|
5977
|
-
ok: false,
|
|
5978
|
-
code: "SCHEMA_DRIFT",
|
|
5979
|
-
message,
|
|
5980
|
-
hint: "Re-capture the profile form with scripts/observe-write.ts (edit one character, then revert)."
|
|
5981
|
-
});
|
|
5982
|
-
async function openForm(screen, payload, client, operation) {
|
|
5983
|
-
const result = await client.request({
|
|
5984
|
-
url: `${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
5985
|
-
method: "POST",
|
|
5986
|
-
body: navBody(screen, payload),
|
|
5987
|
-
spendClass: "page",
|
|
5988
|
-
operation
|
|
5989
|
-
});
|
|
5990
|
-
if (!result.ok) {
|
|
5991
|
-
const out = { ok: false, code: result.code, message: result.message };
|
|
5992
|
-
if (result.hint !== void 0) out.hint = result.hint;
|
|
5993
|
-
return out;
|
|
5994
|
-
}
|
|
5995
|
-
return result.classification.raw ?? "";
|
|
5996
|
-
}
|
|
5997
|
-
async function sendAction(requestId, body, client, operation, spendClass = "write") {
|
|
5998
|
-
const result = await client.request({
|
|
5999
|
-
url: `${ACTION_URL}?sduiid=${requestId}`,
|
|
6000
|
-
method: "POST",
|
|
6001
|
-
body,
|
|
6002
|
-
spendClass,
|
|
6003
|
-
operation
|
|
6004
|
-
});
|
|
6005
|
-
if (!result.ok) {
|
|
6006
|
-
const out = { ok: false, code: result.code, message: result.message };
|
|
6007
|
-
if (result.hint !== void 0) out.hint = result.hint;
|
|
6008
|
-
return out;
|
|
6009
|
-
}
|
|
6010
|
-
const raw = result.classification.raw ?? "";
|
|
6011
|
-
const errors = responseErrors(raw);
|
|
6012
|
-
if (errors !== null) {
|
|
6013
|
-
return { ok: false, code: "INVALID_INPUT", message: `LinkedIn refused it: ${errors}` };
|
|
6014
|
-
}
|
|
6015
|
-
return raw;
|
|
6016
|
-
}
|
|
6017
|
-
|
|
6018
6726
|
// src/engine/sdui-position.ts
|
|
6019
6727
|
var POSITION = {
|
|
6020
6728
|
addScreen: "com.linkedin.sdui.flagshipnav.profile.ProfilePositionAddForm",
|
|
@@ -6024,38 +6732,38 @@ var POSITION = {
|
|
|
6024
6732
|
save: "com.linkedin.sdui.requests.profile.saveProfilePositionForm",
|
|
6025
6733
|
delete: "com.linkedin.sdui.requests.profile.deleteProfilePositionForm"
|
|
6026
6734
|
};
|
|
6027
|
-
var
|
|
6735
|
+
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
6028
6736
|
function listPositions(stream) {
|
|
6029
|
-
if (readModel(stream) === null && !stream.includes(
|
|
6030
|
-
return
|
|
6737
|
+
if (readModel(stream) === null && !stream.includes(EDIT_NAV2) && !stream.includes('"rows"')) {
|
|
6738
|
+
return drift12("the Experience screen could not be read");
|
|
6031
6739
|
}
|
|
6032
6740
|
const positions = [];
|
|
6033
6741
|
const seen = /* @__PURE__ */ new Set();
|
|
6034
6742
|
let i = 0;
|
|
6035
6743
|
for (; ; ) {
|
|
6036
|
-
i = stream.indexOf(
|
|
6744
|
+
i = stream.indexOf(EDIT_NAV2, i);
|
|
6037
6745
|
if (i === -1) break;
|
|
6038
|
-
const
|
|
6039
|
-
i +=
|
|
6040
|
-
if (
|
|
6041
|
-
const payload = JSON.parse(
|
|
6746
|
+
const text7 = balanced(stream, i);
|
|
6747
|
+
i += EDIT_NAV2.length;
|
|
6748
|
+
if (text7 === null) continue;
|
|
6749
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
6042
6750
|
const id = payload?.positionId;
|
|
6043
6751
|
if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
|
|
6044
6752
|
seen.add(id);
|
|
6045
6753
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
6046
6754
|
}
|
|
6047
6755
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
6048
|
-
return
|
|
6756
|
+
return drift12("the Experience screen listed no roles and did not look like one");
|
|
6049
6757
|
}
|
|
6050
6758
|
return { ok: true, positions };
|
|
6051
6759
|
}
|
|
6052
6760
|
function readPositionForm(stream) {
|
|
6053
6761
|
const model = readModel(stream);
|
|
6054
|
-
if (model === null) return
|
|
6762
|
+
if (model === null) return drift12("the position form carried no initial values");
|
|
6055
6763
|
const media = findRequest(stream, POSITION.media);
|
|
6056
6764
|
const prefix = media?.payload.formIdPrefix;
|
|
6057
6765
|
if (media === null || typeof prefix !== "string") {
|
|
6058
|
-
return
|
|
6766
|
+
return drift12("the position form carried no save step (uploadPositionMedia)");
|
|
6059
6767
|
}
|
|
6060
6768
|
const del = findRequest(stream, POSITION.delete);
|
|
6061
6769
|
return {
|
|
@@ -6088,7 +6796,7 @@ function mediaBody(form, model) {
|
|
|
6088
6796
|
}
|
|
6089
6797
|
function saveFromReply(reply2) {
|
|
6090
6798
|
const args = findRequest(reply2, POSITION.save);
|
|
6091
|
-
return args === null ?
|
|
6799
|
+
return args === null ? drift12("the media step did not hand back the save action") : { ok: true, args };
|
|
6092
6800
|
}
|
|
6093
6801
|
function positionSaveBody(save, model, screen) {
|
|
6094
6802
|
const sending = new Map(model);
|
|
@@ -6100,7 +6808,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
6100
6808
|
}
|
|
6101
6809
|
function deleteBody(form) {
|
|
6102
6810
|
if (form.del === null)
|
|
6103
|
-
return
|
|
6811
|
+
return drift12("this form has no delete action (it is not an existing role)");
|
|
6104
6812
|
const states = wireStates(keysOf(form.del), form.model, resolver);
|
|
6105
6813
|
if (!Array.isArray(states)) return states;
|
|
6106
6814
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states, form.screen) };
|
|
@@ -6410,123 +7118,6 @@ async function runFindFilters(kind, req, opts = {}, fetch2) {
|
|
|
6410
7118
|
});
|
|
6411
7119
|
}
|
|
6412
7120
|
|
|
6413
|
-
// src/engine/sdui-skill.ts
|
|
6414
|
-
var SKILL = {
|
|
6415
|
-
addScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillAddForm",
|
|
6416
|
-
editScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetailsEditForm",
|
|
6417
|
-
listScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetails",
|
|
6418
|
-
pager: "com.linkedin.sdui.pagers.profile.details.skills",
|
|
6419
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileSkillForm",
|
|
6420
|
-
delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
|
|
6421
|
-
};
|
|
6422
|
-
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
|
|
6423
|
-
var TEXT3 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
6424
|
-
function skillsFromPage(stream) {
|
|
6425
|
-
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
|
|
6426
|
-
return drift9("the skills page could not be read");
|
|
6427
|
-
}
|
|
6428
|
-
const skills = [];
|
|
6429
|
-
let from = 0;
|
|
6430
|
-
let i = 0;
|
|
6431
|
-
for (; ; ) {
|
|
6432
|
-
i = stream.indexOf(EDIT_NAV2, i);
|
|
6433
|
-
if (i === -1) break;
|
|
6434
|
-
const text6 = balanced(stream, i);
|
|
6435
|
-
const end = i;
|
|
6436
|
-
i += EDIT_NAV2.length;
|
|
6437
|
-
if (text6 === null) continue;
|
|
6438
|
-
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
6439
|
-
const id = payload?.skillId;
|
|
6440
|
-
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
6441
|
-
continue;
|
|
6442
|
-
const names = [...stream.slice(from, end).matchAll(TEXT3)].map(
|
|
6443
|
-
(m) => JSON.parse(`"${m[1]}"`)
|
|
6444
|
-
);
|
|
6445
|
-
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
6446
|
-
from = end + text6.length;
|
|
6447
|
-
}
|
|
6448
|
-
return { ok: true, skills };
|
|
6449
|
-
}
|
|
6450
|
-
function pagerFrom(payload, start) {
|
|
6451
|
-
const args = {
|
|
6452
|
-
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
6453
|
-
requestedStateKeys: [],
|
|
6454
|
-
payload: { ...payload, start },
|
|
6455
|
-
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
6456
|
-
};
|
|
6457
|
-
return {
|
|
6458
|
-
pagerId: SKILL.pager,
|
|
6459
|
-
clientArguments: { ...args, states: [], screenId: SKILL.listScreen, knownTemplateIds: [] },
|
|
6460
|
-
paginationRequest: {
|
|
6461
|
-
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
6462
|
-
pagerId: SKILL.pager,
|
|
6463
|
-
retryCount: 0,
|
|
6464
|
-
requestedArguments: args
|
|
6465
|
-
}
|
|
6466
|
-
};
|
|
6467
|
-
}
|
|
6468
|
-
function readSkillForm(stream) {
|
|
6469
|
-
const model = readModel(stream);
|
|
6470
|
-
if (model === null) return drift9("the skill form carried no initial values");
|
|
6471
|
-
const save = findRequest(stream, SKILL.save);
|
|
6472
|
-
const del = findRequest(stream, SKILL.delete);
|
|
6473
|
-
if (save === null && del === null)
|
|
6474
|
-
return drift9("the skill form carried neither a save nor a delete");
|
|
6475
|
-
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
6476
|
-
}
|
|
6477
|
-
var PAGER_URL2 = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${SKILL.pager}`;
|
|
6478
|
-
var MAX_PAGES2 = 10;
|
|
6479
|
-
async function fetchSkills(vanityName, client) {
|
|
6480
|
-
const screen = await openForm(
|
|
6481
|
-
SKILL.listScreen,
|
|
6482
|
-
{ vanityName, isVanityNameResolved: true },
|
|
6483
|
-
client,
|
|
6484
|
-
"skills-screen"
|
|
6485
|
-
);
|
|
6486
|
-
if (typeof screen !== "string") return screen;
|
|
6487
|
-
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
6488
|
-
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
6489
|
-
const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
6490
|
-
if (text6 === null) return drift9("the Skills screen carried no list request");
|
|
6491
|
-
const payload = JSON.parse(text6);
|
|
6492
|
-
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
6493
|
-
const skills = [];
|
|
6494
|
-
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
6495
|
-
const result = await client.request({
|
|
6496
|
-
url: PAGER_URL2,
|
|
6497
|
-
method: "POST",
|
|
6498
|
-
body: pagerFrom(payload, skills.length),
|
|
6499
|
-
spendClass: "page",
|
|
6500
|
-
operation: "skills"
|
|
6501
|
-
});
|
|
6502
|
-
if (!result.ok) return { ok: false, code: result.code, message: result.message };
|
|
6503
|
-
const parsed = skillsFromPage(result.classification.raw ?? "");
|
|
6504
|
-
if (!parsed.ok) return parsed;
|
|
6505
|
-
const fresh = parsed.skills.filter((s) => !skills.some((k) => k.skillId === s.skillId));
|
|
6506
|
-
skills.push(...fresh);
|
|
6507
|
-
if (parsed.skills.length < count3 || fresh.length === 0) break;
|
|
6508
|
-
}
|
|
6509
|
-
return { ok: true, skills };
|
|
6510
|
-
}
|
|
6511
|
-
async function openSkillForm(payload, client, edit) {
|
|
6512
|
-
const stream = await openForm(
|
|
6513
|
-
edit ? SKILL.editScreen : SKILL.addScreen,
|
|
6514
|
-
{ ...payload, isVanityNameResolved: true },
|
|
6515
|
-
client,
|
|
6516
|
-
edit ? "skill-edit-form" : "skill-add-form"
|
|
6517
|
-
);
|
|
6518
|
-
return typeof stream === "string" ? readSkillForm(stream) : stream;
|
|
6519
|
-
}
|
|
6520
|
-
async function sendSkill(body, requestId, client) {
|
|
6521
|
-
const sent = await sendAction(
|
|
6522
|
-
requestId,
|
|
6523
|
-
body,
|
|
6524
|
-
client,
|
|
6525
|
-
requestId === SKILL.save ? "skill-add" : "skill-remove"
|
|
6526
|
-
);
|
|
6527
|
-
return typeof sent === "string" ? { ok: true } : sent;
|
|
6528
|
-
}
|
|
6529
|
-
|
|
6530
7121
|
// src/commands/skill.ts
|
|
6531
7122
|
function liveSkills(session, quiet = false) {
|
|
6532
7123
|
const client = createLiveClient(session, void 0, quiet);
|
|
@@ -6562,13 +7153,14 @@ async function runSkills(quiet = false) {
|
|
|
6562
7153
|
var SERVER_REQUEST = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
6563
7154
|
var VIEWERS_URL = `${SERVER_REQUEST}?sduiid=WvmpEntityList`;
|
|
6564
7155
|
var VIEW_TOTALS_URL = `${SERVER_REQUEST}?sduiid=WvmpAnalytics`;
|
|
7156
|
+
var VIEWERS_REFERER = "https://www.linkedin.com/analytics/profile-views/";
|
|
6565
7157
|
var RANGE = "WvmpSearchFilterType_DATE_RANGE";
|
|
6566
7158
|
var META = { $type: "proto.sdui.common.RequestMetadata" };
|
|
6567
|
-
function serverRequest(requestId, stateKey, payload) {
|
|
7159
|
+
function serverRequest(requestId, stateKey, payload, days) {
|
|
6568
7160
|
const state = {
|
|
6569
7161
|
key: stateKey,
|
|
6570
7162
|
namespace: "MemoryNamespace",
|
|
6571
|
-
value: [],
|
|
7163
|
+
value: days === void 0 ? [] : [`WvmpSearchFilterTimeRange_LAST_${days}_DAYS`],
|
|
6572
7164
|
originalProtoCase: "stringListValue",
|
|
6573
7165
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: stateKey } }
|
|
6574
7166
|
};
|
|
@@ -6600,40 +7192,48 @@ function serverRequest(requestId, stateKey, payload) {
|
|
|
6600
7192
|
}
|
|
6601
7193
|
};
|
|
6602
7194
|
}
|
|
6603
|
-
function viewersBody() {
|
|
6604
|
-
return serverRequest(
|
|
6605
|
-
|
|
6606
|
-
|
|
7195
|
+
function viewersBody(days) {
|
|
7196
|
+
return serverRequest(
|
|
7197
|
+
"WvmpEntityList",
|
|
7198
|
+
`entityListQueryFilterPrefix${RANGE}`,
|
|
7199
|
+
{ sortType: "ProfileViewSortType_TIME_DESCENDING" },
|
|
7200
|
+
days
|
|
7201
|
+
);
|
|
6607
7202
|
}
|
|
6608
|
-
function viewTotalsBody() {
|
|
6609
|
-
return serverRequest(
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
7203
|
+
function viewTotalsBody(days) {
|
|
7204
|
+
return serverRequest(
|
|
7205
|
+
"WvmpAnalytics",
|
|
7206
|
+
`analyticsFieldsFilterPrefix${RANGE}`,
|
|
7207
|
+
{
|
|
7208
|
+
highlightCardDimensions: [
|
|
7209
|
+
"DimensionType_LOCATION",
|
|
7210
|
+
"DimensionType_INDUSTRY",
|
|
7211
|
+
"DimensionType_ORGANIZATION"
|
|
7212
|
+
],
|
|
7213
|
+
detailsCardDimensions: ["DimensionType_ORGANIZATION"],
|
|
7214
|
+
highlightCardResultCount: 4,
|
|
7215
|
+
detailsCardResultCount: 23
|
|
7216
|
+
},
|
|
7217
|
+
days
|
|
7218
|
+
);
|
|
6619
7219
|
}
|
|
6620
|
-
var
|
|
6621
|
-
var
|
|
6622
|
-
var
|
|
7220
|
+
var drift13 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7221
|
+
var unquote4 = (s) => JSON.parse(`"${s}"`);
|
|
7222
|
+
var STR2 = '((?:[^"\\\\]|\\\\.)+)';
|
|
6623
7223
|
var ITEM = /"viewName":"viewer-list-item"(?:,"impressionThresholds":\[[^\]]*\])?[^{}]*"semanticPosition"/;
|
|
6624
|
-
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"
|
|
6625
|
-
var OWN_TEXT = new RegExp(`^\\["${
|
|
6626
|
-
var NESTED_TEXT = new RegExp(`\\[null,"${
|
|
6627
|
-
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${
|
|
7224
|
+
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"(?:,"\w+":"[^"]*")*?,"children":/g;
|
|
7225
|
+
var OWN_TEXT = new RegExp(`^\\["${STR2}"\\]`);
|
|
7226
|
+
var NESTED_TEXT = new RegExp(`\\[null,"${STR2}"`);
|
|
7227
|
+
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${STR2}"`);
|
|
6628
7228
|
var PROFILE_ID2 = /ACoA[A-Za-z0-9_-]{10,}/;
|
|
6629
|
-
var PLAIN_TEXT = new RegExp(`"children":\\["${
|
|
7229
|
+
var PLAIN_TEXT = new RegExp(`"children":\\["${STR2}"\\]`, "g");
|
|
6630
7230
|
function textsOf(row) {
|
|
6631
7231
|
return [...row.matchAll(TEXT_PROPS)].flatMap((m) => {
|
|
6632
7232
|
const after = row.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 600);
|
|
6633
7233
|
const raw = after.match(OWN_TEXT)?.[1] ?? after.match(NESTED_TEXT)?.[1];
|
|
6634
7234
|
if (raw === void 0) return [];
|
|
6635
|
-
const
|
|
6636
|
-
return
|
|
7235
|
+
const text7 = unquote4(raw).trim();
|
|
7236
|
+
return text7 === "" ? [] : [{ size: m[1], weight: m[2], text: text7 }];
|
|
6637
7237
|
});
|
|
6638
7238
|
}
|
|
6639
7239
|
function viewerOf(row, id) {
|
|
@@ -6646,7 +7246,7 @@ function viewerOf(row, id) {
|
|
|
6646
7246
|
const lines = rest.filter((t) => t !== degreeText);
|
|
6647
7247
|
const viewed = lines.at(-1);
|
|
6648
7248
|
const link = row.match(LINK2)?.[1];
|
|
6649
|
-
const url = link === void 0 ? void 0 :
|
|
7249
|
+
const url = link === void 0 ? void 0 : unquote4(link);
|
|
6650
7250
|
if (url === void 0 || !/linkedin\.com\/in\//.test(url)) {
|
|
6651
7251
|
const v = { anonymous: true, description: first };
|
|
6652
7252
|
if (viewed !== void 0) v.viewed = viewed;
|
|
@@ -6664,7 +7264,7 @@ function viewerOf(row, id) {
|
|
|
6664
7264
|
...viewed !== void 0 ? { viewed } : {}
|
|
6665
7265
|
};
|
|
6666
7266
|
}
|
|
6667
|
-
var
|
|
7267
|
+
var REF2 = /"\$[LQ]?([0-9a-f]+)"/g;
|
|
6668
7268
|
function idUnder(rows, ref, items) {
|
|
6669
7269
|
const seen = /* @__PURE__ */ new Set([ref]);
|
|
6670
7270
|
const queue = [ref];
|
|
@@ -6672,7 +7272,7 @@ function idUnder(rows, ref, items) {
|
|
|
6672
7272
|
const row = rows.byId.get(queue.shift()) ?? "";
|
|
6673
7273
|
const id = row.match(PROFILE_ID2)?.[0];
|
|
6674
7274
|
if (id !== void 0) return id;
|
|
6675
|
-
for (const m of row.matchAll(
|
|
7275
|
+
for (const m of row.matchAll(REF2)) {
|
|
6676
7276
|
const next = m[1];
|
|
6677
7277
|
if (!seen.has(next) && !items.has(next) && rows.byId.has(next)) {
|
|
6678
7278
|
seen.add(next);
|
|
@@ -6686,32 +7286,37 @@ function idsByViewer(rows, items) {
|
|
|
6686
7286
|
const ids = /* @__PURE__ */ new Map();
|
|
6687
7287
|
for (const row of rows.byId.values()) {
|
|
6688
7288
|
let current;
|
|
6689
|
-
|
|
7289
|
+
let from = 0;
|
|
7290
|
+
const settle = (id) => {
|
|
7291
|
+
if (current !== void 0 && id !== void 0 && !ids.has(current)) ids.set(current, id);
|
|
7292
|
+
};
|
|
7293
|
+
for (const m of row.matchAll(REF2)) {
|
|
6690
7294
|
const ref = m[1];
|
|
7295
|
+
const at = m.index ?? 0;
|
|
7296
|
+
settle(row.slice(from, at).match(PROFILE_ID2)?.[0]);
|
|
7297
|
+
from = at + m[0].length;
|
|
6691
7298
|
if (items.has(ref)) current = ref;
|
|
6692
|
-
else if (current !== void 0 && !ids.has(current))
|
|
6693
|
-
const id = idUnder(rows, ref, items);
|
|
6694
|
-
if (id !== void 0) ids.set(current, id);
|
|
6695
|
-
}
|
|
7299
|
+
else if (current !== void 0 && !ids.has(current)) settle(idUnder(rows, ref, items));
|
|
6696
7300
|
}
|
|
7301
|
+
settle(row.slice(from).match(PROFILE_ID2)?.[0]);
|
|
6697
7302
|
}
|
|
6698
7303
|
return ids;
|
|
6699
7304
|
}
|
|
6700
7305
|
function parseViewers(stream) {
|
|
6701
7306
|
if (!stream.includes('"viewName":"viewer-list"'))
|
|
6702
|
-
return
|
|
7307
|
+
return drift13("the profile viewers answer was not the viewer list");
|
|
6703
7308
|
const rows = new Rows(stream);
|
|
6704
7309
|
const items = new Set([...rows.byId].filter(([, row]) => ITEM.test(row)).map(([id]) => id));
|
|
6705
7310
|
const ids = idsByViewer(rows, items);
|
|
6706
7311
|
const viewers = [...items].flatMap((id) => viewerOf(rows.byId.get(id) ?? "", ids.get(id)) ?? []);
|
|
6707
7312
|
const shown = Math.max(items.size, (stream.match(new RegExp(ITEM, "g")) ?? []).length);
|
|
6708
7313
|
if (shown > 0 && viewers.length === 0)
|
|
6709
|
-
return
|
|
7314
|
+
return drift13(`${shown} profile viewers were shown but none could be read`);
|
|
6710
7315
|
let privateViewers;
|
|
6711
7316
|
for (const [id, row] of rows.byId) {
|
|
6712
7317
|
if (items.has(id) || privateViewers !== void 0) continue;
|
|
6713
7318
|
for (const m of row.matchAll(PLAIN_TEXT)) {
|
|
6714
|
-
const n =
|
|
7319
|
+
const n = unquote4(m[1]).match(/^(\d[\d.,\s]*)\s+\D/)?.[1];
|
|
6715
7320
|
if (n !== void 0) {
|
|
6716
7321
|
privateViewers = Number(n.replace(/\D/g, ""));
|
|
6717
7322
|
break;
|
|
@@ -6720,40 +7325,78 @@ function parseViewers(stream) {
|
|
|
6720
7325
|
}
|
|
6721
7326
|
return privateViewers === void 0 ? { ok: true, viewers } : { ok: true, viewers, privateViewers };
|
|
6722
7327
|
}
|
|
7328
|
+
var textsIn = (s) => [...s.matchAll(PLAIN_TEXT)].map((m) => unquote4(m[1]).trim());
|
|
7329
|
+
function highlightsOf(stream) {
|
|
7330
|
+
const from = stream.indexOf('"viewName":"highlights"');
|
|
7331
|
+
if (from === -1) return [];
|
|
7332
|
+
const to = stream.indexOf('"viewName":"details"', from);
|
|
7333
|
+
const texts3 = textsIn(stream.slice(from, to === -1 ? void 0 : to)).slice(1);
|
|
7334
|
+
const out = [];
|
|
7335
|
+
for (let i = 0; i + 1 < texts3.length; i += 2)
|
|
7336
|
+
out.push({ value: texts3[i], label: texts3[i + 1] });
|
|
7337
|
+
return out;
|
|
7338
|
+
}
|
|
7339
|
+
function companiesOf(texts3) {
|
|
7340
|
+
const seen = /* @__PURE__ */ new Map();
|
|
7341
|
+
texts3.forEach((t, i) => {
|
|
7342
|
+
const share3 = t.match(/^\((\d+)\s*%\)$/)?.[1];
|
|
7343
|
+
const name = texts3[i - 1];
|
|
7344
|
+
if (share3 !== void 0 && name !== void 0 && !seen.has(name)) seen.set(name, Number(share3));
|
|
7345
|
+
});
|
|
7346
|
+
return [...seen].map(([name, share3]) => ({ name, share: share3 }));
|
|
7347
|
+
}
|
|
6723
7348
|
function parseViewTotals(stream) {
|
|
6724
|
-
const texts3 =
|
|
7349
|
+
const texts3 = textsIn(stream);
|
|
6725
7350
|
const at = texts3.findIndex((t) => /^\d[\d.,\s]*$/.test(t));
|
|
6726
|
-
if (at === -1) return
|
|
7351
|
+
if (at === -1) return drift13("the profile view totals carried no number");
|
|
6727
7352
|
const total = Number(texts3[at].replace(/\D/g, ""));
|
|
6728
|
-
const
|
|
6729
|
-
|
|
7353
|
+
const label = texts3[at + 1];
|
|
7354
|
+
const highlights = highlightsOf(stream);
|
|
7355
|
+
const companies2 = companiesOf(texts3);
|
|
7356
|
+
return {
|
|
7357
|
+
ok: true,
|
|
7358
|
+
total,
|
|
7359
|
+
...label !== void 0 && /\d/.test(label) ? { period: label } : {},
|
|
7360
|
+
...highlights.length > 0 ? { highlights } : {},
|
|
7361
|
+
...companies2.length > 0 ? { companies: companies2 } : {}
|
|
7362
|
+
};
|
|
6730
7363
|
}
|
|
6731
7364
|
|
|
6732
7365
|
// src/commands/viewers.ts
|
|
6733
|
-
function
|
|
7366
|
+
function liveFetch10(quiet) {
|
|
6734
7367
|
const session = loadSession();
|
|
6735
7368
|
if (session.state !== "ok")
|
|
6736
7369
|
return err("viewers", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
6737
7370
|
const client = createLiveClient(session.session, void 0, quiet);
|
|
6738
7371
|
return async (url, body, spendClass) => {
|
|
6739
|
-
const r = await client.request({
|
|
7372
|
+
const r = await client.request({
|
|
7373
|
+
url,
|
|
7374
|
+
method: "POST",
|
|
7375
|
+
body,
|
|
7376
|
+
headers: { referer: VIEWERS_REFERER },
|
|
7377
|
+
spendClass,
|
|
7378
|
+
operation: "viewers"
|
|
7379
|
+
});
|
|
6740
7380
|
if (!r.ok) return r;
|
|
6741
7381
|
return { ok: true, raw: r.classification.raw ?? "" };
|
|
6742
7382
|
};
|
|
6743
7383
|
}
|
|
6744
7384
|
var compactViewer = (v) => "anonymous" in v ? line(["anonymous", v.description, v.viewed]) : line([v.name, v.degree, v.headline, v.viewed, v.url]);
|
|
6745
7385
|
async function runViewers(opts = {}, fetch2) {
|
|
6746
|
-
const get = fetch2 ??
|
|
7386
|
+
const get = fetch2 ?? liveFetch10(opts.quiet === true);
|
|
6747
7387
|
if (typeof get !== "function") return get;
|
|
6748
|
-
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(), "page");
|
|
7388
|
+
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(opts.days), "page");
|
|
6749
7389
|
const totals = totalsRes.ok ? parseViewTotals(totalsRes.raw) : totalsRes;
|
|
6750
|
-
const listRes = await get(VIEWERS_URL, viewersBody(), "page");
|
|
7390
|
+
const listRes = await get(VIEWERS_URL, viewersBody(opts.days), "page");
|
|
6751
7391
|
const list = listRes.ok ? parseViewers(listRes.raw) : listRes;
|
|
6752
7392
|
if (!list.ok) return err("viewers", list.code, list.message, list.hint);
|
|
6753
7393
|
const shown = list.viewers.length;
|
|
6754
|
-
const
|
|
7394
|
+
const accounted = totals.ok && (totals.total <= shown || shown + (list.privateViewers ?? 0) === totals.total);
|
|
7395
|
+
const state = !totals.ok ? "unknown" : accounted ? "complete" : "partial";
|
|
7396
|
+
const { ok: _ok, ...summary } = totals.ok ? totals : { ok: false };
|
|
6755
7397
|
return ok("viewers", {
|
|
6756
|
-
...
|
|
7398
|
+
...opts.days !== void 0 ? { days: opts.days } : {},
|
|
7399
|
+
...totals.ok ? summary : { totalError: `${totals.code}: ${totals.message}` },
|
|
6757
7400
|
...list.privateViewers !== void 0 ? { privateViewers: list.privateViewers } : {},
|
|
6758
7401
|
items: shape(list.viewers, opts, compactViewer),
|
|
6759
7402
|
meta: { state, operation: "viewers", returnedCount: shown }
|
|
@@ -7012,19 +7655,21 @@ function buildServer() {
|
|
|
7012
7655
|
};
|
|
7013
7656
|
server.tool(
|
|
7014
7657
|
"jobs",
|
|
7015
|
-
`Search LinkedIn jobs with every filter the jobs page has. 1 job-search call per 100 results (150 a day). Rows carry id, title, company, location, workplace, listed (date), easyApply, promoted, salary when shown, url. RANK ON THOSE, then call \`job\` on finalists for the description and apply link; \`details:true\` reads every row in full, 100 per job read (60 a day). Pass several keyword sets as a list to search them all with the same filters in one call: jobs found by several come back once, with \`matched\` naming the sets that found them, most-matched first; \`meta.searches\` reports each set and \`meta.duplicates\` how many repeats were merged. Ids for company/industry/title/place/filter come from \`job_filters\`. \`data.location\` is the place a typed location resolved to: check it. \`meta.claimedCount\` is LinkedIn's total; \`meta.next\` is the start for the next page; LinkedIn serves at most 1000 per search. ${READING_CONTRACT} ${NO_RETRY}`,
|
|
7658
|
+
`Search LinkedIn jobs with every filter the jobs page has. 1 job-search call per 100 results (150 a day). Rows carry id, title, company, location, workplace, listed (date), easyApply, promoted, salary when shown, url. RANK ON THOSE, then call \`job\` on finalists for the description and apply link; \`details:true\` reads every row in full, 100 per job read (60 a day). Pass several keyword sets as a list to search them all with the same filters in one call: jobs found by several come back once, with \`matched\` naming the sets that found them, most-matched first; \`meta.searches\` reports each set and \`meta.duplicates\` how many repeats were merged. Ids for company/industry/title/place/filter come from \`job_filters\`. \`data.location\` is the place a typed location resolved to: check it. \`meta.claimedCount\` is LinkedIn's total; \`meta.next\` is the start for the next page; LinkedIn serves at most 1000 per search. topApplicant: true (Premium) lists instead the jobs where LinkedIn says the user would be a top applicant, 100 per call; it takes no keywords, location or filters. ${READING_CONTRACT} ${NO_RETRY}`,
|
|
7016
7659
|
{
|
|
7017
7660
|
...jobQuery,
|
|
7661
|
+
topApplicant: z.boolean().optional().describe("Premium: LinkedIn's list of jobs where the user would be a top applicant"),
|
|
7018
7662
|
limit: z.number().int().min(1).max(1e3).optional().describe("per keyword set; default 25"),
|
|
7019
7663
|
start: z.number().int().min(0).optional(),
|
|
7020
7664
|
details: z.boolean().optional().describe("read each job: apply link, applicants"),
|
|
7021
7665
|
description: z.boolean().optional().describe("with details, keep full descriptions"),
|
|
7022
7666
|
compact: z.boolean().optional().describe("one line per job")
|
|
7023
7667
|
},
|
|
7024
|
-
async ({ limit, start, details, description, compact: compact2, ...q }) => reply(
|
|
7668
|
+
async ({ limit, start, details, description, compact: compact2, topApplicant, ...q }) => reply(
|
|
7025
7669
|
await runJobs(
|
|
7026
7670
|
{
|
|
7027
7671
|
...jobRequest(q, limit ?? 25),
|
|
7672
|
+
...topApplicant === true ? { collection: "top-applicant" } : {},
|
|
7028
7673
|
...start !== void 0 ? { start } : {},
|
|
7029
7674
|
...details !== void 0 ? { details } : {},
|
|
7030
7675
|
...description !== void 0 ? { description } : {}
|
|
@@ -7035,12 +7680,13 @@ function buildServer() {
|
|
|
7035
7680
|
);
|
|
7036
7681
|
server.tool(
|
|
7037
7682
|
"job",
|
|
7038
|
-
`LinkedIn jobs by id or URL, in full: description, apply {type: external | easy-apply, url}, company, location, workplace, employmentType, applicants, listed/expires, state (LISTED or CLOSED), and whether the user already applied or saved it. One id returns the job; several return {items, meta}, read 100 per job read (60 a day), so pass all finalists in one call. meta.unread lists ids LinkedIn did not return. team: true adds hiringTeam [{name, id, url, headline, degree, role ("Job poster"), verified}] per job \u2014 who posted it and who is hiring \u2014 one page call (60 a day) per job; [] means LinkedIn shows no one, and hiringTeamError says why one could not be read.
|
|
7683
|
+
`LinkedIn jobs by id or URL, in full: description, apply {type: external | easy-apply, url}, company, location, workplace, employmentType, applicants, listed/expires, state (LISTED or CLOSED), and whether the user already applied or saved it. One id returns the job; several return {items, meta}, read 100 per job read (60 a day), so pass all finalists in one call. meta.unread lists ids LinkedIn did not return. team: true adds hiringTeam [{name, id, url, headline, degree, role ("Job poster"), verified}] per job \u2014 who posted it and who is hiring \u2014 one page call (60 a day) per job; [] means LinkedIn shows no one, and hiringTeamError says why one could not be read. insights: true (Premium) adds premium {applicants {total, lastDay, seniority [{level, share, count}], education [{degree, share}]}, company {name, headcount {asOf, now, sixMonthsAgo, yearAgo, twoYearsAgo, growth1y (%)}, function {name, now, \u2026} (the job's function), medianTenure, competitors [{name, industry, url}], hiring, priorities, landscape (LinkedIn's generated text)}}, one more job read per job; premiumError says why they could not be read. ` + NO_RETRY,
|
|
7039
7684
|
{
|
|
7040
7685
|
job: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).describe("job id, /jobs/view/ URL or ?currentJobId= URL, or a list of them"),
|
|
7041
|
-
team: z.boolean().optional().describe("also read each job's hiring team")
|
|
7686
|
+
team: z.boolean().optional().describe("also read each job's hiring team"),
|
|
7687
|
+
insights: z.boolean().optional().describe("Premium: who applied, and the company's headcount and insights")
|
|
7042
7688
|
},
|
|
7043
|
-
async ({ job, team }) => reply(await runJob(job, {}, void 0, { team: team === true }))
|
|
7689
|
+
async ({ job, team, insights }) => reply(await runJob(job, {}, void 0, { team: team === true, insights: insights === true }))
|
|
7044
7690
|
);
|
|
7045
7691
|
server.tool(
|
|
7046
7692
|
"job_filters",
|
|
@@ -7050,14 +7696,17 @@ function buildServer() {
|
|
|
7050
7696
|
);
|
|
7051
7697
|
server.tool(
|
|
7052
7698
|
"profile",
|
|
7053
|
-
`Read one LinkedIn profile in full: name, headline, about, location, industry, the top card (title, company, school), and every section \u2014 experience [{title, company, companyId, employmentType, location, start, end | current, description}] whole (read on past the first 10 companies), education, skills (top 20; counts.skills has the total), certifications, languages, honors, publications, projects, volunteering, courses, organizations, patents, testScores. Empty sections are left out. 1 profile read (30 a day), +1 per 50 more companies. contact: true adds contact {email, websites [{url, type}], phones, birthday, connectedSince, \u2026} as the profile shows it to you, for 1 more profile read; it failing leaves contactError. MEDIUM cost \u2014 use only on finalists surfaced by \`people\` or \`search\`. compact: true makes each role, school and entry one line and drops descriptions; fields keeps only those named. ${NO_RETRY}`,
|
|
7699
|
+
`Read one LinkedIn profile in full: name, headline, about, location, industry, the top card (title, company, school), and every section \u2014 experience [{title, company, companyId, employmentType, location, start, end | current, description}] whole (read on past the first 10 companies), education, skills (top 20; counts.skills has the total; skills: true reads them all), certifications, languages, honors, publications, projects, volunteering, courses, organizations, patents, testScores. Empty sections are left out. 1 profile read (30 a day), +1 per 50 more companies. contact: true adds contact {email, websites [{url, type}], phones, birthday, connectedSince, \u2026} as the profile shows it to you, for 1 more profile read; it failing leaves contactError. posts: N adds posts, their N newest (the posts search, from them; postsError if it fails). recommendations: true adds recommendations {received, given}: [{name, url, headline, degree, context (when and how they worked together, in the user's language), text}]. MEDIUM cost \u2014 use only on finalists surfaced by \`people\` or \`search\`. compact: true makes each role, school and entry one line and drops descriptions; fields keeps only those named. ${NO_RETRY}`,
|
|
7054
7700
|
{
|
|
7055
7701
|
id: z.string().min(1).describe("public id, urn, or profile URL"),
|
|
7056
7702
|
compact: z.boolean().optional().describe("one line per role, school and entry"),
|
|
7057
7703
|
fields: z.string().optional().describe("comma-separated top-level fields to keep"),
|
|
7058
|
-
contact: z.boolean().optional().describe("also read the contact info (1 more profile read)")
|
|
7704
|
+
contact: z.boolean().optional().describe("also read the contact info (1 more profile read)"),
|
|
7705
|
+
posts: z.number().int().min(1).max(50).optional().describe("also read their N newest posts (1 search call per 20)"),
|
|
7706
|
+
skills: z.boolean().optional().describe("read every skill, not just the top 20 (1 page call per 10)"),
|
|
7707
|
+
recommendations: z.boolean().optional().describe("also read the recommendations they received and gave (2+ page calls)")
|
|
7059
7708
|
},
|
|
7060
|
-
async ({ id, compact: compact2, fields, contact }) => reply(
|
|
7709
|
+
async ({ id, compact: compact2, fields, contact, posts, skills, recommendations }) => reply(
|
|
7061
7710
|
await runProfile(
|
|
7062
7711
|
id,
|
|
7063
7712
|
{
|
|
@@ -7065,7 +7714,12 @@ function buildServer() {
|
|
|
7065
7714
|
...fields !== void 0 ? { fields } : {}
|
|
7066
7715
|
},
|
|
7067
7716
|
void 0,
|
|
7068
|
-
{
|
|
7717
|
+
{
|
|
7718
|
+
contact: contact === true,
|
|
7719
|
+
skills: skills === true,
|
|
7720
|
+
recommendations: recommendations === true,
|
|
7721
|
+
...posts !== void 0 ? { posts } : {}
|
|
7722
|
+
}
|
|
7069
7723
|
)
|
|
7070
7724
|
)
|
|
7071
7725
|
);
|
|
@@ -7133,11 +7787,34 @@ function buildServer() {
|
|
|
7133
7787
|
)
|
|
7134
7788
|
)
|
|
7135
7789
|
);
|
|
7790
|
+
server.tool(
|
|
7791
|
+
"notifications",
|
|
7792
|
+
"The user's LinkedIn notifications, newest first: unseen (the bell's count), and items {kind (LinkedIn's name, e.g. FOLLOW_PAGE_HERO), text, detail, at (ISO), read, url, from (who or what it is about)}. Reading here does not mark them seen. 1 page call per 25. " + NO_RETRY,
|
|
7793
|
+
{
|
|
7794
|
+
unread: z.boolean().optional().describe("only the unread ones"),
|
|
7795
|
+
limit: z.number().int().min(1).max(200).optional().describe("default 25"),
|
|
7796
|
+
compact: z.boolean().optional().describe("one line each")
|
|
7797
|
+
},
|
|
7798
|
+
async ({ unread, limit, compact: compact2 }) => reply(
|
|
7799
|
+
await runNotifications(
|
|
7800
|
+
{ limit: limit ?? 25, ...unread === true ? { unread: true } : {} },
|
|
7801
|
+
compact2 === true ? { compact: true } : {}
|
|
7802
|
+
)
|
|
7803
|
+
)
|
|
7804
|
+
);
|
|
7136
7805
|
server.tool(
|
|
7137
7806
|
"viewers",
|
|
7138
|
-
|
|
7139
|
-
{
|
|
7140
|
-
|
|
7807
|
+
`Who viewed the user's profile, as their profile-views page shows it: total, privateViewers (a count only), and items \u2014 named viewers {name, id, url, degree, headline, viewed} and anonymous ones {anonymous, description, viewed, searchUrl}. Premium names every viewer, takes days (7, 14, 28, 90 or 365; default the page's 90) and adds highlights [{label, value}] (top location, industry, company) and companies [{name, share}]. A free account is shown up to 3. meta.state is complete only when the named and private add up to total. Degree, labels and times are in the user's language. 2 page calls. ${NO_RETRY}`,
|
|
7808
|
+
{
|
|
7809
|
+
days: z.union([z.literal(7), z.literal(14), z.literal(28), z.literal(90), z.literal(365)]).optional().describe("the range in days (Premium)"),
|
|
7810
|
+
compact: z.boolean().optional().describe("one line a viewer")
|
|
7811
|
+
},
|
|
7812
|
+
async ({ days, compact: compact2 }) => reply(
|
|
7813
|
+
await runViewers({
|
|
7814
|
+
...compact2 === true ? { compact: true } : {},
|
|
7815
|
+
...days !== void 0 ? { days } : {}
|
|
7816
|
+
})
|
|
7817
|
+
)
|
|
7141
7818
|
);
|
|
7142
7819
|
server.tool(
|
|
7143
7820
|
"events",
|
|
@@ -7229,7 +7906,7 @@ function buildServer() {
|
|
|
7229
7906
|
text: z.string().optional().describe("the reply"),
|
|
7230
7907
|
remove: z.string().optional().describe("a draft id to delete")
|
|
7231
7908
|
},
|
|
7232
|
-
async ({ conversation, text:
|
|
7909
|
+
async ({ conversation, text: text7, remove }) => reply(remove !== void 0 ? runDraftRemove(remove) : await runDraft(conversation, text7))
|
|
7233
7910
|
);
|
|
7234
7911
|
server.tool(
|
|
7235
7912
|
"drafts",
|