linkedin-relay-mcp 3.24.0 → 3.25.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 +27 -4
- package/README.md +2 -1
- package/dist/cli.js +937 -573
- package/dist/cli.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +628 -249
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1026,6 +1026,17 @@ var CONTRACTS = {
|
|
|
1026
1026
|
provenance: "verified",
|
|
1027
1027
|
capturedAt: "2026-10-16"
|
|
1028
1028
|
},
|
|
1029
|
+
// The owner's notifications, probed 2026-10-29: the cards the bell opens,
|
|
1030
|
+
// newest first. The page itself also marks them seen; reading them here
|
|
1031
|
+
// does not. See engine/notifications.ts.
|
|
1032
|
+
notifications: {
|
|
1033
|
+
name: "notifications",
|
|
1034
|
+
transport: "voyager-restli",
|
|
1035
|
+
path: `${VOYAGER}/voyagerIdentityDashNotificationCards`,
|
|
1036
|
+
decorationId: "com.linkedin.voyager.dash.deco.identity.notifications.CardsCollectionWithInjectionsNoPills-25",
|
|
1037
|
+
provenance: "verified",
|
|
1038
|
+
capturedAt: "2026-10-29"
|
|
1039
|
+
},
|
|
1029
1040
|
// A company page, captured 2026-10-14. The GraphQL company query by
|
|
1030
1041
|
// universalName answers only the company's urn, so this is the REST
|
|
1031
1042
|
// resource: by id (`/<id>`) or by name (`q=universalName`). It carries the
|
|
@@ -2399,22 +2410,56 @@ function postsPagerBody(q2) {
|
|
|
2399
2410
|
}
|
|
2400
2411
|
};
|
|
2401
2412
|
}
|
|
2413
|
+
function unitsFor(stream, from, bytes) {
|
|
2414
|
+
let i = from;
|
|
2415
|
+
let left = bytes;
|
|
2416
|
+
while (left > 0 && i < stream.length) {
|
|
2417
|
+
const c = stream.codePointAt(i);
|
|
2418
|
+
left -= c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4;
|
|
2419
|
+
i += c > 65535 ? 2 : 1;
|
|
2420
|
+
}
|
|
2421
|
+
return i - from;
|
|
2422
|
+
}
|
|
2402
2423
|
var Rows = class {
|
|
2403
2424
|
constructor(stream) {
|
|
2404
2425
|
this.stream = stream;
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2426
|
+
const head = /([0-9a-f]+):(?:T([0-9a-f]+),)?/y;
|
|
2427
|
+
let pos = 0;
|
|
2428
|
+
while (pos < stream.length) {
|
|
2429
|
+
if (stream[pos] === "\n") {
|
|
2430
|
+
pos++;
|
|
2431
|
+
continue;
|
|
2432
|
+
}
|
|
2433
|
+
head.lastIndex = pos;
|
|
2434
|
+
const m = head.exec(stream);
|
|
2435
|
+
if (m === null) {
|
|
2436
|
+
const nl = stream.indexOf("\n", pos);
|
|
2437
|
+
pos = nl === -1 ? stream.length : nl + 1;
|
|
2438
|
+
continue;
|
|
2439
|
+
}
|
|
2440
|
+
const id = m[1];
|
|
2441
|
+
const body = pos + m[0].length;
|
|
2442
|
+
this.starts.push({ id, at: pos });
|
|
2443
|
+
let end;
|
|
2444
|
+
if (m[2] !== void 0) {
|
|
2445
|
+
end = body + unitsFor(stream, body, Number.parseInt(m[2], 16));
|
|
2446
|
+
this.texts.add(id);
|
|
2447
|
+
} else {
|
|
2448
|
+
const nl = stream.indexOf("\n", body);
|
|
2449
|
+
end = nl === -1 ? stream.length : nl;
|
|
2450
|
+
}
|
|
2451
|
+
this.byId.set(id, stream.slice(body, end));
|
|
2452
|
+
pos = end;
|
|
2413
2453
|
}
|
|
2414
2454
|
}
|
|
2415
2455
|
stream;
|
|
2416
2456
|
byId = /* @__PURE__ */ new Map();
|
|
2417
2457
|
starts = [];
|
|
2458
|
+
texts = /* @__PURE__ */ new Set();
|
|
2459
|
+
/** Whether a row is raw text (a `T` row) rather than JSON. */
|
|
2460
|
+
isText(id) {
|
|
2461
|
+
return this.texts.has(id);
|
|
2462
|
+
}
|
|
2418
2463
|
/** The row a stream position falls in. */
|
|
2419
2464
|
at(pos) {
|
|
2420
2465
|
let lo = 0;
|
|
@@ -2652,25 +2697,25 @@ function splitLocation(line2) {
|
|
|
2652
2697
|
const kind = m?.[2] === void 0 ? void 0 : WORKPLACE_SUFFIX[m[2].toLowerCase()];
|
|
2653
2698
|
return kind === void 0 || m?.[1] === void 0 ? { location: line2 } : { location: m[1], workplace: kind };
|
|
2654
2699
|
}
|
|
2655
|
-
function cardToJob(
|
|
2656
|
-
const urn =
|
|
2700
|
+
function cardToJob(card2) {
|
|
2701
|
+
const urn = card2.jobPostingUrn ?? card2["*jobPosting"];
|
|
2657
2702
|
const id = typeof urn === "string" ? jobIdOf(urn) : void 0;
|
|
2658
|
-
const title = typeof
|
|
2703
|
+
const title = typeof card2.jobPostingTitle === "string" ? card2.jobPostingTitle : text2(card2.title);
|
|
2659
2704
|
if (id === void 0 || title === void 0) return void 0;
|
|
2660
|
-
const footer = Array.isArray(
|
|
2705
|
+
const footer = Array.isArray(card2.footerItems) ? card2.footerItems : [];
|
|
2661
2706
|
const listed2 = footer.find((f) => f.type === "LISTED_DATE");
|
|
2662
2707
|
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);
|
|
2663
|
-
const insight2 = text2(
|
|
2708
|
+
const insight2 = text2(card2.relevanceInsight?.text);
|
|
2664
2709
|
if (insight2 !== void 0) insights.push(insight2);
|
|
2665
2710
|
return defined3({
|
|
2666
2711
|
id,
|
|
2667
2712
|
title,
|
|
2668
|
-
company: text2(
|
|
2669
|
-
...splitLocation(text2(
|
|
2713
|
+
company: text2(card2.primaryDescription),
|
|
2714
|
+
...splitLocation(text2(card2.secondaryDescription)),
|
|
2670
2715
|
listed: day(listed2?.timeAt),
|
|
2671
2716
|
easyApply: footer.some((f) => f.type === "EASY_APPLY_TEXT"),
|
|
2672
2717
|
promoted: footer.some((f) => f.type === "PROMOTED"),
|
|
2673
|
-
salary: text2(
|
|
2718
|
+
salary: text2(card2.tertiaryDescription),
|
|
2674
2719
|
insights: insights.length > 0 ? insights : void 0,
|
|
2675
2720
|
url: viewUrl(id)
|
|
2676
2721
|
});
|
|
@@ -2696,8 +2741,8 @@ function readCards(elements, included) {
|
|
|
2696
2741
|
for (const kind of Object.keys(union)) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
|
|
2697
2742
|
continue;
|
|
2698
2743
|
}
|
|
2699
|
-
const
|
|
2700
|
-
const job =
|
|
2744
|
+
const card2 = byUrn.get(ref);
|
|
2745
|
+
const job = card2 === void 0 ? void 0 : cardToJob(card2);
|
|
2701
2746
|
if (job === void 0) unresolved++;
|
|
2702
2747
|
else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
|
|
2703
2748
|
}
|
|
@@ -2823,11 +2868,11 @@ function hiringTeamBody(jobId) {
|
|
|
2823
2868
|
};
|
|
2824
2869
|
}
|
|
2825
2870
|
var unquote = (s) => JSON.parse(`"${s}"`);
|
|
2826
|
-
function memberOf(
|
|
2827
|
-
const url =
|
|
2828
|
-
const name =
|
|
2871
|
+
function memberOf(card2, id) {
|
|
2872
|
+
const url = card2.match(/"url":"(https:\/\/www\.linkedin\.com\/in\/[^"/]+\/)"/)?.[1];
|
|
2873
|
+
const name = card2.match(/\[null,"((?:[^"\\]|\\.)+)"/)?.[1];
|
|
2829
2874
|
if (url === void 0 || name === void 0) return void 0;
|
|
2830
|
-
const lines = [...
|
|
2875
|
+
const lines = [...card2.matchAll(/"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g)].map(
|
|
2831
2876
|
(m) => unquote(m[1]).trim()
|
|
2832
2877
|
);
|
|
2833
2878
|
const degree = lines.find((l) => l.startsWith("\u2022"));
|
|
@@ -2839,7 +2884,7 @@ function memberOf(card, id) {
|
|
|
2839
2884
|
headline,
|
|
2840
2885
|
degree: degree?.replace(/^•\s*/, ""),
|
|
2841
2886
|
role: role3,
|
|
2842
|
-
verified: /"role":"img","aria-label"/.test(
|
|
2887
|
+
verified: /"role":"img","aria-label"/.test(card2) ? true : void 0
|
|
2843
2888
|
});
|
|
2844
2889
|
}
|
|
2845
2890
|
function parseHiringTeam(stream) {
|
|
@@ -2848,7 +2893,7 @@ function parseHiringTeam(stream) {
|
|
|
2848
2893
|
return drift2("the hiring team answer was not the hiring team component");
|
|
2849
2894
|
const rows = new Rows(stream);
|
|
2850
2895
|
const cards = [...rows.byId].filter(([, row]) => /linkedin\.com\\?\/in\\?\//.test(row));
|
|
2851
|
-
const at = (
|
|
2896
|
+
const at = (card2) => stream.indexOf(`"$L${card2}"`);
|
|
2852
2897
|
const placed = cards.map(([key]) => at(key)).sort((a, b) => a - b);
|
|
2853
2898
|
const members = [];
|
|
2854
2899
|
for (const [key, row] of cards) {
|
|
@@ -4275,8 +4320,8 @@ async function share(confirmed, client, bytes) {
|
|
|
4275
4320
|
}
|
|
4276
4321
|
}
|
|
4277
4322
|
const media = [];
|
|
4278
|
-
const { card } = confirmed.payload;
|
|
4279
|
-
if (
|
|
4323
|
+
const { card: card2 } = confirmed.payload;
|
|
4324
|
+
if (card2 !== void 0) media.push({ category: "ARTICLE", urn: card2.urn });
|
|
4280
4325
|
const { poll } = confirmed.payload;
|
|
4281
4326
|
if (poll !== void 0) {
|
|
4282
4327
|
const created = await createPoll(poll, client);
|
|
@@ -6389,6 +6434,106 @@ async function runNetwork(list2, req, opts = {}, fetch2) {
|
|
|
6389
6434
|
});
|
|
6390
6435
|
}
|
|
6391
6436
|
|
|
6437
|
+
// src/engine/notifications.ts
|
|
6438
|
+
function notificationsUrl(count3, start) {
|
|
6439
|
+
const c = CONTRACTS.notifications;
|
|
6440
|
+
if (c?.decorationId === void 0) throw new Error("the 'notifications' contract is missing");
|
|
6441
|
+
return `${c.path}?decorationId=${c.decorationId}&q=filterVanityName&count=${count3}&start=${start}`;
|
|
6442
|
+
}
|
|
6443
|
+
var drift7 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6444
|
+
var textOf = (v) => {
|
|
6445
|
+
const t = v?.text;
|
|
6446
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
6447
|
+
};
|
|
6448
|
+
var absolute = (v) => typeof v === "string" && v !== "" ? v.startsWith("/") ? `https://www.linkedin.com${v}` : v : void 0;
|
|
6449
|
+
function card(n) {
|
|
6450
|
+
const text6 = textOf(n.headline);
|
|
6451
|
+
if (text6 === void 0) return void 0;
|
|
6452
|
+
const kind = String(n.entityUrn ?? "").match(/fsd_notificationCard:\(([^,]+),/)?.[1] ?? "UNKNOWN";
|
|
6453
|
+
const detail = [n.subHeadline, n.contentPrimaryText, n.contentSecondaryText, n.kickerText].map(textOf).filter((t) => t !== void 0).join(" \xB7 ");
|
|
6454
|
+
const at = typeof n.publishedAt === "number" ? new Date(n.publishedAt).toISOString() : void 0;
|
|
6455
|
+
const url = absolute(n.cardAction?.actionTarget);
|
|
6456
|
+
const from = absolute(n.headerImage?.actionTarget);
|
|
6457
|
+
return {
|
|
6458
|
+
kind,
|
|
6459
|
+
text: text6,
|
|
6460
|
+
...detail !== "" ? { detail } : {},
|
|
6461
|
+
...at !== void 0 ? { at } : {},
|
|
6462
|
+
read: n.read === true,
|
|
6463
|
+
...url !== void 0 ? { url } : {},
|
|
6464
|
+
...from !== void 0 ? { from } : {}
|
|
6465
|
+
};
|
|
6466
|
+
}
|
|
6467
|
+
function parseNotifications(json) {
|
|
6468
|
+
const root = json;
|
|
6469
|
+
const data = root?.data;
|
|
6470
|
+
const listed2 = data?.["*elements"] ?? data?.elements;
|
|
6471
|
+
if (!Array.isArray(listed2)) return drift7("the notifications answer carried no card list");
|
|
6472
|
+
const byUrn = new Map((root?.included ?? []).map((n) => [n.entityUrn, n]));
|
|
6473
|
+
const items = listed2.flatMap((u) => {
|
|
6474
|
+
const n = byUrn.get(u);
|
|
6475
|
+
const c = n === void 0 ? void 0 : card(n);
|
|
6476
|
+
return c === void 0 ? [] : [c];
|
|
6477
|
+
});
|
|
6478
|
+
if (listed2.length > 0 && items.length === 0)
|
|
6479
|
+
return drift7(`${listed2.length} notifications were listed but none could be read`);
|
|
6480
|
+
const meta = data?.metadata ?? {};
|
|
6481
|
+
return {
|
|
6482
|
+
ok: true,
|
|
6483
|
+
items,
|
|
6484
|
+
...typeof meta.numUnseen === "number" ? { unseen: meta.numUnseen } : {},
|
|
6485
|
+
...typeof meta.nextStart === "number" ? { next: meta.nextStart } : {}
|
|
6486
|
+
};
|
|
6487
|
+
}
|
|
6488
|
+
|
|
6489
|
+
// src/commands/notifications.ts
|
|
6490
|
+
function liveFetch8(quiet) {
|
|
6491
|
+
const session = loadSession();
|
|
6492
|
+
if (session.state !== "ok")
|
|
6493
|
+
return err("notifications", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
6494
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
6495
|
+
return async (url, spendClass) => {
|
|
6496
|
+
const r = await client.request({ url, spendClass, operation: "notifications" });
|
|
6497
|
+
return r.ok ? { ok: true, json: r.json } : r;
|
|
6498
|
+
};
|
|
6499
|
+
}
|
|
6500
|
+
var PAGE = 25;
|
|
6501
|
+
var compactNotification = (n) => line([n.read ? void 0 : "unread", n.at, n.kind, n.text, n.detail, n.url]);
|
|
6502
|
+
async function runNotifications(req, opts = {}, fetch2) {
|
|
6503
|
+
const get = fetch2 ?? liveFetch8(opts.quiet === true);
|
|
6504
|
+
if (typeof get !== "function") return get;
|
|
6505
|
+
const limit = Math.max(1, req.limit);
|
|
6506
|
+
const items = [];
|
|
6507
|
+
let unseen;
|
|
6508
|
+
let start = 0;
|
|
6509
|
+
let stoppedBy;
|
|
6510
|
+
while (start !== void 0 && items.length < limit) {
|
|
6511
|
+
const res = await get(notificationsUrl(PAGE, start), "page");
|
|
6512
|
+
const page = res.ok ? parseNotifications(res.json) : res;
|
|
6513
|
+
if (!page.ok) {
|
|
6514
|
+
if (items.length === 0 && start === 0)
|
|
6515
|
+
return err("notifications", page.code, page.message, page.hint);
|
|
6516
|
+
stoppedBy = page.code;
|
|
6517
|
+
break;
|
|
6518
|
+
}
|
|
6519
|
+
unseen ??= page.unseen;
|
|
6520
|
+
items.push(...page.items.filter((n) => req.unread !== true || !n.read));
|
|
6521
|
+
start = page.next !== void 0 && page.next > start ? page.next : void 0;
|
|
6522
|
+
}
|
|
6523
|
+
const kept = items.slice(0, limit);
|
|
6524
|
+
const state2 = stoppedBy !== void 0 || start !== void 0 && kept.length === limit ? "partial" : "complete";
|
|
6525
|
+
return ok("notifications", {
|
|
6526
|
+
...unseen !== void 0 ? { unseen } : {},
|
|
6527
|
+
items: shape(kept, opts, compactNotification),
|
|
6528
|
+
meta: {
|
|
6529
|
+
state: state2,
|
|
6530
|
+
operation: "notifications",
|
|
6531
|
+
returnedCount: kept.length,
|
|
6532
|
+
...stoppedBy !== void 0 ? { stoppedBy } : {}
|
|
6533
|
+
}
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6392
6537
|
// src/commands/oauth.ts
|
|
6393
6538
|
import { spawn } from "child_process";
|
|
6394
6539
|
import { createServer } from "http";
|
|
@@ -6695,7 +6840,7 @@ function contactInfoBody(publicId, firstName, lastName) {
|
|
|
6695
6840
|
isModal: true
|
|
6696
6841
|
};
|
|
6697
6842
|
}
|
|
6698
|
-
var
|
|
6843
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6699
6844
|
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
6700
6845
|
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
6701
6846
|
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
@@ -6766,9 +6911,9 @@ function put(contact, f) {
|
|
|
6766
6911
|
}
|
|
6767
6912
|
function parseContactInfo(stream) {
|
|
6768
6913
|
if (!stream.includes("profile-contact-info-details-view"))
|
|
6769
|
-
return
|
|
6914
|
+
return drift8("the contact info answer was not the contact info overlay");
|
|
6770
6915
|
const fields = fieldsOf(stream);
|
|
6771
|
-
if (fields.length === 0) return
|
|
6916
|
+
if (fields.length === 0) return drift8("the contact info overlay had no fields");
|
|
6772
6917
|
const contact = {};
|
|
6773
6918
|
for (const f of fields) put(contact, f);
|
|
6774
6919
|
return { ok: true, contact };
|
|
@@ -6789,7 +6934,7 @@ function positionsPageUrl(profileUrn, start) {
|
|
|
6789
6934
|
const c = contract3("profilePositions");
|
|
6790
6935
|
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
6791
6936
|
}
|
|
6792
|
-
var
|
|
6937
|
+
var drift9 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6793
6938
|
var str4 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
6794
6939
|
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
6795
6940
|
function defined7(obj) {
|
|
@@ -6902,13 +7047,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
|
6902
7047
|
function parseFullProfile(json) {
|
|
6903
7048
|
const root = json;
|
|
6904
7049
|
const listed2 = root?.data?.["*elements"];
|
|
6905
|
-
if (!Array.isArray(listed2)) return
|
|
7050
|
+
if (!Array.isArray(listed2)) return drift9("the profile answer carried no profile list");
|
|
6906
7051
|
if (listed2.length === 0)
|
|
6907
7052
|
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
6908
7053
|
const ix = new Index(root?.included ?? []);
|
|
6909
7054
|
const p = ix.get(listed2[0]);
|
|
6910
7055
|
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
6911
|
-
if (p === void 0 || urn === void 0) return
|
|
7056
|
+
if (p === void 0 || urn === void 0) return drift9("the profile was listed but not sent");
|
|
6912
7057
|
const counts2 = {};
|
|
6913
7058
|
const count3 = (key, shown, total) => {
|
|
6914
7059
|
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
@@ -6963,11 +7108,11 @@ function parseFullProfile(json) {
|
|
|
6963
7108
|
function parsePositionsPage(json) {
|
|
6964
7109
|
const root = json;
|
|
6965
7110
|
const refs = root?.data?.["*elements"];
|
|
6966
|
-
if (!Array.isArray(refs)) return
|
|
7111
|
+
if (!Array.isArray(refs)) return drift9("the experience page carried no position groups");
|
|
6967
7112
|
const ix = new Index(root?.included ?? []);
|
|
6968
7113
|
const groups = refs.flatMap((r) => ix.list(r));
|
|
6969
7114
|
if (refs.length > 0 && groups.length === 0)
|
|
6970
|
-
return
|
|
7115
|
+
return drift9(`${refs.length} position groups were listed but none sent`);
|
|
6971
7116
|
const total = root?.data?.paging?.total;
|
|
6972
7117
|
return {
|
|
6973
7118
|
ok: true,
|
|
@@ -6977,153 +7122,625 @@ function parsePositionsPage(json) {
|
|
|
6977
7122
|
};
|
|
6978
7123
|
}
|
|
6979
7124
|
|
|
6980
|
-
// src/
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
7125
|
+
// src/engine/recommendations.ts
|
|
7126
|
+
var PAGER = "com.linkedin.sdui.pagers.profile.details.recommendations";
|
|
7127
|
+
var SCREEN3 = "com.linkedin.sdui.flagshipnav.profile.ProfileRecommendationDetails";
|
|
7128
|
+
var RECOMMENDATIONS_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${PAGER}`;
|
|
7129
|
+
var RECOMMENDATIONS_PAGE = 15;
|
|
7130
|
+
function recommendationsBody(kind, vanityName, profileId2, start) {
|
|
7131
|
+
const args = {
|
|
7132
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
7133
|
+
requestedStateKeys: [],
|
|
7134
|
+
payload: {
|
|
7135
|
+
type: kind === "received" ? "Received" : "Given",
|
|
7136
|
+
vanityName,
|
|
7137
|
+
profileId: profileId2,
|
|
7138
|
+
start,
|
|
7139
|
+
detailScreenTabIndex: kind === "received" ? "0" : "1",
|
|
7140
|
+
count: RECOMMENDATIONS_PAGE
|
|
7141
|
+
},
|
|
7142
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
6995
7143
|
};
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
return slug;
|
|
7144
|
+
return {
|
|
7145
|
+
pagerId: PAGER,
|
|
7146
|
+
clientArguments: { ...args, states: [], screenId: SCREEN3, knownTemplateIds: [] },
|
|
7147
|
+
paginationRequest: {
|
|
7148
|
+
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
7149
|
+
pagerId: PAGER,
|
|
7150
|
+
retryCount: 2,
|
|
7151
|
+
requestedArguments: args
|
|
7005
7152
|
}
|
|
7006
|
-
}
|
|
7007
|
-
return s.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/)?.[1] ?? s;
|
|
7153
|
+
};
|
|
7008
7154
|
}
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7155
|
+
var drift10 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7156
|
+
var unquote3 = (s) => JSON.parse(`"${s}"`);
|
|
7157
|
+
var STR = '((?:[^"\\\\]|\\\\.)+)';
|
|
7158
|
+
var loading = (id) => new RegExp(
|
|
7159
|
+
`"id":"${id}"\\}\\},"namespace":"LoadingNamespace"\\},"value":\\{"\\$case":"stringValue","stringValue":"${STR}"`
|
|
7160
|
+
);
|
|
7161
|
+
var NAME = loading("profile_name_loading_state");
|
|
7162
|
+
var HEADLINE = loading("profile_headline_loading_state");
|
|
7163
|
+
var PROFILE_URL = /"url":"(https:\/\/www\.linkedin\.com\/in\/[^"]+)"/;
|
|
7164
|
+
var TEXT3 = /"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g;
|
|
7165
|
+
var FRAGMENT = /\["\$","\$9","\d+",\{"children":\[(?:null|\["\$","br",null,\{\}\]),"((?:[^"\\]|\\.)*)"\]/g;
|
|
7166
|
+
var REF = /"\$L([0-9a-f]+)"/g;
|
|
7167
|
+
var ANY_REF = /"\$L?([0-9a-f]+)"/g;
|
|
7168
|
+
function header(rows, id) {
|
|
7169
|
+
const row = rows.byId.get(id) ?? "";
|
|
7170
|
+
const name = row.match(NAME)?.[1];
|
|
7171
|
+
if (name === void 0) return void 0;
|
|
7172
|
+
const headline = row.match(HEADLINE)?.[1];
|
|
7173
|
+
const all = rows.reach(id).map((r) => rows.byId.get(r) ?? "").join("\n");
|
|
7174
|
+
const texts3 = [...all.matchAll(TEXT3)].map((m) => unquote3(m[1]).trim());
|
|
7175
|
+
const degree = texts3.find((t) => t.startsWith("\xB7"));
|
|
7176
|
+
const shown = /* @__PURE__ */ new Set([unquote3(name), headline === void 0 ? "" : unquote3(headline)]);
|
|
7177
|
+
const context = texts3.filter((t) => t !== degree && !shown.has(t)).pop();
|
|
7178
|
+
const url = row.match(PROFILE_URL)?.[1];
|
|
7179
|
+
return {
|
|
7180
|
+
name: unquote3(name).trim(),
|
|
7181
|
+
...url !== void 0 ? { url } : {},
|
|
7182
|
+
...headline !== void 0 ? { headline: unquote3(headline).trim() } : {},
|
|
7183
|
+
...degree !== void 0 ? { degree: degree.replace(/^·\s*/, "") } : {},
|
|
7184
|
+
...context !== void 0 ? { context } : {}
|
|
7185
|
+
};
|
|
7186
|
+
}
|
|
7187
|
+
function inlined(rows, segment, depth = 0) {
|
|
7188
|
+
if (depth > 3) return segment;
|
|
7189
|
+
return segment.replace(ANY_REF, (ref, id) => {
|
|
7190
|
+
const row = rows.byId.get(id);
|
|
7191
|
+
if (row === void 0) return ref;
|
|
7192
|
+
if (rows.isText(id)) return JSON.stringify(row);
|
|
7193
|
+
return row.startsWith('["$","$9"') ? inlined(rows, row, depth + 1) : ref;
|
|
7194
|
+
});
|
|
7195
|
+
}
|
|
7196
|
+
function bodyOf(segment) {
|
|
7197
|
+
const fragments = [...segment.matchAll(FRAGMENT)].map((m) => unquote3(m[1]));
|
|
7198
|
+
const lines = fragments.length > 0 ? fragments : [...segment.matchAll(TEXT3)].map((m) => unquote3(m[1]));
|
|
7199
|
+
return lines.map((l) => l.replace(/\r/g, "").trimEnd()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
7200
|
+
}
|
|
7201
|
+
function parseRecommendations(stream) {
|
|
7202
|
+
if (!stream.includes("isPartialPage") && !stream.includes(PAGER))
|
|
7203
|
+
return drift10("the recommendations answer was not the recommendations list");
|
|
7204
|
+
const rows = new Rows(stream);
|
|
7205
|
+
const headers2 = [...rows.byId].filter(([, row]) => NAME.test(row) && !row.startsWith('[["$"')).map(([id]) => id);
|
|
7206
|
+
const heads = new Set(headers2);
|
|
7207
|
+
const placed = headers2.flatMap((h) => {
|
|
7208
|
+
for (const [id, row] of rows.byId) {
|
|
7209
|
+
const at = row.indexOf(`"$L${h}"`);
|
|
7210
|
+
if (at !== -1) return [{ h, row: id, at }];
|
|
7019
7211
|
}
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7212
|
+
return [];
|
|
7213
|
+
});
|
|
7214
|
+
const holders = new Set(placed.map((p) => p.row));
|
|
7215
|
+
const items = [];
|
|
7216
|
+
for (const p of placed) {
|
|
7217
|
+
const row = rows.byId.get(p.row) ?? "";
|
|
7218
|
+
let end = row.length;
|
|
7219
|
+
for (const m of row.slice(p.at + 1).matchAll(REF)) {
|
|
7220
|
+
const id = m[1];
|
|
7221
|
+
if (heads.has(id) || holders.has(id) && id !== p.row) {
|
|
7222
|
+
end = p.at + 1 + (m.index ?? 0);
|
|
7223
|
+
break;
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
const who = header(rows, p.h);
|
|
7227
|
+
const text6 = bodyOf(inlined(rows, row.slice(p.at, end)));
|
|
7228
|
+
if (who !== void 0 && text6 !== "") items.push({ ...who, text: text6 });
|
|
7023
7229
|
}
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
7028
|
-
else delete p.counts;
|
|
7230
|
+
if (headers2.length > 0 && items.length === 0)
|
|
7231
|
+
return drift10(`${headers2.length} recommendations were shown but none could be read`);
|
|
7232
|
+
return { ok: true, items };
|
|
7029
7233
|
}
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7234
|
+
|
|
7235
|
+
// src/engine/sdui-profile.ts
|
|
7236
|
+
var NAV_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/navigation";
|
|
7237
|
+
var ACTION_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
7238
|
+
var PROFILE_FIELDS = {
|
|
7239
|
+
headline: {
|
|
7240
|
+
name: "headline",
|
|
7241
|
+
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileEditIntroForm",
|
|
7242
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileIntroForm",
|
|
7243
|
+
binding: "headline",
|
|
7244
|
+
// The web form refuses more ("Exceeded maximum length of 220 characters").
|
|
7245
|
+
maxLength: 220
|
|
7246
|
+
},
|
|
7247
|
+
about: {
|
|
7248
|
+
name: "about",
|
|
7249
|
+
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileAboutForm",
|
|
7250
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileAboutForm",
|
|
7251
|
+
binding: "about",
|
|
7252
|
+
maxLength: 2600
|
|
7034
7253
|
}
|
|
7035
|
-
const body = contactInfoBody(p.publicId, p.firstName, p.lastName ?? "");
|
|
7036
|
-
const res = await get(CONTACT_INFO_URL, "profile", body);
|
|
7037
|
-
const read = res.ok ? parseContactInfo(res.raw ?? "") : res;
|
|
7038
|
-
if (read.ok) p.contact = read.contact;
|
|
7039
|
-
else p.contactError = `${read.code}: ${read.message}`;
|
|
7040
|
-
}
|
|
7041
|
-
var span = (x) => x.start === void 0 && x.end === void 0 ? void 0 : `${x.start ?? "?"} \u2013 ${x.current === true ? "now" : x.end ?? "?"}`;
|
|
7042
|
-
var roleLine = (r) => line([r.title, r.company, span(r), r.employmentType, r.location]);
|
|
7043
|
-
var schoolLine = (s) => line([s.school, s.degree, s.field, span(s)]);
|
|
7044
|
-
var entryLine = (e) => {
|
|
7045
|
-
const { description: _d, url, ...rest } = e;
|
|
7046
|
-
const dates = span(e);
|
|
7047
|
-
const fields = Object.entries(rest).filter(([k, v]) => !["start", "end", "current"].includes(k) && typeof v === "string").map(([, v]) => v);
|
|
7048
|
-
return line([...fields, dates, typeof url === "string" ? url : void 0]);
|
|
7049
7254
|
};
|
|
7050
|
-
var
|
|
7051
|
-
|
|
7052
|
-
"
|
|
7053
|
-
|
|
7054
|
-
"
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
"
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
const out = { ...p };
|
|
7064
|
-
if (p.experience !== void 0) out.experience = p.experience.map(roleLine);
|
|
7065
|
-
if (p.education !== void 0) out.education = p.education.map(schoolLine);
|
|
7066
|
-
for (const key of LISTS2) {
|
|
7067
|
-
const rows = p[key];
|
|
7068
|
-
if (rows !== void 0) out[key] = rows.map(entryLine);
|
|
7069
|
-
}
|
|
7070
|
-
return out;
|
|
7255
|
+
var drift11 = (message) => ({
|
|
7256
|
+
ok: false,
|
|
7257
|
+
code: "SCHEMA_DRIFT",
|
|
7258
|
+
message,
|
|
7259
|
+
hint: "Re-capture the profile form with scripts/observe-write.ts (edit one character, then revert)."
|
|
7260
|
+
});
|
|
7261
|
+
function readForm(stream, field) {
|
|
7262
|
+
const states2 = readModel(stream);
|
|
7263
|
+
if (states2 === null) return drift11("the profile form carried no initial values");
|
|
7264
|
+
const args = findRequest(stream, field.save);
|
|
7265
|
+
if (args === null)
|
|
7266
|
+
return drift11(`the profile form carried no ${field.save.split(".").pop()} action`);
|
|
7267
|
+
return { ok: true, args, states: states2, screen: field.screen, save: field.save };
|
|
7071
7268
|
}
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
"profile",
|
|
7076
|
-
"INVALID_INPUT",
|
|
7077
|
-
"a public id, profile URL or urn is required",
|
|
7078
|
-
"lnrelay profile <public-id|url|urn>"
|
|
7079
|
-
);
|
|
7080
|
-
const get = fetch2 ?? liveFetch8(opts.quiet === true);
|
|
7081
|
-
if (typeof get !== "function") return get;
|
|
7082
|
-
const res = await get(fullProfileUrl(memberIdOf(input)), "profile");
|
|
7083
|
-
if (!res.ok) return err("profile", res.code, res.message, res.hint);
|
|
7084
|
-
const parsed = parseFullProfile(res.json);
|
|
7085
|
-
if (!parsed.ok) return err("profile", parsed.code, parsed.message, parsed.hint);
|
|
7086
|
-
const p = parsed.profile;
|
|
7087
|
-
await readRestOfExperience(get, p);
|
|
7088
|
-
if (req.contact === true) await readContact(get, p);
|
|
7089
|
-
if (opts.raw === true) return ok("profile", { ...p, raw: res.json });
|
|
7090
|
-
if (opts.fields !== void 0 && opts.fields !== "")
|
|
7091
|
-
return ok("profile", project([p], opts.fields)[0]);
|
|
7092
|
-
return ok("profile", opts.compact === true ? compact(p) : p);
|
|
7269
|
+
function boundKey(form, property) {
|
|
7270
|
+
const ref = form.args.payload[property];
|
|
7271
|
+
return ref?.key;
|
|
7093
7272
|
}
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
{
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7273
|
+
function currentValue(form, field) {
|
|
7274
|
+
const key = boundKey(form, field.binding);
|
|
7275
|
+
const v = key === void 0 ? void 0 : form.states.get(key)?.value;
|
|
7276
|
+
return typeof v === "string" ? v : void 0;
|
|
7277
|
+
}
|
|
7278
|
+
function topSkills(form) {
|
|
7279
|
+
return (key) => {
|
|
7280
|
+
if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
|
|
7281
|
+
const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
|
|
7282
|
+
if (initial === void 0) return drift11("the About form carried no initial top skills");
|
|
7283
|
+
if (!Array.isArray(initial.value) || initial.value.length > 0) {
|
|
7284
|
+
return {
|
|
7285
|
+
ok: false,
|
|
7286
|
+
code: "NOT_IMPLEMENTED",
|
|
7287
|
+
message: "your About section has top skills, and saving it with them has not been verified",
|
|
7288
|
+
hint: "Edit About in the browser for now; nothing was changed."
|
|
7289
|
+
};
|
|
7290
|
+
}
|
|
7291
|
+
return { ok: true, value: [] };
|
|
7292
|
+
};
|
|
7293
|
+
}
|
|
7294
|
+
function saveBody(form, field, value) {
|
|
7295
|
+
if (value.length > field.maxLength) {
|
|
7296
|
+
return {
|
|
7297
|
+
ok: false,
|
|
7298
|
+
code: "INVALID_INPUT",
|
|
7299
|
+
message: `the ${field.name} is ${value.length} characters; LinkedIn allows ${field.maxLength}`
|
|
7300
|
+
};
|
|
7301
|
+
}
|
|
7302
|
+
const target2 = boundKey(form, field.binding);
|
|
7303
|
+
const current = target2 === void 0 ? void 0 : form.states.get(target2);
|
|
7304
|
+
if (target2 === void 0 || current === void 0) {
|
|
7305
|
+
return drift11(`the profile form has no ${field.name} field`);
|
|
7306
|
+
}
|
|
7307
|
+
const model = new Map(form.states);
|
|
7308
|
+
model.set(target2, { ...current, value });
|
|
7309
|
+
const states2 = wireStates(keysOf(form.args), model, topSkills(form));
|
|
7310
|
+
if (!Array.isArray(states2)) return states2;
|
|
7311
|
+
return { ok: true, body: requestBody(form.save, form.args, states2, form.screen) };
|
|
7312
|
+
}
|
|
7313
|
+
async function fetchProfileForm(field, vanityName, client) {
|
|
7314
|
+
const stream = await openForm(
|
|
7315
|
+
field.screen,
|
|
7316
|
+
{ vanityName, isVanityNameResolved: true },
|
|
7317
|
+
client,
|
|
7318
|
+
`profile-${field.name}-form`
|
|
7319
|
+
);
|
|
7320
|
+
return typeof stream === "string" ? readForm(stream, field) : stream;
|
|
7321
|
+
}
|
|
7322
|
+
async function openForm(screen, payload, client, operation) {
|
|
7323
|
+
const result = await client.request({
|
|
7324
|
+
url: `${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
7325
|
+
method: "POST",
|
|
7326
|
+
body: navBody(screen, payload),
|
|
7327
|
+
spendClass: "page",
|
|
7328
|
+
operation
|
|
7329
|
+
});
|
|
7330
|
+
if (!result.ok) {
|
|
7331
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
7332
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
7333
|
+
return out;
|
|
7334
|
+
}
|
|
7335
|
+
return result.classification.raw ?? "";
|
|
7336
|
+
}
|
|
7337
|
+
async function sendAction(requestId, body, client, operation, spendClass = "write") {
|
|
7338
|
+
const result = await client.request({
|
|
7339
|
+
url: `${ACTION_URL}?sduiid=${requestId}`,
|
|
7340
|
+
method: "POST",
|
|
7341
|
+
body,
|
|
7342
|
+
spendClass,
|
|
7343
|
+
operation
|
|
7344
|
+
});
|
|
7345
|
+
if (!result.ok) {
|
|
7346
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
7347
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
7348
|
+
return out;
|
|
7349
|
+
}
|
|
7350
|
+
const raw = result.classification.raw ?? "";
|
|
7351
|
+
const errors = responseErrors(raw);
|
|
7352
|
+
if (errors !== null) {
|
|
7353
|
+
return { ok: false, code: "INVALID_INPUT", message: `LinkedIn refused it: ${errors}` };
|
|
7354
|
+
}
|
|
7355
|
+
return raw;
|
|
7356
|
+
}
|
|
7357
|
+
async function sendProfileSave(form, body, client) {
|
|
7358
|
+
const r = await sendAction(form.save, body, client, "profile-save");
|
|
7359
|
+
return typeof r === "string" ? { ok: true } : r;
|
|
7360
|
+
}
|
|
7361
|
+
|
|
7362
|
+
// src/engine/sdui-skill.ts
|
|
7363
|
+
var SKILL = {
|
|
7364
|
+
addScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillAddForm",
|
|
7365
|
+
editScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetailsEditForm",
|
|
7366
|
+
listScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetails",
|
|
7367
|
+
pager: "com.linkedin.sdui.pagers.profile.details.skills",
|
|
7368
|
+
save: "com.linkedin.sdui.requests.profile.saveProfileSkillForm",
|
|
7369
|
+
delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
|
|
7370
|
+
};
|
|
7371
|
+
var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
|
|
7372
|
+
var TEXT4 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
7373
|
+
function skillsFromPage(stream) {
|
|
7374
|
+
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV) && !stream.includes("isPartialPage")) {
|
|
7375
|
+
return drift11("the skills page could not be read");
|
|
7376
|
+
}
|
|
7377
|
+
const skills = [];
|
|
7378
|
+
let from = 0;
|
|
7379
|
+
let i = 0;
|
|
7380
|
+
for (; ; ) {
|
|
7381
|
+
i = stream.indexOf(EDIT_NAV, i);
|
|
7382
|
+
if (i === -1) break;
|
|
7383
|
+
const text6 = balanced(stream, i);
|
|
7384
|
+
const end = i;
|
|
7385
|
+
i += EDIT_NAV.length;
|
|
7386
|
+
if (text6 === null) continue;
|
|
7387
|
+
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
7388
|
+
const id = payload?.skillId;
|
|
7389
|
+
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
7390
|
+
continue;
|
|
7391
|
+
const names = [...stream.slice(from, end).matchAll(TEXT4)].map(
|
|
7392
|
+
(m) => JSON.parse(`"${m[1]}"`)
|
|
7393
|
+
);
|
|
7394
|
+
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
7395
|
+
from = end + text6.length;
|
|
7396
|
+
}
|
|
7397
|
+
return { ok: true, skills };
|
|
7398
|
+
}
|
|
7399
|
+
var SKILL_COMPONENT = /"componentKey":"com\.linkedin\.sdui\.profile\.skill\([^)]+\)","children":\["\$","\$L[0-9a-f]+","[^"]+",\{"componentKey":"[^"]+","initialContent":"\$L([0-9a-f]+)"/g;
|
|
7400
|
+
var SKILL_NAME = /"fontSize":"medium","fontStyle":"normal","fontWeight":"bold","lineHeight":"[^"]*","textAlign":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]/;
|
|
7401
|
+
function skillNamesOf(stream) {
|
|
7402
|
+
const rows = new Rows(stream);
|
|
7403
|
+
return [...stream.matchAll(SKILL_COMPONENT)].flatMap((m) => {
|
|
7404
|
+
const name = rows.reach(m[1]).map((r) => rows.byId.get(r)?.match(SKILL_NAME)?.[1]).find((n) => n !== void 0);
|
|
7405
|
+
return name === void 0 ? [] : [JSON.parse(`"${name}"`)];
|
|
7406
|
+
});
|
|
7407
|
+
}
|
|
7408
|
+
function skillRowsOf(stream) {
|
|
7409
|
+
return [...stream.matchAll(SKILL_COMPONENT)].length;
|
|
7410
|
+
}
|
|
7411
|
+
function listPayloadOf(screen) {
|
|
7412
|
+
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
7413
|
+
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
7414
|
+
const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
7415
|
+
return text6 === null ? null : JSON.parse(text6);
|
|
7416
|
+
}
|
|
7417
|
+
function pagerFrom(payload, start) {
|
|
7418
|
+
const args = {
|
|
7419
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
7420
|
+
requestedStateKeys: [],
|
|
7421
|
+
payload: { ...payload, start },
|
|
7422
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
7423
|
+
};
|
|
7424
|
+
return {
|
|
7425
|
+
pagerId: SKILL.pager,
|
|
7426
|
+
clientArguments: { ...args, states: [], screenId: SKILL.listScreen, knownTemplateIds: [] },
|
|
7427
|
+
paginationRequest: {
|
|
7428
|
+
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
7429
|
+
pagerId: SKILL.pager,
|
|
7430
|
+
retryCount: 0,
|
|
7431
|
+
requestedArguments: args
|
|
7432
|
+
}
|
|
7433
|
+
};
|
|
7434
|
+
}
|
|
7435
|
+
function readSkillForm(stream) {
|
|
7436
|
+
const model = readModel(stream);
|
|
7437
|
+
if (model === null) return drift11("the skill form carried no initial values");
|
|
7438
|
+
const save = findRequest(stream, SKILL.save);
|
|
7439
|
+
const del = findRequest(stream, SKILL.delete);
|
|
7440
|
+
if (save === null && del === null)
|
|
7441
|
+
return drift11("the skill form carried neither a save nor a delete");
|
|
7442
|
+
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
7443
|
+
}
|
|
7444
|
+
var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
|
|
7445
|
+
function skillNameOf(form) {
|
|
7446
|
+
const key = nameKey(form.model);
|
|
7447
|
+
const v = key === void 0 ? void 0 : form.model.get(key)?.value;
|
|
7448
|
+
return typeof v === "string" ? v : null;
|
|
7449
|
+
}
|
|
7450
|
+
function addSkillBody(form, name) {
|
|
7451
|
+
if (name.trim() === "")
|
|
7452
|
+
return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
|
|
7453
|
+
if (form.save === null) return drift11("this form has no save action (it is not the add form)");
|
|
7454
|
+
const key = nameKey(form.model);
|
|
7455
|
+
const current = key === void 0 ? void 0 : form.model.get(key);
|
|
7456
|
+
if (key === void 0 || current === void 0) return drift11("the skill form has no name field");
|
|
7457
|
+
const model = new Map(form.model);
|
|
7458
|
+
model.set(key, { ...current, value: name.trim() });
|
|
7459
|
+
const states2 = wireStates(keysOf(form.save), model, () => void 0);
|
|
7460
|
+
if (!Array.isArray(states2)) return states2;
|
|
7461
|
+
return { ok: true, body: requestBody(SKILL.save, form.save, states2, form.screen) };
|
|
7462
|
+
}
|
|
7463
|
+
function removeSkillBody(form) {
|
|
7464
|
+
if (form.del === null)
|
|
7465
|
+
return drift11("this form has no delete action (it is not an existing skill)");
|
|
7466
|
+
const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
|
|
7467
|
+
if (!Array.isArray(states2)) return states2;
|
|
7468
|
+
return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
|
|
7469
|
+
}
|
|
7470
|
+
var PAGER_URL2 = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${SKILL.pager}`;
|
|
7471
|
+
var MAX_PAGES2 = 10;
|
|
7472
|
+
async function fetchSkills(vanityName, client) {
|
|
7473
|
+
const screen = await openForm(
|
|
7474
|
+
SKILL.listScreen,
|
|
7475
|
+
{ vanityName, isVanityNameResolved: true },
|
|
7476
|
+
client,
|
|
7477
|
+
"skills-screen"
|
|
7478
|
+
);
|
|
7479
|
+
if (typeof screen !== "string") return screen;
|
|
7480
|
+
const payload = listPayloadOf(screen);
|
|
7481
|
+
if (payload === null) return drift11("the Skills screen carried no list request");
|
|
7482
|
+
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
7483
|
+
const skills = [];
|
|
7484
|
+
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
7485
|
+
const result = await client.request({
|
|
7486
|
+
url: PAGER_URL2,
|
|
7487
|
+
method: "POST",
|
|
7488
|
+
body: pagerFrom(payload, skills.length),
|
|
7489
|
+
spendClass: "page",
|
|
7490
|
+
operation: "skills"
|
|
7491
|
+
});
|
|
7492
|
+
if (!result.ok) return { ok: false, code: result.code, message: result.message };
|
|
7493
|
+
const parsed = skillsFromPage(result.classification.raw ?? "");
|
|
7494
|
+
if (!parsed.ok) return parsed;
|
|
7495
|
+
const fresh = parsed.skills.filter((s) => !skills.some((k) => k.skillId === s.skillId));
|
|
7496
|
+
skills.push(...fresh);
|
|
7497
|
+
if (parsed.skills.length < count3 || fresh.length === 0) break;
|
|
7498
|
+
}
|
|
7499
|
+
return { ok: true, skills };
|
|
7500
|
+
}
|
|
7501
|
+
async function openSkillForm(payload, client, edit2) {
|
|
7502
|
+
const stream = await openForm(
|
|
7503
|
+
edit2 ? SKILL.editScreen : SKILL.addScreen,
|
|
7504
|
+
{ ...payload, isVanityNameResolved: true },
|
|
7505
|
+
client,
|
|
7506
|
+
edit2 ? "skill-edit-form" : "skill-add-form"
|
|
7507
|
+
);
|
|
7508
|
+
return typeof stream === "string" ? readSkillForm(stream) : stream;
|
|
7509
|
+
}
|
|
7510
|
+
async function sendSkill(body, requestId, client) {
|
|
7511
|
+
const sent = await sendAction(
|
|
7512
|
+
requestId,
|
|
7513
|
+
body,
|
|
7514
|
+
client,
|
|
7515
|
+
requestId === SKILL.save ? "skill-add" : "skill-remove"
|
|
7516
|
+
);
|
|
7517
|
+
return typeof sent === "string" ? { ok: true } : sent;
|
|
7518
|
+
}
|
|
7519
|
+
|
|
7520
|
+
// src/commands/profile.ts
|
|
7521
|
+
function liveFetch9(quiet) {
|
|
7522
|
+
const session = loadSession();
|
|
7523
|
+
if (session.state !== "ok")
|
|
7524
|
+
return err("profile", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
7525
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
7526
|
+
return async (url, spendClass, body) => {
|
|
7527
|
+
const r = await client.request({
|
|
7528
|
+
url,
|
|
7529
|
+
...body !== void 0 ? { method: "POST", body } : {},
|
|
7530
|
+
spendClass,
|
|
7531
|
+
operation: "profile"
|
|
7532
|
+
});
|
|
7533
|
+
if (!r.ok) return r;
|
|
7534
|
+
return { ok: true, json: r.json, raw: r.classification.raw ?? "" };
|
|
7535
|
+
};
|
|
7536
|
+
}
|
|
7537
|
+
function memberIdOf(input) {
|
|
7538
|
+
const s = input.trim();
|
|
7539
|
+
const slug = s.match(/linkedin\.com\/in\/([^/?#]+)/)?.[1];
|
|
7540
|
+
if (slug !== void 0) {
|
|
7541
|
+
try {
|
|
7542
|
+
return decodeURIComponent(slug);
|
|
7543
|
+
} catch {
|
|
7544
|
+
return slug;
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
return s.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/)?.[1] ?? s;
|
|
7548
|
+
}
|
|
7549
|
+
async function readRestOfExperience(get, p) {
|
|
7550
|
+
const want = p.counts?.experience;
|
|
7551
|
+
if (want === void 0) return;
|
|
7552
|
+
let start = want.shown;
|
|
7553
|
+
while (start < want.total) {
|
|
7554
|
+
const res = await get(positionsPageUrl(p.urn, start), "profile");
|
|
7555
|
+
const page = res.ok ? parsePositionsPage(res.json) : res;
|
|
7556
|
+
if (!page.ok) {
|
|
7557
|
+
p.experienceError = `${page.code}: ${page.message}`;
|
|
7558
|
+
return;
|
|
7559
|
+
}
|
|
7560
|
+
p.experience = [...p.experience ?? [], ...page.experience];
|
|
7561
|
+
start += page.groups;
|
|
7562
|
+
if (page.groups < POSITIONS_PAGE) break;
|
|
7563
|
+
}
|
|
7564
|
+
const counts2 = { ...p.counts };
|
|
7565
|
+
if (start >= want.total) delete counts2.experience;
|
|
7566
|
+
else counts2.experience = { shown: start, total: want.total };
|
|
7567
|
+
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
7568
|
+
else delete p.counts;
|
|
7569
|
+
}
|
|
7570
|
+
async function readContact(get, p) {
|
|
7571
|
+
if (p.publicId === void 0 || p.firstName === void 0) {
|
|
7572
|
+
p.contactError = "NOT_FOUND: the profile has no public id or name to ask with";
|
|
7573
|
+
return;
|
|
7574
|
+
}
|
|
7575
|
+
const body = contactInfoBody(p.publicId, p.firstName, p.lastName ?? "");
|
|
7576
|
+
const res = await get(CONTACT_INFO_URL, "profile", body);
|
|
7577
|
+
const read = res.ok ? parseContactInfo(res.raw ?? "") : res;
|
|
7578
|
+
if (read.ok) p.contact = read.contact;
|
|
7579
|
+
else p.contactError = `${read.code}: ${read.message}`;
|
|
7580
|
+
}
|
|
7581
|
+
var SKILL_PAGES = 10;
|
|
7582
|
+
async function readAllSkills(get, p) {
|
|
7583
|
+
const fail2 = (code, message) => {
|
|
7584
|
+
p.skillsError = `${code}: ${message}`;
|
|
7585
|
+
};
|
|
7586
|
+
if (p.publicId === void 0)
|
|
7587
|
+
return fail2("NOT_FOUND", "the profile has no public id to ask with");
|
|
7588
|
+
const screen = SKILL.listScreen;
|
|
7589
|
+
const nav = await get(
|
|
7590
|
+
`${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
7591
|
+
"page",
|
|
7592
|
+
navBody(screen, { vanityName: p.publicId, isVanityNameResolved: true })
|
|
7593
|
+
);
|
|
7594
|
+
if (!nav.ok) return fail2(nav.code, nav.message);
|
|
7595
|
+
const payload = listPayloadOf(nav.raw ?? "");
|
|
7596
|
+
if (payload === null) return fail2("SCHEMA_DRIFT", "the Skills screen carried no list request");
|
|
7597
|
+
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
7598
|
+
const total = p.counts?.skills?.total;
|
|
7599
|
+
const skills = [];
|
|
7600
|
+
let start = 0;
|
|
7601
|
+
for (let page = 0; page < SKILL_PAGES; page++) {
|
|
7602
|
+
const res = await get(PAGER_URL2, "page", pagerFrom(payload, start));
|
|
7603
|
+
if (!res.ok) return fail2(res.code, res.message);
|
|
7604
|
+
const rows = skillRowsOf(res.raw ?? "");
|
|
7605
|
+
const names = skillNamesOf(res.raw ?? "");
|
|
7606
|
+
if (rows > names.length)
|
|
7607
|
+
return fail2("SCHEMA_DRIFT", `${rows} skills were shown, ${names.length} read`);
|
|
7608
|
+
skills.push(...names);
|
|
7609
|
+
start += rows;
|
|
7610
|
+
if (rows < count3 || total !== void 0 && start >= total) break;
|
|
7611
|
+
}
|
|
7612
|
+
if (skills.length === 0) return fail2("SCHEMA_DRIFT", "the skills list held no skills");
|
|
7613
|
+
p.skills = skills;
|
|
7614
|
+
const counts2 = { ...p.counts };
|
|
7615
|
+
if (total === void 0 || skills.length >= total) delete counts2.skills;
|
|
7616
|
+
else counts2.skills = { shown: skills.length, total };
|
|
7617
|
+
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
7618
|
+
else delete p.counts;
|
|
7619
|
+
}
|
|
7620
|
+
var RECOMMENDATION_PAGES = 10;
|
|
7621
|
+
async function readRecommendations(get, p) {
|
|
7622
|
+
if (p.publicId === void 0) {
|
|
7623
|
+
p.recommendationsError = "NOT_FOUND: the profile has no public id to ask with";
|
|
7624
|
+
return;
|
|
7625
|
+
}
|
|
7626
|
+
const out = { received: [], given: [] };
|
|
7627
|
+
for (const kind of ["received", "given"]) {
|
|
7628
|
+
for (let page = 0; page < RECOMMENDATION_PAGES; page++) {
|
|
7629
|
+
const body = recommendationsBody(kind, p.publicId, p.id, out[kind].length);
|
|
7630
|
+
const res = await get(RECOMMENDATIONS_URL, "page", body);
|
|
7631
|
+
const read = res.ok ? parseRecommendations(res.raw ?? "") : res;
|
|
7632
|
+
if (!read.ok) {
|
|
7633
|
+
p.recommendationsError = `${read.code}: ${read.message}`;
|
|
7634
|
+
return;
|
|
7635
|
+
}
|
|
7636
|
+
out[kind].push(...read.items);
|
|
7637
|
+
if (read.items.length < RECOMMENDATIONS_PAGE) break;
|
|
7638
|
+
}
|
|
7639
|
+
}
|
|
7640
|
+
p.recommendations = out;
|
|
7641
|
+
}
|
|
7642
|
+
async function readPosts(get, p, n, compact2) {
|
|
7643
|
+
const r = await runPostsSearch(
|
|
7644
|
+
{ from: [p.id], sort: "recent", limit: n },
|
|
7645
|
+
compact2 ? { compact: true } : {},
|
|
7646
|
+
async (url, body) => {
|
|
7647
|
+
const res = await get(url, "search", body);
|
|
7648
|
+
return res.ok ? { ok: true, raw: res.raw ?? "" } : res;
|
|
7649
|
+
}
|
|
7650
|
+
);
|
|
7651
|
+
if (r.ok) p.posts = r.data.items;
|
|
7652
|
+
else p.postsError = `${r.error.code}: ${r.error.message}`;
|
|
7653
|
+
}
|
|
7654
|
+
var span = (x) => x.start === void 0 && x.end === void 0 ? void 0 : `${x.start ?? "?"} \u2013 ${x.current === true ? "now" : x.end ?? "?"}`;
|
|
7655
|
+
var roleLine = (r) => line([r.title, r.company, span(r), r.employmentType, r.location]);
|
|
7656
|
+
var schoolLine = (s) => line([s.school, s.degree, s.field, span(s)]);
|
|
7657
|
+
var entryLine = (e) => {
|
|
7658
|
+
const { description: _d, url, ...rest } = e;
|
|
7659
|
+
const dates = span(e);
|
|
7660
|
+
const fields = Object.entries(rest).filter(([k, v]) => !["start", "end", "current"].includes(k) && typeof v === "string").map(([, v]) => v);
|
|
7661
|
+
return line([...fields, dates, typeof url === "string" ? url : void 0]);
|
|
7662
|
+
};
|
|
7663
|
+
var LISTS2 = [
|
|
7664
|
+
"certifications",
|
|
7665
|
+
"languages",
|
|
7666
|
+
"honors",
|
|
7667
|
+
"publications",
|
|
7668
|
+
"projects",
|
|
7669
|
+
"volunteering",
|
|
7670
|
+
"courses",
|
|
7671
|
+
"organizations",
|
|
7672
|
+
"patents",
|
|
7673
|
+
"testScores"
|
|
7674
|
+
];
|
|
7675
|
+
function compact(p) {
|
|
7676
|
+
const out = { ...p };
|
|
7677
|
+
if (p.experience !== void 0) out.experience = p.experience.map(roleLine);
|
|
7678
|
+
if (p.education !== void 0) out.education = p.education.map(schoolLine);
|
|
7679
|
+
for (const key of LISTS2) {
|
|
7680
|
+
const rows = p[key];
|
|
7681
|
+
if (rows !== void 0) out[key] = rows.map(entryLine);
|
|
7682
|
+
}
|
|
7683
|
+
return out;
|
|
7684
|
+
}
|
|
7685
|
+
async function runProfile(input, opts = {}, fetch2, req = {}) {
|
|
7686
|
+
if (input === void 0 || input.trim() === "")
|
|
7687
|
+
return err(
|
|
7688
|
+
"profile",
|
|
7689
|
+
"INVALID_INPUT",
|
|
7690
|
+
"a public id, profile URL or urn is required",
|
|
7691
|
+
"lnrelay profile <public-id|url|urn>"
|
|
7692
|
+
);
|
|
7693
|
+
const get = fetch2 ?? liveFetch9(opts.quiet === true);
|
|
7694
|
+
if (typeof get !== "function") return get;
|
|
7695
|
+
const res = await get(fullProfileUrl(memberIdOf(input)), "profile");
|
|
7696
|
+
if (!res.ok) return err("profile", res.code, res.message, res.hint);
|
|
7697
|
+
const parsed = parseFullProfile(res.json);
|
|
7698
|
+
if (!parsed.ok) return err("profile", parsed.code, parsed.message, parsed.hint);
|
|
7699
|
+
const p = parsed.profile;
|
|
7700
|
+
await readRestOfExperience(get, p);
|
|
7701
|
+
if (req.skills === true) await readAllSkills(get, p);
|
|
7702
|
+
if (req.recommendations === true) await readRecommendations(get, p);
|
|
7703
|
+
if (req.contact === true) await readContact(get, p);
|
|
7704
|
+
if (req.posts !== void 0 && req.posts > 0)
|
|
7705
|
+
await readPosts(get, p, req.posts, opts.compact === true);
|
|
7706
|
+
if (opts.raw === true) return ok("profile", { ...p, raw: res.json });
|
|
7707
|
+
if (opts.fields !== void 0 && opts.fields !== "")
|
|
7708
|
+
return ok("profile", project([p], opts.fields)[0]);
|
|
7709
|
+
return ok("profile", opts.compact === true ? compact(p) : p);
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7712
|
+
// src/commands/registry.ts
|
|
7713
|
+
var COMMANDS = [
|
|
7714
|
+
// ─── local / meta — no network, available today ────────────────────────────
|
|
7715
|
+
{
|
|
7716
|
+
name: "doctor",
|
|
7717
|
+
cost: "free with --offline",
|
|
7718
|
+
summary: "Diagnose setup: entry point, cache dir, cookies, cooldown, budget.",
|
|
7719
|
+
usage: "lnrelay doctor [--offline]",
|
|
7720
|
+
audience: ["cli", "mcp"],
|
|
7721
|
+
risk: "local",
|
|
7722
|
+
implemented: true
|
|
7723
|
+
},
|
|
7724
|
+
{
|
|
7725
|
+
name: "budget",
|
|
7726
|
+
cost: "free",
|
|
7727
|
+
summary: "Spend ledger per class, with each cap's provenance. Reset a cooldown here.",
|
|
7728
|
+
usage: "lnrelay budget [--reset-cooldown --confirm]",
|
|
7729
|
+
audience: ["cli", "mcp"],
|
|
7730
|
+
risk: "local",
|
|
7731
|
+
implemented: true
|
|
7732
|
+
},
|
|
7733
|
+
{
|
|
7734
|
+
name: "risk",
|
|
7735
|
+
cost: "free",
|
|
7736
|
+
summary: "Circuit-breaker state. Check this BEFORE spending budget on research.",
|
|
7737
|
+
usage: "lnrelay risk",
|
|
7738
|
+
audience: ["cli", "mcp"],
|
|
7739
|
+
risk: "local",
|
|
7740
|
+
implemented: true
|
|
7741
|
+
},
|
|
7742
|
+
// ─── session ───────────────────────────────────────────────────────────────
|
|
7743
|
+
{
|
|
7127
7744
|
name: "login",
|
|
7128
7745
|
cost: "free \u2014 local browser",
|
|
7129
7746
|
summary: "Mint a session from a logged-in Chrome via DevTools. Stores cookies owner-only.",
|
|
@@ -7144,9 +7761,9 @@ var COMMANDS = [
|
|
|
7144
7761
|
},
|
|
7145
7762
|
{
|
|
7146
7763
|
name: "profile",
|
|
7147
|
-
cost: "1 profile read (+1 per 50 companies past the first 10; --contact +1)",
|
|
7148
|
-
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.",
|
|
7149
|
-
usage: "lnrelay profile <public-id|profile-id|urn|url> [--contact] [--compact | --fields a,b,c] [--raw]",
|
|
7764
|
+
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)",
|
|
7765
|
+
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.",
|
|
7766
|
+
usage: "lnrelay profile <public-id|profile-id|urn|url> [--contact] [--posts N] [--skills]\n [--recommendations]\n [--compact | --fields a,b,c] [--raw]",
|
|
7150
7767
|
audience: ["cli", "mcp"],
|
|
7151
7768
|
risk: "read",
|
|
7152
7769
|
implemented: true
|
|
@@ -7305,6 +7922,15 @@ var COMMANDS = [
|
|
|
7305
7922
|
risk: "read",
|
|
7306
7923
|
implemented: true
|
|
7307
7924
|
},
|
|
7925
|
+
{
|
|
7926
|
+
name: "notifications",
|
|
7927
|
+
cost: "1 page call per 25",
|
|
7928
|
+
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.",
|
|
7929
|
+
usage: "lnrelay notifications [--unread] [--limit N] [--compact | --fields a,b,c]",
|
|
7930
|
+
audience: ["cli", "mcp"],
|
|
7931
|
+
risk: "read",
|
|
7932
|
+
implemented: true
|
|
7933
|
+
},
|
|
7308
7934
|
{
|
|
7309
7935
|
name: "viewers",
|
|
7310
7936
|
cost: "2 page calls",
|
|
@@ -7425,227 +8051,100 @@ var COMMANDS = [
|
|
|
7425
8051
|
},
|
|
7426
8052
|
{
|
|
7427
8053
|
name: "approval",
|
|
7428
|
-
cost: "free \u2014 local",
|
|
7429
|
-
summary: "Show or set how writes are approved: interactive (a human at a terminal), agent (the owner approves a --plan preview in chat), or unattended. Only a terminal can change it.",
|
|
7430
|
-
usage: "lnrelay approval [show]\n lnrelay approval set <interactive|agent|unattended>\n Setting needs an interactive terminal and a typed token. Every approval and outcome\n is appended to ~/.lnrelay/writes.jsonl.",
|
|
7431
|
-
audience: ["cli"],
|
|
7432
|
-
risk: "local",
|
|
7433
|
-
implemented: true
|
|
7434
|
-
},
|
|
7435
|
-
{
|
|
7436
|
-
name: "share",
|
|
7437
|
-
cost: "1 call \u2014 write",
|
|
7438
|
-
summary: "Post to your own feed. Prefers LinkedIn's official OAuth scope, falls back to the private API when no token exists \u2014 the prompt always names which.",
|
|
7439
|
-
usage: 'lnrelay share "<text>" [--image <path> ... [--alt "<text>" ...] | --video <path>\n | --document <pdf> --title "<title>"] [--at "YYYY-MM-DD HH:MM"]\n [--poll "<question>" --option "<a>" --option "<b>" ... [--duration 1d|3d|1w|2w]]\n [--visibility public|connections] [--via oauth|voyager] [--no-card]\n [--plan | --confirm <token>]\n Approval follows `lnrelay approval`: --plan previews and returns a token without\n sending; --confirm <token> sends it in agent mode. In interactive mode it asks at a\n terminal. --image repeats for up to 20, --alt pairs with it by position (--alt ""\n skips one). --at schedules it (local time, or ISO 8601 with an offset; at least 10\n minutes out); LinkedIn publishes it then, and `lnrelay delete <urn>` cancels it.\n --poll takes 2-4 --option and cannot be scheduled yet. The first link in the text\n gets the preview card LinkedIn would show (one extra read, named in the preview);\n --no-card posts it as plain text. Files, documents, polls, cards and scheduling go\n over the private API only.',
|
|
7440
|
-
audience: ["cli"],
|
|
7441
|
-
risk: "write",
|
|
7442
|
-
implemented: true
|
|
7443
|
-
},
|
|
7444
|
-
{
|
|
7445
|
-
name: "comment",
|
|
7446
|
-
cost: "1 call \u2014 write",
|
|
7447
|
-
summary: "Add a comment to a post. Harvests its binding tokens from the rendered page; no browser needed, but it costs one heavy read.",
|
|
7448
|
-
usage: 'lnrelay comment <activity-urn> "<text>"\n Fetches the post page (~2.8 MB) to harvest a binding key and trackingId, and proves\n the key belongs to that post before asking. To change a comment, see `edit`.',
|
|
7449
|
-
audience: ["cli"],
|
|
7450
|
-
risk: "write",
|
|
7451
|
-
implemented: true
|
|
7452
|
-
},
|
|
7453
|
-
{
|
|
7454
|
-
name: "delete",
|
|
7455
|
-
cost: "1 read + 1 write",
|
|
7456
|
-
summary: "Delete one of your own posts or comments. Reads a post back and shows its text first \u2014 this is the one action that cannot be undone.",
|
|
7457
|
-
usage: "lnrelay delete <activity-urn> # a post; shows you its text before destroying it\n lnrelay delete <comment-urn> # a comment; the server decides if you may",
|
|
7458
|
-
audience: ["cli"],
|
|
7459
|
-
risk: "write",
|
|
7460
|
-
implemented: true
|
|
7461
|
-
},
|
|
7462
|
-
{
|
|
7463
|
-
name: "reply",
|
|
7464
|
-
cost: "1 read + 1 write",
|
|
7465
|
-
summary: "Reply to a comment, nested under it. Goes over Voyager \u2014 a different endpoint from commenting, with the parent named in threadUrn.",
|
|
7466
|
-
usage: 'lnrelay reply <comment-urn> "<text>"',
|
|
7467
|
-
audience: ["cli"],
|
|
7468
|
-
risk: "write",
|
|
7469
|
-
implemented: true
|
|
7470
|
-
},
|
|
7471
|
-
{
|
|
7472
|
-
name: "edit",
|
|
7473
|
-
cost: "1 read + 1 write",
|
|
7474
|
-
summary: "Change the text of a comment or post you wrote, your profile headline or About, or your profile photo or cover image. Its own verb, so a comment urn can never be mistaken for something to comment ON.",
|
|
7475
|
-
usage: 'lnrelay edit <comment-urn | share-urn | ugcPost-urn> "<text>"\n lnrelay edit headline|about ("<text>" | --file <path>)\n lnrelay edit photo|banner <image.png|jpg> (photo square, banner 4:1, max 8 MB)\n A post is edited by the urn it was created as (`share` prints it; `my-posts` lists\n it as shareUrn), not its activity urn. The whole text is replaced. A profile edit\n shows the current text beside the new one, sends every other profile field back as\n LinkedIn holds it, and reads the profile back to confirm. Headline max 220 characters.\n An image is uploaded as it is, uncropped, and read back: it must be the one showing.',
|
|
7476
|
-
audience: ["cli"],
|
|
7477
|
-
risk: "write",
|
|
7478
|
-
implemented: true
|
|
7479
|
-
},
|
|
7480
|
-
{
|
|
7481
|
-
name: "role",
|
|
7482
|
-
cost: "3-4 reads + 1 write",
|
|
7483
|
-
summary: "Add, edit or remove a role in your Experience. Never rewrites your headline; notify network is off unless --notify.",
|
|
7484
|
-
usage: 'lnrelay role add --title "<t>" --company "<c>" --start YYYY-MM [--end YYYY-MM | --current]\n [--location "<l>"] [--description "<d>" | --description-file <path>] [--notify]\n lnrelay role edit <position-id> [any of the flags above]\n lnrelay role remove <position-id>\n Position ids come from `lnrelay experience`. The preview shows the role as it is and\n as it will be; the result is read back from the profile. A role with media attached\n is refused. The company is free text (not linked to a company page).',
|
|
7485
|
-
audience: ["cli"],
|
|
7486
|
-
risk: "write",
|
|
7487
|
-
implemented: true
|
|
7488
|
-
},
|
|
7489
|
-
{
|
|
7490
|
-
name: "skill",
|
|
7491
|
-
cost: "4-5 reads + 1 write",
|
|
7492
|
-
summary: "Add a skill to your profile, or remove one.",
|
|
7493
|
-
usage: 'lnrelay skill add "<name>"\n lnrelay skill remove <skill-id>\n Skill ids come from `lnrelay skills`. A skill is added as free text, linked to no role,\n school or project. Removing a skill removes its endorsements with it.',
|
|
7494
|
-
audience: ["cli"],
|
|
7495
|
-
risk: "write",
|
|
7496
|
-
implemented: true
|
|
7497
|
-
},
|
|
7498
|
-
{
|
|
7499
|
-
name: "react",
|
|
7500
|
-
cost: "1 call \u2014 write",
|
|
7501
|
-
summary: "React to a post or comment, over LinkedIn's SDUI surface. Reversible with --remove.",
|
|
7502
|
-
usage: "lnrelay react <activity-urn | comment-urn> [--type LIKE|PRAISE|EMPATHY|INTEREST|APPRECIATION|ENTERTAINMENT]\n lnrelay react <urn> --remove # take the reaction back",
|
|
7503
|
-
audience: ["cli"],
|
|
7504
|
-
risk: "write",
|
|
7505
|
-
implemented: true
|
|
7506
|
-
}
|
|
7507
|
-
];
|
|
7508
|
-
var commandNames = COMMANDS.map((c) => c.name);
|
|
7509
|
-
function findCommand(name) {
|
|
7510
|
-
return COMMANDS.find((c) => c.name === name);
|
|
7511
|
-
}
|
|
7512
|
-
function helpText() {
|
|
7513
|
-
const lines = ["lnrelay \u2014 deep research over LinkedIn from your own account", "", "Commands:"];
|
|
7514
|
-
const width = Math.max(...commandNames.map((n) => n.length));
|
|
7515
|
-
for (const c of COMMANDS) {
|
|
7516
|
-
const flag = c.implemented ? " " : "\xB7";
|
|
7517
|
-
lines.push(` ${flag} ${c.name.padEnd(width)} ${c.summary} [${c.cost}]`);
|
|
7518
|
-
}
|
|
7519
|
-
lines.push("", " \xB7 = specified in docs/DESIGN.md, not yet implemented");
|
|
7520
|
-
lines.push("", "Run `lnrelay <command> --help` for usage.");
|
|
7521
|
-
return lines.join("\n");
|
|
7522
|
-
}
|
|
7523
|
-
|
|
7524
|
-
// src/engine/sdui-profile.ts
|
|
7525
|
-
var NAV_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/navigation";
|
|
7526
|
-
var ACTION_URL = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
7527
|
-
var PROFILE_FIELDS = {
|
|
7528
|
-
headline: {
|
|
7529
|
-
name: "headline",
|
|
7530
|
-
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileEditIntroForm",
|
|
7531
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileIntroForm",
|
|
7532
|
-
binding: "headline",
|
|
7533
|
-
// The web form refuses more ("Exceeded maximum length of 220 characters").
|
|
7534
|
-
maxLength: 220
|
|
7535
|
-
},
|
|
7536
|
-
about: {
|
|
7537
|
-
name: "about",
|
|
7538
|
-
screen: "com.linkedin.sdui.flagshipnav.profile.ProfileAboutForm",
|
|
7539
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileAboutForm",
|
|
7540
|
-
binding: "about",
|
|
7541
|
-
maxLength: 2600
|
|
7542
|
-
}
|
|
7543
|
-
};
|
|
7544
|
-
var drift9 = (message) => ({
|
|
7545
|
-
ok: false,
|
|
7546
|
-
code: "SCHEMA_DRIFT",
|
|
7547
|
-
message,
|
|
7548
|
-
hint: "Re-capture the profile form with scripts/observe-write.ts (edit one character, then revert)."
|
|
7549
|
-
});
|
|
7550
|
-
function readForm(stream, field) {
|
|
7551
|
-
const states2 = readModel(stream);
|
|
7552
|
-
if (states2 === null) return drift9("the profile form carried no initial values");
|
|
7553
|
-
const args = findRequest(stream, field.save);
|
|
7554
|
-
if (args === null)
|
|
7555
|
-
return drift9(`the profile form carried no ${field.save.split(".").pop()} action`);
|
|
7556
|
-
return { ok: true, args, states: states2, screen: field.screen, save: field.save };
|
|
7557
|
-
}
|
|
7558
|
-
function boundKey(form, property) {
|
|
7559
|
-
const ref = form.args.payload[property];
|
|
7560
|
-
return ref?.key;
|
|
7561
|
-
}
|
|
7562
|
-
function currentValue(form, field) {
|
|
7563
|
-
const key = boundKey(form, field.binding);
|
|
7564
|
-
const v = key === void 0 ? void 0 : form.states.get(key)?.value;
|
|
7565
|
-
return typeof v === "string" ? v : void 0;
|
|
7566
|
-
}
|
|
7567
|
-
function topSkills(form) {
|
|
7568
|
-
return (key) => {
|
|
7569
|
-
if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
|
|
7570
|
-
const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
|
|
7571
|
-
if (initial === void 0) return drift9("the About form carried no initial top skills");
|
|
7572
|
-
if (!Array.isArray(initial.value) || initial.value.length > 0) {
|
|
7573
|
-
return {
|
|
7574
|
-
ok: false,
|
|
7575
|
-
code: "NOT_IMPLEMENTED",
|
|
7576
|
-
message: "your About section has top skills, and saving it with them has not been verified",
|
|
7577
|
-
hint: "Edit About in the browser for now; nothing was changed."
|
|
7578
|
-
};
|
|
7579
|
-
}
|
|
7580
|
-
return { ok: true, value: [] };
|
|
7581
|
-
};
|
|
7582
|
-
}
|
|
7583
|
-
function saveBody(form, field, value) {
|
|
7584
|
-
if (value.length > field.maxLength) {
|
|
7585
|
-
return {
|
|
7586
|
-
ok: false,
|
|
7587
|
-
code: "INVALID_INPUT",
|
|
7588
|
-
message: `the ${field.name} is ${value.length} characters; LinkedIn allows ${field.maxLength}`
|
|
7589
|
-
};
|
|
7590
|
-
}
|
|
7591
|
-
const target2 = boundKey(form, field.binding);
|
|
7592
|
-
const current = target2 === void 0 ? void 0 : form.states.get(target2);
|
|
7593
|
-
if (target2 === void 0 || current === void 0) {
|
|
7594
|
-
return drift9(`the profile form has no ${field.name} field`);
|
|
7595
|
-
}
|
|
7596
|
-
const model = new Map(form.states);
|
|
7597
|
-
model.set(target2, { ...current, value });
|
|
7598
|
-
const states2 = wireStates(keysOf(form.args), model, topSkills(form));
|
|
7599
|
-
if (!Array.isArray(states2)) return states2;
|
|
7600
|
-
return { ok: true, body: requestBody(form.save, form.args, states2, form.screen) };
|
|
7601
|
-
}
|
|
7602
|
-
async function fetchProfileForm(field, vanityName, client) {
|
|
7603
|
-
const stream = await openForm(
|
|
7604
|
-
field.screen,
|
|
7605
|
-
{ vanityName, isVanityNameResolved: true },
|
|
7606
|
-
client,
|
|
7607
|
-
`profile-${field.name}-form`
|
|
7608
|
-
);
|
|
7609
|
-
return typeof stream === "string" ? readForm(stream, field) : stream;
|
|
7610
|
-
}
|
|
7611
|
-
async function openForm(screen, payload, client, operation) {
|
|
7612
|
-
const result = await client.request({
|
|
7613
|
-
url: `${NAV_URL}?screenId=${screen}&sduiid=${screen}`,
|
|
7614
|
-
method: "POST",
|
|
7615
|
-
body: navBody(screen, payload),
|
|
7616
|
-
spendClass: "page",
|
|
7617
|
-
operation
|
|
7618
|
-
});
|
|
7619
|
-
if (!result.ok) {
|
|
7620
|
-
const out = { ok: false, code: result.code, message: result.message };
|
|
7621
|
-
if (result.hint !== void 0) out.hint = result.hint;
|
|
7622
|
-
return out;
|
|
8054
|
+
cost: "free \u2014 local",
|
|
8055
|
+
summary: "Show or set how writes are approved: interactive (a human at a terminal), agent (the owner approves a --plan preview in chat), or unattended. Only a terminal can change it.",
|
|
8056
|
+
usage: "lnrelay approval [show]\n lnrelay approval set <interactive|agent|unattended>\n Setting needs an interactive terminal and a typed token. Every approval and outcome\n is appended to ~/.lnrelay/writes.jsonl.",
|
|
8057
|
+
audience: ["cli"],
|
|
8058
|
+
risk: "local",
|
|
8059
|
+
implemented: true
|
|
8060
|
+
},
|
|
8061
|
+
{
|
|
8062
|
+
name: "share",
|
|
8063
|
+
cost: "1 call \u2014 write",
|
|
8064
|
+
summary: "Post to your own feed. Prefers LinkedIn's official OAuth scope, falls back to the private API when no token exists \u2014 the prompt always names which.",
|
|
8065
|
+
usage: 'lnrelay share "<text>" [--image <path> ... [--alt "<text>" ...] | --video <path>\n | --document <pdf> --title "<title>"] [--at "YYYY-MM-DD HH:MM"]\n [--poll "<question>" --option "<a>" --option "<b>" ... [--duration 1d|3d|1w|2w]]\n [--visibility public|connections] [--via oauth|voyager] [--no-card]\n [--plan | --confirm <token>]\n Approval follows `lnrelay approval`: --plan previews and returns a token without\n sending; --confirm <token> sends it in agent mode. In interactive mode it asks at a\n terminal. --image repeats for up to 20, --alt pairs with it by position (--alt ""\n skips one). --at schedules it (local time, or ISO 8601 with an offset; at least 10\n minutes out); LinkedIn publishes it then, and `lnrelay delete <urn>` cancels it.\n --poll takes 2-4 --option and cannot be scheduled yet. The first link in the text\n gets the preview card LinkedIn would show (one extra read, named in the preview);\n --no-card posts it as plain text. Files, documents, polls, cards and scheduling go\n over the private API only.',
|
|
8066
|
+
audience: ["cli"],
|
|
8067
|
+
risk: "write",
|
|
8068
|
+
implemented: true
|
|
8069
|
+
},
|
|
8070
|
+
{
|
|
8071
|
+
name: "comment",
|
|
8072
|
+
cost: "1 call \u2014 write",
|
|
8073
|
+
summary: "Add a comment to a post. Harvests its binding tokens from the rendered page; no browser needed, but it costs one heavy read.",
|
|
8074
|
+
usage: 'lnrelay comment <activity-urn> "<text>"\n Fetches the post page (~2.8 MB) to harvest a binding key and trackingId, and proves\n the key belongs to that post before asking. To change a comment, see `edit`.',
|
|
8075
|
+
audience: ["cli"],
|
|
8076
|
+
risk: "write",
|
|
8077
|
+
implemented: true
|
|
8078
|
+
},
|
|
8079
|
+
{
|
|
8080
|
+
name: "delete",
|
|
8081
|
+
cost: "1 read + 1 write",
|
|
8082
|
+
summary: "Delete one of your own posts or comments. Reads a post back and shows its text first \u2014 this is the one action that cannot be undone.",
|
|
8083
|
+
usage: "lnrelay delete <activity-urn> # a post; shows you its text before destroying it\n lnrelay delete <comment-urn> # a comment; the server decides if you may",
|
|
8084
|
+
audience: ["cli"],
|
|
8085
|
+
risk: "write",
|
|
8086
|
+
implemented: true
|
|
8087
|
+
},
|
|
8088
|
+
{
|
|
8089
|
+
name: "reply",
|
|
8090
|
+
cost: "1 read + 1 write",
|
|
8091
|
+
summary: "Reply to a comment, nested under it. Goes over Voyager \u2014 a different endpoint from commenting, with the parent named in threadUrn.",
|
|
8092
|
+
usage: 'lnrelay reply <comment-urn> "<text>"',
|
|
8093
|
+
audience: ["cli"],
|
|
8094
|
+
risk: "write",
|
|
8095
|
+
implemented: true
|
|
8096
|
+
},
|
|
8097
|
+
{
|
|
8098
|
+
name: "edit",
|
|
8099
|
+
cost: "1 read + 1 write",
|
|
8100
|
+
summary: "Change the text of a comment or post you wrote, your profile headline or About, or your profile photo or cover image. Its own verb, so a comment urn can never be mistaken for something to comment ON.",
|
|
8101
|
+
usage: 'lnrelay edit <comment-urn | share-urn | ugcPost-urn> "<text>"\n lnrelay edit headline|about ("<text>" | --file <path>)\n lnrelay edit photo|banner <image.png|jpg> (photo square, banner 4:1, max 8 MB)\n A post is edited by the urn it was created as (`share` prints it; `my-posts` lists\n it as shareUrn), not its activity urn. The whole text is replaced. A profile edit\n shows the current text beside the new one, sends every other profile field back as\n LinkedIn holds it, and reads the profile back to confirm. Headline max 220 characters.\n An image is uploaded as it is, uncropped, and read back: it must be the one showing.',
|
|
8102
|
+
audience: ["cli"],
|
|
8103
|
+
risk: "write",
|
|
8104
|
+
implemented: true
|
|
8105
|
+
},
|
|
8106
|
+
{
|
|
8107
|
+
name: "role",
|
|
8108
|
+
cost: "3-4 reads + 1 write",
|
|
8109
|
+
summary: "Add, edit or remove a role in your Experience. Never rewrites your headline; notify network is off unless --notify.",
|
|
8110
|
+
usage: 'lnrelay role add --title "<t>" --company "<c>" --start YYYY-MM [--end YYYY-MM | --current]\n [--location "<l>"] [--description "<d>" | --description-file <path>] [--notify]\n lnrelay role edit <position-id> [any of the flags above]\n lnrelay role remove <position-id>\n Position ids come from `lnrelay experience`. The preview shows the role as it is and\n as it will be; the result is read back from the profile. A role with media attached\n is refused. The company is free text (not linked to a company page).',
|
|
8111
|
+
audience: ["cli"],
|
|
8112
|
+
risk: "write",
|
|
8113
|
+
implemented: true
|
|
8114
|
+
},
|
|
8115
|
+
{
|
|
8116
|
+
name: "skill",
|
|
8117
|
+
cost: "4-5 reads + 1 write",
|
|
8118
|
+
summary: "Add a skill to your profile, or remove one.",
|
|
8119
|
+
usage: 'lnrelay skill add "<name>"\n lnrelay skill remove <skill-id>\n Skill ids come from `lnrelay skills`. A skill is added as free text, linked to no role,\n school or project. Removing a skill removes its endorsements with it.',
|
|
8120
|
+
audience: ["cli"],
|
|
8121
|
+
risk: "write",
|
|
8122
|
+
implemented: true
|
|
8123
|
+
},
|
|
8124
|
+
{
|
|
8125
|
+
name: "react",
|
|
8126
|
+
cost: "1 call \u2014 write",
|
|
8127
|
+
summary: "React to a post or comment, over LinkedIn's SDUI surface. Reversible with --remove.",
|
|
8128
|
+
usage: "lnrelay react <activity-urn | comment-urn> [--type LIKE|PRAISE|EMPATHY|INTEREST|APPRECIATION|ENTERTAINMENT]\n lnrelay react <urn> --remove # take the reaction back",
|
|
8129
|
+
audience: ["cli"],
|
|
8130
|
+
risk: "write",
|
|
8131
|
+
implemented: true
|
|
7623
8132
|
}
|
|
7624
|
-
|
|
8133
|
+
];
|
|
8134
|
+
var commandNames = COMMANDS.map((c) => c.name);
|
|
8135
|
+
function findCommand(name) {
|
|
8136
|
+
return COMMANDS.find((c) => c.name === name);
|
|
7625
8137
|
}
|
|
7626
|
-
|
|
7627
|
-
const
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
operation
|
|
7633
|
-
});
|
|
7634
|
-
if (!result.ok) {
|
|
7635
|
-
const out = { ok: false, code: result.code, message: result.message };
|
|
7636
|
-
if (result.hint !== void 0) out.hint = result.hint;
|
|
7637
|
-
return out;
|
|
7638
|
-
}
|
|
7639
|
-
const raw = result.classification.raw ?? "";
|
|
7640
|
-
const errors = responseErrors(raw);
|
|
7641
|
-
if (errors !== null) {
|
|
7642
|
-
return { ok: false, code: "INVALID_INPUT", message: `LinkedIn refused it: ${errors}` };
|
|
8138
|
+
function helpText() {
|
|
8139
|
+
const lines = ["lnrelay \u2014 deep research over LinkedIn from your own account", "", "Commands:"];
|
|
8140
|
+
const width = Math.max(...commandNames.map((n) => n.length));
|
|
8141
|
+
for (const c of COMMANDS) {
|
|
8142
|
+
const flag = c.implemented ? " " : "\xB7";
|
|
8143
|
+
lines.push(` ${flag} ${c.name.padEnd(width)} ${c.summary} [${c.cost}]`);
|
|
7643
8144
|
}
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
const r = await sendAction(form.save, body, client, "profile-save");
|
|
7648
|
-
return typeof r === "string" ? { ok: true } : r;
|
|
8145
|
+
lines.push("", " \xB7 = specified in docs/DESIGN.md, not yet implemented");
|
|
8146
|
+
lines.push("", "Run `lnrelay <command> --help` for usage.");
|
|
8147
|
+
return lines.join("\n");
|
|
7649
8148
|
}
|
|
7650
8149
|
|
|
7651
8150
|
// src/engine/sdui-position.ts
|
|
@@ -7657,19 +8156,19 @@ var POSITION = {
|
|
|
7657
8156
|
save: "com.linkedin.sdui.requests.profile.saveProfilePositionForm",
|
|
7658
8157
|
delete: "com.linkedin.sdui.requests.profile.deleteProfilePositionForm"
|
|
7659
8158
|
};
|
|
7660
|
-
var
|
|
8159
|
+
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
7661
8160
|
function listPositions(stream) {
|
|
7662
|
-
if (readModel(stream) === null && !stream.includes(
|
|
7663
|
-
return
|
|
8161
|
+
if (readModel(stream) === null && !stream.includes(EDIT_NAV2) && !stream.includes('"rows"')) {
|
|
8162
|
+
return drift11("the Experience screen could not be read");
|
|
7664
8163
|
}
|
|
7665
8164
|
const positions = [];
|
|
7666
8165
|
const seen = /* @__PURE__ */ new Set();
|
|
7667
8166
|
let i = 0;
|
|
7668
8167
|
for (; ; ) {
|
|
7669
|
-
i = stream.indexOf(
|
|
8168
|
+
i = stream.indexOf(EDIT_NAV2, i);
|
|
7670
8169
|
if (i === -1) break;
|
|
7671
8170
|
const text6 = balanced(stream, i);
|
|
7672
|
-
i +=
|
|
8171
|
+
i += EDIT_NAV2.length;
|
|
7673
8172
|
if (text6 === null) continue;
|
|
7674
8173
|
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
7675
8174
|
const id = payload?.positionId;
|
|
@@ -7678,17 +8177,17 @@ function listPositions(stream) {
|
|
|
7678
8177
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
7679
8178
|
}
|
|
7680
8179
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
7681
|
-
return
|
|
8180
|
+
return drift11("the Experience screen listed no roles and did not look like one");
|
|
7682
8181
|
}
|
|
7683
8182
|
return { ok: true, positions };
|
|
7684
8183
|
}
|
|
7685
8184
|
function readPositionForm(stream) {
|
|
7686
8185
|
const model = readModel(stream);
|
|
7687
|
-
if (model === null) return
|
|
8186
|
+
if (model === null) return drift11("the position form carried no initial values");
|
|
7688
8187
|
const media = findRequest(stream, POSITION.media);
|
|
7689
8188
|
const prefix = media?.payload.formIdPrefix;
|
|
7690
8189
|
if (media === null || typeof prefix !== "string") {
|
|
7691
|
-
return
|
|
8190
|
+
return drift11("the position form carried no save step (uploadPositionMedia)");
|
|
7692
8191
|
}
|
|
7693
8192
|
const del = findRequest(stream, POSITION.delete);
|
|
7694
8193
|
return {
|
|
@@ -7739,7 +8238,7 @@ function applyChanges(form, changes) {
|
|
|
7739
8238
|
}
|
|
7740
8239
|
need("dynamicallyCreateHeadline", false);
|
|
7741
8240
|
need("allowProfileEditBroadcasts", changes.notify === true);
|
|
7742
|
-
if (missing.length > 0) return
|
|
8241
|
+
if (missing.length > 0) return drift11(`the position form has no ${missing.join(", ")} field`);
|
|
7743
8242
|
const s = roleSummary(model);
|
|
7744
8243
|
if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
|
|
7745
8244
|
return {
|
|
@@ -7784,7 +8283,7 @@ function mediaBody(form, model) {
|
|
|
7784
8283
|
}
|
|
7785
8284
|
function saveFromReply(reply) {
|
|
7786
8285
|
const args = findRequest(reply, POSITION.save);
|
|
7787
|
-
return args === null ?
|
|
8286
|
+
return args === null ? drift11("the media step did not hand back the save action") : { ok: true, args };
|
|
7788
8287
|
}
|
|
7789
8288
|
function positionSaveBody(save, model, screen) {
|
|
7790
8289
|
const sending = new Map(model);
|
|
@@ -7796,7 +8295,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
7796
8295
|
}
|
|
7797
8296
|
function deleteBody(form) {
|
|
7798
8297
|
if (form.del === null)
|
|
7799
|
-
return
|
|
8298
|
+
return drift11("this form has no delete action (it is not an existing role)");
|
|
7800
8299
|
const states2 = wireStates(keysOf(form.del), form.model, resolver);
|
|
7801
8300
|
if (!Array.isArray(states2)) return states2;
|
|
7802
8301
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
|
|
@@ -8908,10 +9407,10 @@ function sharePlan(p) {
|
|
|
8908
9407
|
transport: p.transport
|
|
8909
9408
|
};
|
|
8910
9409
|
}
|
|
8911
|
-
function cardLines(
|
|
8912
|
-
if (
|
|
8913
|
-
if (
|
|
8914
|
-
return [`card "${
|
|
9410
|
+
function cardLines(card2) {
|
|
9411
|
+
if (card2 === void 0) return [];
|
|
9412
|
+
if (card2 === null) return ["card none \u2014 LinkedIn has no preview for this link"];
|
|
9413
|
+
return [`card "${card2.title}" (${card2.source})`];
|
|
8915
9414
|
}
|
|
8916
9415
|
var liveCardLookup = (url, session) => fetchLinkCard(url, createLiveClient(session));
|
|
8917
9416
|
function shareNeeds(files, scheduledAt, poll, cardUrl) {
|
|
@@ -9032,8 +9531,8 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9032
9531
|
const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
|
|
9033
9532
|
const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
|
|
9034
9533
|
if ("ok" in ctx) return ctx;
|
|
9035
|
-
const
|
|
9036
|
-
if (
|
|
9534
|
+
const card2 = await cardFor(cardUrl, ctx.transport, link);
|
|
9535
|
+
if (card2 !== void 0 && card2 !== null && "ok" in card2) return card2;
|
|
9037
9536
|
const plan = sharePlan({
|
|
9038
9537
|
author: authorLine(ctx.transport),
|
|
9039
9538
|
transport: ctx.transport.kind,
|
|
@@ -9042,7 +9541,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9042
9541
|
media: loaded?.approved,
|
|
9043
9542
|
scheduledAt,
|
|
9044
9543
|
poll: pollSpec,
|
|
9045
|
-
...
|
|
9544
|
+
...card2 === void 0 ? {} : { card: card2 },
|
|
9046
9545
|
now
|
|
9047
9546
|
});
|
|
9048
9547
|
const gated = await gate("share", plan, ctx, deps);
|
|
@@ -9802,149 +10301,6 @@ async function runFindFilters(kind, req, opts = {}, fetch2) {
|
|
|
9802
10301
|
});
|
|
9803
10302
|
}
|
|
9804
10303
|
|
|
9805
|
-
// src/engine/sdui-skill.ts
|
|
9806
|
-
var SKILL = {
|
|
9807
|
-
addScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillAddForm",
|
|
9808
|
-
editScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetailsEditForm",
|
|
9809
|
-
listScreen: "com.linkedin.sdui.flagshipnav.profile.ProfileSkillDetails",
|
|
9810
|
-
pager: "com.linkedin.sdui.pagers.profile.details.skills",
|
|
9811
|
-
save: "com.linkedin.sdui.requests.profile.saveProfileSkillForm",
|
|
9812
|
-
delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
|
|
9813
|
-
};
|
|
9814
|
-
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
|
|
9815
|
-
var TEXT3 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
9816
|
-
function skillsFromPage(stream) {
|
|
9817
|
-
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
|
|
9818
|
-
return drift9("the skills page could not be read");
|
|
9819
|
-
}
|
|
9820
|
-
const skills = [];
|
|
9821
|
-
let from = 0;
|
|
9822
|
-
let i = 0;
|
|
9823
|
-
for (; ; ) {
|
|
9824
|
-
i = stream.indexOf(EDIT_NAV2, i);
|
|
9825
|
-
if (i === -1) break;
|
|
9826
|
-
const text6 = balanced(stream, i);
|
|
9827
|
-
const end = i;
|
|
9828
|
-
i += EDIT_NAV2.length;
|
|
9829
|
-
if (text6 === null) continue;
|
|
9830
|
-
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
9831
|
-
const id = payload?.skillId;
|
|
9832
|
-
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
9833
|
-
continue;
|
|
9834
|
-
const names = [...stream.slice(from, end).matchAll(TEXT3)].map(
|
|
9835
|
-
(m) => JSON.parse(`"${m[1]}"`)
|
|
9836
|
-
);
|
|
9837
|
-
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
9838
|
-
from = end + text6.length;
|
|
9839
|
-
}
|
|
9840
|
-
return { ok: true, skills };
|
|
9841
|
-
}
|
|
9842
|
-
function pagerFrom(payload, start) {
|
|
9843
|
-
const args = {
|
|
9844
|
-
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
9845
|
-
requestedStateKeys: [],
|
|
9846
|
-
payload: { ...payload, start },
|
|
9847
|
-
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
9848
|
-
};
|
|
9849
|
-
return {
|
|
9850
|
-
pagerId: SKILL.pager,
|
|
9851
|
-
clientArguments: { ...args, states: [], screenId: SKILL.listScreen, knownTemplateIds: [] },
|
|
9852
|
-
paginationRequest: {
|
|
9853
|
-
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
9854
|
-
pagerId: SKILL.pager,
|
|
9855
|
-
retryCount: 0,
|
|
9856
|
-
requestedArguments: args
|
|
9857
|
-
}
|
|
9858
|
-
};
|
|
9859
|
-
}
|
|
9860
|
-
function readSkillForm(stream) {
|
|
9861
|
-
const model = readModel(stream);
|
|
9862
|
-
if (model === null) return drift9("the skill form carried no initial values");
|
|
9863
|
-
const save = findRequest(stream, SKILL.save);
|
|
9864
|
-
const del = findRequest(stream, SKILL.delete);
|
|
9865
|
-
if (save === null && del === null)
|
|
9866
|
-
return drift9("the skill form carried neither a save nor a delete");
|
|
9867
|
-
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
9868
|
-
}
|
|
9869
|
-
var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
|
|
9870
|
-
function skillNameOf(form) {
|
|
9871
|
-
const key = nameKey(form.model);
|
|
9872
|
-
const v = key === void 0 ? void 0 : form.model.get(key)?.value;
|
|
9873
|
-
return typeof v === "string" ? v : null;
|
|
9874
|
-
}
|
|
9875
|
-
function addSkillBody(form, name) {
|
|
9876
|
-
if (name.trim() === "")
|
|
9877
|
-
return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
|
|
9878
|
-
if (form.save === null) return drift9("this form has no save action (it is not the add form)");
|
|
9879
|
-
const key = nameKey(form.model);
|
|
9880
|
-
const current = key === void 0 ? void 0 : form.model.get(key);
|
|
9881
|
-
if (key === void 0 || current === void 0) return drift9("the skill form has no name field");
|
|
9882
|
-
const model = new Map(form.model);
|
|
9883
|
-
model.set(key, { ...current, value: name.trim() });
|
|
9884
|
-
const states2 = wireStates(keysOf(form.save), model, () => void 0);
|
|
9885
|
-
if (!Array.isArray(states2)) return states2;
|
|
9886
|
-
return { ok: true, body: requestBody(SKILL.save, form.save, states2, form.screen) };
|
|
9887
|
-
}
|
|
9888
|
-
function removeSkillBody(form) {
|
|
9889
|
-
if (form.del === null)
|
|
9890
|
-
return drift9("this form has no delete action (it is not an existing skill)");
|
|
9891
|
-
const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
|
|
9892
|
-
if (!Array.isArray(states2)) return states2;
|
|
9893
|
-
return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
|
|
9894
|
-
}
|
|
9895
|
-
var PAGER_URL2 = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${SKILL.pager}`;
|
|
9896
|
-
var MAX_PAGES2 = 10;
|
|
9897
|
-
async function fetchSkills(vanityName, client) {
|
|
9898
|
-
const screen = await openForm(
|
|
9899
|
-
SKILL.listScreen,
|
|
9900
|
-
{ vanityName, isVanityNameResolved: true },
|
|
9901
|
-
client,
|
|
9902
|
-
"skills-screen"
|
|
9903
|
-
);
|
|
9904
|
-
if (typeof screen !== "string") return screen;
|
|
9905
|
-
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
9906
|
-
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
9907
|
-
const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
9908
|
-
if (text6 === null) return drift9("the Skills screen carried no list request");
|
|
9909
|
-
const payload = JSON.parse(text6);
|
|
9910
|
-
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
9911
|
-
const skills = [];
|
|
9912
|
-
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
9913
|
-
const result = await client.request({
|
|
9914
|
-
url: PAGER_URL2,
|
|
9915
|
-
method: "POST",
|
|
9916
|
-
body: pagerFrom(payload, skills.length),
|
|
9917
|
-
spendClass: "page",
|
|
9918
|
-
operation: "skills"
|
|
9919
|
-
});
|
|
9920
|
-
if (!result.ok) return { ok: false, code: result.code, message: result.message };
|
|
9921
|
-
const parsed = skillsFromPage(result.classification.raw ?? "");
|
|
9922
|
-
if (!parsed.ok) return parsed;
|
|
9923
|
-
const fresh = parsed.skills.filter((s) => !skills.some((k) => k.skillId === s.skillId));
|
|
9924
|
-
skills.push(...fresh);
|
|
9925
|
-
if (parsed.skills.length < count3 || fresh.length === 0) break;
|
|
9926
|
-
}
|
|
9927
|
-
return { ok: true, skills };
|
|
9928
|
-
}
|
|
9929
|
-
async function openSkillForm(payload, client, edit2) {
|
|
9930
|
-
const stream = await openForm(
|
|
9931
|
-
edit2 ? SKILL.editScreen : SKILL.addScreen,
|
|
9932
|
-
{ ...payload, isVanityNameResolved: true },
|
|
9933
|
-
client,
|
|
9934
|
-
edit2 ? "skill-edit-form" : "skill-add-form"
|
|
9935
|
-
);
|
|
9936
|
-
return typeof stream === "string" ? readSkillForm(stream) : stream;
|
|
9937
|
-
}
|
|
9938
|
-
async function sendSkill(body, requestId, client) {
|
|
9939
|
-
const sent = await sendAction(
|
|
9940
|
-
requestId,
|
|
9941
|
-
body,
|
|
9942
|
-
client,
|
|
9943
|
-
requestId === SKILL.save ? "skill-add" : "skill-remove"
|
|
9944
|
-
);
|
|
9945
|
-
return typeof sent === "string" ? { ok: true } : sent;
|
|
9946
|
-
}
|
|
9947
|
-
|
|
9948
10304
|
// src/commands/skill.ts
|
|
9949
10305
|
function liveSkills(session, quiet = false) {
|
|
9950
10306
|
const client = createLiveClient(session, void 0, quiet);
|
|
@@ -10255,22 +10611,22 @@ function viewTotalsBody() {
|
|
|
10255
10611
|
detailsCardResultCount: 23
|
|
10256
10612
|
});
|
|
10257
10613
|
}
|
|
10258
|
-
var
|
|
10259
|
-
var
|
|
10260
|
-
var
|
|
10614
|
+
var drift12 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
10615
|
+
var unquote4 = (s) => JSON.parse(`"${s}"`);
|
|
10616
|
+
var STR2 = '((?:[^"\\\\]|\\\\.)+)';
|
|
10261
10617
|
var ITEM = /"viewName":"viewer-list-item"(?:,"impressionThresholds":\[[^\]]*\])?[^{}]*"semanticPosition"/;
|
|
10262
10618
|
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)","lineHeight":"[^"]*","textAlign":"[^"]*","children":/g;
|
|
10263
|
-
var OWN_TEXT = new RegExp(`^\\["${
|
|
10264
|
-
var NESTED_TEXT = new RegExp(`\\[null,"${
|
|
10265
|
-
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${
|
|
10619
|
+
var OWN_TEXT = new RegExp(`^\\["${STR2}"\\]`);
|
|
10620
|
+
var NESTED_TEXT = new RegExp(`\\[null,"${STR2}"`);
|
|
10621
|
+
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${STR2}"`);
|
|
10266
10622
|
var PROFILE_ID2 = /ACoA[A-Za-z0-9_-]{10,}/;
|
|
10267
|
-
var PLAIN_TEXT = new RegExp(`"children":\\["${
|
|
10623
|
+
var PLAIN_TEXT = new RegExp(`"children":\\["${STR2}"\\]`, "g");
|
|
10268
10624
|
function textsOf(row) {
|
|
10269
10625
|
return [...row.matchAll(TEXT_PROPS)].flatMap((m) => {
|
|
10270
10626
|
const after = row.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 600);
|
|
10271
10627
|
const raw = after.match(OWN_TEXT)?.[1] ?? after.match(NESTED_TEXT)?.[1];
|
|
10272
10628
|
if (raw === void 0) return [];
|
|
10273
|
-
const text6 =
|
|
10629
|
+
const text6 = unquote4(raw).trim();
|
|
10274
10630
|
return text6 === "" ? [] : [{ size: m[1], weight: m[2], text: text6 }];
|
|
10275
10631
|
});
|
|
10276
10632
|
}
|
|
@@ -10284,7 +10640,7 @@ function viewerOf(row, id) {
|
|
|
10284
10640
|
const lines = rest.filter((t) => t !== degreeText);
|
|
10285
10641
|
const viewed = lines.at(-1);
|
|
10286
10642
|
const link = row.match(LINK2)?.[1];
|
|
10287
|
-
const url = link === void 0 ? void 0 :
|
|
10643
|
+
const url = link === void 0 ? void 0 : unquote4(link);
|
|
10288
10644
|
if (url === void 0 || !/linkedin\.com\/in\//.test(url)) {
|
|
10289
10645
|
const v = { anonymous: true, description: first };
|
|
10290
10646
|
if (viewed !== void 0) v.viewed = viewed;
|
|
@@ -10302,7 +10658,7 @@ function viewerOf(row, id) {
|
|
|
10302
10658
|
...viewed !== void 0 ? { viewed } : {}
|
|
10303
10659
|
};
|
|
10304
10660
|
}
|
|
10305
|
-
var
|
|
10661
|
+
var REF2 = /"\$[LQ]?([0-9a-f]+)"/g;
|
|
10306
10662
|
function idUnder(rows, ref, items) {
|
|
10307
10663
|
const seen = /* @__PURE__ */ new Set([ref]);
|
|
10308
10664
|
const queue = [ref];
|
|
@@ -10310,7 +10666,7 @@ function idUnder(rows, ref, items) {
|
|
|
10310
10666
|
const row = rows.byId.get(queue.shift()) ?? "";
|
|
10311
10667
|
const id = row.match(PROFILE_ID2)?.[0];
|
|
10312
10668
|
if (id !== void 0) return id;
|
|
10313
|
-
for (const m of row.matchAll(
|
|
10669
|
+
for (const m of row.matchAll(REF2)) {
|
|
10314
10670
|
const next = m[1];
|
|
10315
10671
|
if (!seen.has(next) && !items.has(next) && rows.byId.has(next)) {
|
|
10316
10672
|
seen.add(next);
|
|
@@ -10324,7 +10680,7 @@ function idsByViewer(rows, items) {
|
|
|
10324
10680
|
const ids = /* @__PURE__ */ new Map();
|
|
10325
10681
|
for (const row of rows.byId.values()) {
|
|
10326
10682
|
let current;
|
|
10327
|
-
for (const m of row.matchAll(
|
|
10683
|
+
for (const m of row.matchAll(REF2)) {
|
|
10328
10684
|
const ref = m[1];
|
|
10329
10685
|
if (items.has(ref)) current = ref;
|
|
10330
10686
|
else if (current !== void 0 && !ids.has(current)) {
|
|
@@ -10337,19 +10693,19 @@ function idsByViewer(rows, items) {
|
|
|
10337
10693
|
}
|
|
10338
10694
|
function parseViewers(stream) {
|
|
10339
10695
|
if (!stream.includes('"viewName":"viewer-list"'))
|
|
10340
|
-
return
|
|
10696
|
+
return drift12("the profile viewers answer was not the viewer list");
|
|
10341
10697
|
const rows = new Rows(stream);
|
|
10342
10698
|
const items = new Set([...rows.byId].filter(([, row]) => ITEM.test(row)).map(([id]) => id));
|
|
10343
10699
|
const ids = idsByViewer(rows, items);
|
|
10344
10700
|
const viewers = [...items].flatMap((id) => viewerOf(rows.byId.get(id) ?? "", ids.get(id)) ?? []);
|
|
10345
10701
|
const shown = Math.max(items.size, (stream.match(new RegExp(ITEM, "g")) ?? []).length);
|
|
10346
10702
|
if (shown > 0 && viewers.length === 0)
|
|
10347
|
-
return
|
|
10703
|
+
return drift12(`${shown} profile viewers were shown but none could be read`);
|
|
10348
10704
|
let privateViewers;
|
|
10349
10705
|
for (const [id, row] of rows.byId) {
|
|
10350
10706
|
if (items.has(id) || privateViewers !== void 0) continue;
|
|
10351
10707
|
for (const m of row.matchAll(PLAIN_TEXT)) {
|
|
10352
|
-
const n =
|
|
10708
|
+
const n = unquote4(m[1]).match(/^(\d[\d.,\s]*)\s+\D/)?.[1];
|
|
10353
10709
|
if (n !== void 0) {
|
|
10354
10710
|
privateViewers = Number(n.replace(/\D/g, ""));
|
|
10355
10711
|
break;
|
|
@@ -10359,16 +10715,16 @@ function parseViewers(stream) {
|
|
|
10359
10715
|
return privateViewers === void 0 ? { ok: true, viewers } : { ok: true, viewers, privateViewers };
|
|
10360
10716
|
}
|
|
10361
10717
|
function parseViewTotals(stream) {
|
|
10362
|
-
const texts3 = [...stream.matchAll(PLAIN_TEXT)].map((m) =>
|
|
10718
|
+
const texts3 = [...stream.matchAll(PLAIN_TEXT)].map((m) => unquote4(m[1]).trim());
|
|
10363
10719
|
const at = texts3.findIndex((t) => /^\d[\d.,\s]*$/.test(t));
|
|
10364
|
-
if (at === -1) return
|
|
10720
|
+
if (at === -1) return drift12("the profile view totals carried no number");
|
|
10365
10721
|
const total = Number(texts3[at].replace(/\D/g, ""));
|
|
10366
10722
|
const period = texts3[at + 1];
|
|
10367
10723
|
return period === void 0 ? { ok: true, total } : { ok: true, total, period };
|
|
10368
10724
|
}
|
|
10369
10725
|
|
|
10370
10726
|
// src/commands/viewers.ts
|
|
10371
|
-
function
|
|
10727
|
+
function liveFetch10(quiet) {
|
|
10372
10728
|
const session = loadSession();
|
|
10373
10729
|
if (session.state !== "ok")
|
|
10374
10730
|
return err("viewers", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
@@ -10381,7 +10737,7 @@ function liveFetch9(quiet) {
|
|
|
10381
10737
|
}
|
|
10382
10738
|
var compactViewer = (v) => "anonymous" in v ? line(["anonymous", v.description, v.viewed]) : line([v.name, v.degree, v.headline, v.viewed, v.url]);
|
|
10383
10739
|
async function runViewers(opts = {}, fetch2) {
|
|
10384
|
-
const get = fetch2 ??
|
|
10740
|
+
const get = fetch2 ?? liveFetch10(opts.quiet === true);
|
|
10385
10741
|
if (typeof get !== "function") return get;
|
|
10386
10742
|
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(), "page");
|
|
10387
10743
|
const totals = totalsRes.ok ? parseViewTotals(totalsRes.raw) : totalsRes;
|
|
@@ -10773,7 +11129,10 @@ async function dispatch(argv, now) {
|
|
|
10773
11129
|
return runWhoami(bool(args, "raw"));
|
|
10774
11130
|
case "profile":
|
|
10775
11131
|
return runProfile(args.positionals[0], output(args), void 0, {
|
|
10776
|
-
contact: bool(args, "contact")
|
|
11132
|
+
contact: bool(args, "contact"),
|
|
11133
|
+
skills: bool(args, "skills"),
|
|
11134
|
+
recommendations: bool(args, "recommendations"),
|
|
11135
|
+
...num(args, "posts") !== void 0 ? { posts: num(args, "posts") } : {}
|
|
10777
11136
|
});
|
|
10778
11137
|
case "feed":
|
|
10779
11138
|
return runFeed(num(args, "limit") ?? 10, output(args));
|
|
@@ -10793,6 +11152,11 @@ async function dispatch(argv, now) {
|
|
|
10793
11152
|
return runPeopleFilters(peopleRequest(args), output(args));
|
|
10794
11153
|
case "viewers":
|
|
10795
11154
|
return runViewers(output(args));
|
|
11155
|
+
case "notifications":
|
|
11156
|
+
return runNotifications(
|
|
11157
|
+
{ limit: num(args, "limit") ?? 25, ...bool(args, "unread") ? { unread: true } : {} },
|
|
11158
|
+
output(args)
|
|
11159
|
+
);
|
|
10796
11160
|
case "events":
|
|
10797
11161
|
case "event":
|
|
10798
11162
|
case "company":
|