linkedin-relay-mcp 3.20.0 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/linkedin-relay/SKILL.md +24 -7
- package/README.md +1 -1
- package/dist/cli.js +586 -205
- package/dist/cli.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +540 -146
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -88,13 +88,13 @@ function loadJson(path) {
|
|
|
88
88
|
}
|
|
89
89
|
function quarantine(path, reason) {
|
|
90
90
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
91
|
-
const
|
|
91
|
+
const target2 = cachePath("quarantine", stamp, path.split("/").pop() ?? "file");
|
|
92
92
|
try {
|
|
93
|
-
mkdirSync(dirname(
|
|
94
|
-
renameSync(path,
|
|
93
|
+
mkdirSync(dirname(target2), { recursive: true });
|
|
94
|
+
renameSync(path, target2);
|
|
95
95
|
} catch {
|
|
96
96
|
}
|
|
97
|
-
return { state: "corrupt", quarantinedTo:
|
|
97
|
+
return { state: "corrupt", quarantinedTo: target2, reason };
|
|
98
98
|
}
|
|
99
99
|
function saveJson(path, value) {
|
|
100
100
|
mkdirSync(dirname(path), { recursive: true });
|
|
@@ -249,10 +249,10 @@ function loadApprovalMode() {
|
|
|
249
249
|
function setToken(mode) {
|
|
250
250
|
return confirmToken("set approval mode", mode);
|
|
251
251
|
}
|
|
252
|
-
function append(
|
|
252
|
+
function append(entry3) {
|
|
253
253
|
const path = cachePath("writes.jsonl");
|
|
254
254
|
mkdirSync2(dirname2(path), { recursive: true });
|
|
255
|
-
appendFileSync(path, `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...
|
|
255
|
+
appendFileSync(path, `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...entry3 })}
|
|
256
256
|
`, {
|
|
257
257
|
mode: 384
|
|
258
258
|
});
|
|
@@ -394,15 +394,15 @@ function migrate(db) {
|
|
|
394
394
|
}
|
|
395
395
|
function quarantine2(path, reason, now) {
|
|
396
396
|
const stamp = new Date(now).toISOString().replace(/[:.]/g, "-");
|
|
397
|
-
const
|
|
397
|
+
const target2 = cachePath("quarantine", stamp, DB_FILE);
|
|
398
398
|
try {
|
|
399
399
|
mkdirSync3(cachePath("quarantine", stamp), { recursive: true });
|
|
400
|
-
renameSync2(path,
|
|
400
|
+
renameSync2(path, target2);
|
|
401
401
|
} catch {
|
|
402
402
|
}
|
|
403
403
|
return new CacheCorrupt(
|
|
404
404
|
`the local cache was unreadable and has been quarantined: ${reason}`,
|
|
405
|
-
|
|
405
|
+
target2
|
|
406
406
|
);
|
|
407
407
|
}
|
|
408
408
|
function sweepExpired(db, now = Date.now()) {
|
|
@@ -664,26 +664,6 @@ function deref(node, key, index) {
|
|
|
664
664
|
}
|
|
665
665
|
return void 0;
|
|
666
666
|
}
|
|
667
|
-
function shapeProfile(node, index) {
|
|
668
|
-
const base = shapeMember(node);
|
|
669
|
-
const geo = deref(node, "geoLocation", index);
|
|
670
|
-
const position = deref(node, "profileTopPosition", index) ?? firstOfType(index, "profile.Position");
|
|
671
|
-
const education = deref(node, "profileTopEducation", index) ?? firstOfType(index, "profile.Education");
|
|
672
|
-
return defined({
|
|
673
|
-
...base,
|
|
674
|
-
location: text(geo?.defaultLocalizedName) ?? text(geo?.localizedName),
|
|
675
|
-
title: text(position?.title),
|
|
676
|
-
company: text(position?.companyName),
|
|
677
|
-
school: text(education?.schoolName)
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
function firstOfType(index, suffix) {
|
|
681
|
-
if (index === void 0) return void 0;
|
|
682
|
-
for (const node of new Set(index.values())) {
|
|
683
|
-
if (String(node.$type ?? "").endsWith(suffix)) return node;
|
|
684
|
-
}
|
|
685
|
-
return void 0;
|
|
686
|
-
}
|
|
687
667
|
function shapeMember(node) {
|
|
688
668
|
const first = text(node.firstName);
|
|
689
669
|
const last = text(node.lastName);
|
|
@@ -861,14 +841,14 @@ function runSourceRead(command, query, limit, opts = {}) {
|
|
|
861
841
|
return ok(command, data);
|
|
862
842
|
}
|
|
863
843
|
function runPurge(scope, confirmed) {
|
|
864
|
-
const
|
|
844
|
+
const target2 = scope === "all" ? "all" : "third-party";
|
|
865
845
|
if (!confirmed) {
|
|
866
846
|
try {
|
|
867
847
|
const db = openDb();
|
|
868
848
|
return err(
|
|
869
849
|
"purge",
|
|
870
850
|
"CONFIRMATION_REQUIRED",
|
|
871
|
-
`would delete ${
|
|
851
|
+
`would delete ${target2 === "all" ? count(db) : count(db, "third-party")} records (${target2})`,
|
|
872
852
|
"Re-run with --confirm. This only touches local files; it never contacts LinkedIn."
|
|
873
853
|
);
|
|
874
854
|
} catch (e) {
|
|
@@ -877,8 +857,8 @@ function runPurge(scope, confirmed) {
|
|
|
877
857
|
}
|
|
878
858
|
try {
|
|
879
859
|
const db = openDb();
|
|
880
|
-
const removed = purge(db,
|
|
881
|
-
return ok("purge", { scope:
|
|
860
|
+
const removed = purge(db, target2);
|
|
861
|
+
return ok("purge", { scope: target2, removed, remaining: count(db) });
|
|
882
862
|
} catch (e) {
|
|
883
863
|
return corruptEnvelope("purge", e);
|
|
884
864
|
}
|
|
@@ -928,9 +908,9 @@ var CONTRACTS = {
|
|
|
928
908
|
// e9b08094… the real profile: headline, geo, top position, education. ← this
|
|
929
909
|
// da93c92b… 400s with (profileUrn:…); its variables shape is unknown.
|
|
930
910
|
//
|
|
931
|
-
// None of them returns firstName/lastName/publicIdentifier
|
|
932
|
-
//
|
|
933
|
-
//
|
|
911
|
+
// None of them returns firstName/lastName/publicIdentifier. Since 2026-10-16
|
|
912
|
+
// `lnrelay profile` reads `fullProfile` below instead, which has the name
|
|
913
|
+
// and every section; this one stays recorded for the projection trap.
|
|
934
914
|
profile: {
|
|
935
915
|
name: "profile",
|
|
936
916
|
transport: "voyager-graphql",
|
|
@@ -1025,6 +1005,27 @@ var CONTRACTS = {
|
|
|
1025
1005
|
provenance: "verified",
|
|
1026
1006
|
capturedAt: "2026-08-02"
|
|
1027
1007
|
},
|
|
1008
|
+
// A profile in full, probed 2026-10-16: name, About and every section, each
|
|
1009
|
+
// a collection in `included`. It holds the first 10 position groups and 20
|
|
1010
|
+
// skills; the rest of the experience pages through `profilePositions`
|
|
1011
|
+
// (32 of 32 in two calls). Skills did not page (profileSkills answered 400).
|
|
1012
|
+
// See engine/full-profile.ts.
|
|
1013
|
+
fullProfile: {
|
|
1014
|
+
name: "fullProfile",
|
|
1015
|
+
transport: "voyager-restli",
|
|
1016
|
+
path: `${VOYAGER}/identity/dash/profiles`,
|
|
1017
|
+
decorationId: "com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-93",
|
|
1018
|
+
provenance: "verified",
|
|
1019
|
+
capturedAt: "2026-10-16"
|
|
1020
|
+
},
|
|
1021
|
+
profilePositions: {
|
|
1022
|
+
name: "profilePositions",
|
|
1023
|
+
transport: "voyager-restli",
|
|
1024
|
+
path: `${VOYAGER}/identity/dash/profilePositionGroups`,
|
|
1025
|
+
decorationId: "com.linkedin.voyager.dash.deco.identity.profile.FullProfilePositionGroup-50",
|
|
1026
|
+
provenance: "verified",
|
|
1027
|
+
capturedAt: "2026-10-16"
|
|
1028
|
+
},
|
|
1028
1029
|
// A company page, captured 2026-10-14. The GraphQL company query by
|
|
1029
1030
|
// universalName answers only the company's urn, so this is the REST
|
|
1030
1031
|
// resource: by id (`/<id>`) or by name (`q=universalName`). It carries the
|
|
@@ -1156,8 +1157,8 @@ function address(a) {
|
|
|
1156
1157
|
const line2 = parts.filter(Boolean).join(", ");
|
|
1157
1158
|
return line2 === "" ? void 0 : line2;
|
|
1158
1159
|
}
|
|
1159
|
-
function sizeOf(
|
|
1160
|
-
const r =
|
|
1160
|
+
function sizeOf(range2) {
|
|
1161
|
+
const r = range2;
|
|
1161
1162
|
if (typeof r?.start !== "number") return void 0;
|
|
1162
1163
|
const n = (x) => x.toLocaleString("en-US");
|
|
1163
1164
|
return typeof r.end === "number" ? `${n(r.start)}-${n(r.end)}` : `${n(r.start)}+`;
|
|
@@ -1815,35 +1816,20 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1815
1816
|
const client = createLiveClient(session, deps, quiet);
|
|
1816
1817
|
return {
|
|
1817
1818
|
async whoami() {
|
|
1818
|
-
const
|
|
1819
|
-
if (
|
|
1819
|
+
const contract4 = contractFor("me");
|
|
1820
|
+
if (contract4 === void 0) return missingContract("me");
|
|
1820
1821
|
const res = await client.request({
|
|
1821
|
-
url:
|
|
1822
|
+
url: contract4.path,
|
|
1822
1823
|
spendClass: "profile",
|
|
1823
1824
|
operation: "me"
|
|
1824
1825
|
});
|
|
1825
1826
|
if (!res.ok) return res;
|
|
1826
1827
|
return { ok: true, value: parseSingle(res.json) };
|
|
1827
1828
|
},
|
|
1828
|
-
async profile(memberId) {
|
|
1829
|
-
const contract3 = contractFor("profile");
|
|
1830
|
-
if (contract3 === void 0) return missingContract("profile");
|
|
1831
|
-
const variables = encodeVariables({ memberIdentity: memberId });
|
|
1832
|
-
const url = `${contract3.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract3.queryId}`;
|
|
1833
|
-
const res = await client.request({ url, spendClass: "profile", operation: "profile" });
|
|
1834
|
-
if (!res.ok) return res;
|
|
1835
|
-
const envelope = res.json;
|
|
1836
|
-
const index = indexIncluded(envelope.included);
|
|
1837
|
-
const profile = [...new Set(index.values())].find(
|
|
1838
|
-
(n) => String(n.$type ?? "").endsWith("profile.Profile")
|
|
1839
|
-
);
|
|
1840
|
-
if (profile === void 0) return { ok: true, value: void 0 };
|
|
1841
|
-
return { ok: true, value: { profile, index } };
|
|
1842
|
-
},
|
|
1843
1829
|
async feed(limit) {
|
|
1844
|
-
const
|
|
1845
|
-
if (
|
|
1846
|
-
const url = `${
|
|
1830
|
+
const contract4 = contractFor("feed");
|
|
1831
|
+
if (contract4 === void 0) return missingContract("feed");
|
|
1832
|
+
const url = `${contract4.path}?q=chronFeed&count=${limit}&start=0`;
|
|
1847
1833
|
const res = await client.request({ url, spendClass: "page", operation: "feed" });
|
|
1848
1834
|
if (!res.ok) return res;
|
|
1849
1835
|
const envelope = res.json;
|
|
@@ -1852,21 +1838,21 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1852
1838
|
value: {
|
|
1853
1839
|
parsed: parseCollection(res.json, {
|
|
1854
1840
|
operation: "feed",
|
|
1855
|
-
contractCapturedAt:
|
|
1841
|
+
contractCapturedAt: contract4.capturedAt
|
|
1856
1842
|
}),
|
|
1857
1843
|
index: indexIncluded(envelope.included)
|
|
1858
1844
|
}
|
|
1859
1845
|
};
|
|
1860
1846
|
},
|
|
1861
1847
|
async myPosts(profileUrn, limit) {
|
|
1862
|
-
const
|
|
1863
|
-
if (
|
|
1848
|
+
const contract4 = contractFor("myPosts");
|
|
1849
|
+
if (contract4 === void 0) return missingContract("myPosts");
|
|
1864
1850
|
const variables = encodeVariables({
|
|
1865
1851
|
count: Math.min(limit, 100),
|
|
1866
1852
|
start: 0,
|
|
1867
1853
|
profileUrn: canonicalUrn(profileUrn)
|
|
1868
1854
|
});
|
|
1869
|
-
const url = `${
|
|
1855
|
+
const url = `${contract4.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract4.queryId}`;
|
|
1870
1856
|
const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
|
|
1871
1857
|
if (!res.ok) return res;
|
|
1872
1858
|
const envelope = res.json;
|
|
@@ -1875,7 +1861,7 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1875
1861
|
value: {
|
|
1876
1862
|
parsed: parseCollection(res.json, {
|
|
1877
1863
|
operation: "myPosts",
|
|
1878
|
-
contractCapturedAt:
|
|
1864
|
+
contractCapturedAt: contract4.capturedAt,
|
|
1879
1865
|
truncated: true
|
|
1880
1866
|
}),
|
|
1881
1867
|
index: indexIncluded(envelope.included)
|
|
@@ -1888,8 +1874,8 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1888
1874
|
* snapshot and diffs, rather than pretending a watermark exists.
|
|
1889
1875
|
*/
|
|
1890
1876
|
async connections(limit) {
|
|
1891
|
-
const
|
|
1892
|
-
if (
|
|
1877
|
+
const contract4 = contractFor("search");
|
|
1878
|
+
if (contract4 === void 0) return missingContract("search");
|
|
1893
1879
|
const variables = encodeVariables({
|
|
1894
1880
|
start: 0,
|
|
1895
1881
|
origin: "FACETED_SEARCH",
|
|
@@ -1902,12 +1888,12 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1902
1888
|
includeFiltersInResponse: false
|
|
1903
1889
|
}
|
|
1904
1890
|
});
|
|
1905
|
-
const url = `${
|
|
1891
|
+
const url = `${contract4.path}?variables=${variables}&queryId=${contract4.queryId}`;
|
|
1906
1892
|
const res = await client.request({ url, spendClass: "search", operation: "connections" });
|
|
1907
1893
|
if (!res.ok) return res;
|
|
1908
1894
|
const parsed = parseCollection(res.json, {
|
|
1909
1895
|
operation: "connections",
|
|
1910
|
-
contractCapturedAt:
|
|
1896
|
+
contractCapturedAt: contract4.capturedAt,
|
|
1911
1897
|
claimedCount: totalResultCount(res.json),
|
|
1912
1898
|
truncated: true
|
|
1913
1899
|
});
|
|
@@ -1917,8 +1903,8 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1917
1903
|
return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
|
|
1918
1904
|
},
|
|
1919
1905
|
async post(postUrn2, limit) {
|
|
1920
|
-
const
|
|
1921
|
-
if (
|
|
1906
|
+
const contract4 = contractFor("comments");
|
|
1907
|
+
if (contract4 === void 0) return missingContract("comments");
|
|
1922
1908
|
const variables = encodeVariables({
|
|
1923
1909
|
count: Math.min(limit, 100),
|
|
1924
1910
|
numReplies: 1,
|
|
@@ -1926,12 +1912,12 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1926
1912
|
sortOrder: "RELEVANCE",
|
|
1927
1913
|
start: 0
|
|
1928
1914
|
});
|
|
1929
|
-
const url = `${
|
|
1915
|
+
const url = `${contract4.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract4.queryId}`;
|
|
1930
1916
|
const res = await client.request({ url, spendClass: "page", operation: "comments" });
|
|
1931
1917
|
if (!res.ok) return res;
|
|
1932
1918
|
const parsed = parseCollection(res.json, {
|
|
1933
1919
|
operation: "comments",
|
|
1934
|
-
contractCapturedAt:
|
|
1920
|
+
contractCapturedAt: contract4.capturedAt,
|
|
1935
1921
|
// A page of many; we follow no cursor yet, so never claim exhaustion.
|
|
1936
1922
|
truncated: true
|
|
1937
1923
|
});
|
|
@@ -1939,27 +1925,27 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1939
1925
|
return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
|
|
1940
1926
|
},
|
|
1941
1927
|
async reactions(postUrn2, limit) {
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1928
|
+
const contract4 = contractFor("reactions");
|
|
1929
|
+
if (contract4 === void 0) return missingContract("reactions");
|
|
1944
1930
|
const variables = encodeVariables({
|
|
1945
1931
|
count: Math.min(limit, 100),
|
|
1946
1932
|
start: 0,
|
|
1947
1933
|
threadUrn: postUrn2
|
|
1948
1934
|
});
|
|
1949
|
-
const url = `${
|
|
1935
|
+
const url = `${contract4.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract4.queryId}`;
|
|
1950
1936
|
const res = await client.request({ url, spendClass: "page", operation: "reactions" });
|
|
1951
1937
|
if (!res.ok) return res;
|
|
1952
1938
|
const parsed = parseCollection(res.json, {
|
|
1953
1939
|
operation: "reactions",
|
|
1954
|
-
contractCapturedAt:
|
|
1940
|
+
contractCapturedAt: contract4.capturedAt,
|
|
1955
1941
|
truncated: true
|
|
1956
1942
|
});
|
|
1957
1943
|
const envelope = res.json;
|
|
1958
1944
|
return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
|
|
1959
1945
|
},
|
|
1960
1946
|
async search(kind, query, limit) {
|
|
1961
|
-
const
|
|
1962
|
-
if (
|
|
1947
|
+
const contract4 = contractFor("search");
|
|
1948
|
+
if (contract4 === void 0) return missingContract("search");
|
|
1963
1949
|
const variables = encodeVariables({
|
|
1964
1950
|
start: 0,
|
|
1965
1951
|
origin: "GLOBAL_SEARCH_HEADER",
|
|
@@ -1970,12 +1956,12 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1970
1956
|
includeFiltersInResponse: false
|
|
1971
1957
|
}
|
|
1972
1958
|
});
|
|
1973
|
-
const url = `${
|
|
1959
|
+
const url = `${contract4.path}?variables=${variables}&queryId=${contract4.queryId}`;
|
|
1974
1960
|
const res = await client.request({ url, spendClass: "search", operation: "search" });
|
|
1975
1961
|
if (!res.ok) return res;
|
|
1976
1962
|
const parsed = parseCollection(res.json, {
|
|
1977
1963
|
operation: "search",
|
|
1978
|
-
contractCapturedAt:
|
|
1964
|
+
contractCapturedAt: contract4.capturedAt,
|
|
1979
1965
|
claimedCount: totalResultCount(res.json),
|
|
1980
1966
|
truncated: true
|
|
1981
1967
|
// one page of many; we never claim exhaustion
|
|
@@ -2240,10 +2226,10 @@ function readModel(stream) {
|
|
|
2240
2226
|
const entries = parseAt(stream, at === -1 ? -1 : stream.indexOf("[", at));
|
|
2241
2227
|
if (entries === null) return null;
|
|
2242
2228
|
const model = /* @__PURE__ */ new Map();
|
|
2243
|
-
for (const
|
|
2244
|
-
const id =
|
|
2245
|
-
if (id !== void 0 &&
|
|
2246
|
-
model.set(id, plain(
|
|
2229
|
+
for (const entry3 of entries) {
|
|
2230
|
+
const id = entry3.key?.key?.value?.id;
|
|
2231
|
+
if (id !== void 0 && entry3.value !== void 0 && !model.has(id)) {
|
|
2232
|
+
model.set(id, plain(entry3.value));
|
|
2247
2233
|
}
|
|
2248
2234
|
}
|
|
2249
2235
|
return model;
|
|
@@ -2845,14 +2831,14 @@ function memberOf(card, id) {
|
|
|
2845
2831
|
(m) => unquote(m[1]).trim()
|
|
2846
2832
|
);
|
|
2847
2833
|
const degree = lines.find((l) => l.startsWith("\u2022"));
|
|
2848
|
-
const [headline,
|
|
2834
|
+
const [headline, role3] = lines.filter((l) => l !== degree && l !== "");
|
|
2849
2835
|
return defined3({
|
|
2850
2836
|
name: unquote(name).trim(),
|
|
2851
2837
|
id,
|
|
2852
2838
|
url,
|
|
2853
2839
|
headline,
|
|
2854
2840
|
degree: degree?.replace(/^•\s*/, ""),
|
|
2855
|
-
role:
|
|
2841
|
+
role: role3,
|
|
2856
2842
|
verified: /"role":"img","aria-label"/.test(card) ? true : void 0
|
|
2857
2843
|
});
|
|
2858
2844
|
}
|
|
@@ -3955,7 +3941,7 @@ function textStates(payload, text6) {
|
|
|
3955
3941
|
const plain2 = keyOf("commentary", "commentFieldBinding");
|
|
3956
3942
|
const rich = keyOf("richTextCommentary", "richCommentFieldBinding");
|
|
3957
3943
|
if (plain2 === null || rich === null) return [];
|
|
3958
|
-
const
|
|
3944
|
+
const entry3 = (key, value, protoCase) => ({
|
|
3959
3945
|
key,
|
|
3960
3946
|
namespace: "MemoryNamespace",
|
|
3961
3947
|
value,
|
|
@@ -3963,8 +3949,8 @@ function textStates(payload, text6) {
|
|
|
3963
3949
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
3964
3950
|
});
|
|
3965
3951
|
return [
|
|
3966
|
-
|
|
3967
|
-
|
|
3952
|
+
entry3(plain2, text6, "stringValue"),
|
|
3953
|
+
entry3(rich, { text: text6, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
|
|
3968
3954
|
];
|
|
3969
3955
|
}
|
|
3970
3956
|
function editStates(payload, text6) {
|
|
@@ -4193,7 +4179,7 @@ async function uploadMedia(file, client) {
|
|
|
4193
4179
|
}
|
|
4194
4180
|
const ticket = parseUploadTicket(registered.json);
|
|
4195
4181
|
if (!ticket.ok) return ticket;
|
|
4196
|
-
const
|
|
4182
|
+
const put2 = await client.request({
|
|
4197
4183
|
url: ticket.uploadUrl,
|
|
4198
4184
|
method: "PUT",
|
|
4199
4185
|
bytes: file.bytes,
|
|
@@ -4201,11 +4187,11 @@ async function uploadMedia(file, client) {
|
|
|
4201
4187
|
spendClass: "write",
|
|
4202
4188
|
operation: "upload"
|
|
4203
4189
|
});
|
|
4204
|
-
if (!
|
|
4190
|
+
if (!put2.ok) {
|
|
4205
4191
|
return {
|
|
4206
4192
|
ok: false,
|
|
4207
|
-
code:
|
|
4208
|
-
message: `uploading ${file.filename} failed (${
|
|
4193
|
+
code: put2.code,
|
|
4194
|
+
message: `uploading ${file.filename} failed (${put2.message}); nothing was posted`
|
|
4209
4195
|
};
|
|
4210
4196
|
}
|
|
4211
4197
|
return { ok: true, urn: ticket.urn };
|
|
@@ -4387,14 +4373,14 @@ function pollUrnOf(json) {
|
|
|
4387
4373
|
return JSON.stringify(json ?? null).match(/urn:li:fsd_pollSummary:\d+/)?.[0] ?? null;
|
|
4388
4374
|
}
|
|
4389
4375
|
async function createPoll(poll, client) {
|
|
4390
|
-
const
|
|
4391
|
-
if (
|
|
4376
|
+
const contract4 = contractFor("createPoll");
|
|
4377
|
+
if (contract4?.queryId === void 0) {
|
|
4392
4378
|
return { ok: false, code: "NOT_IMPLEMENTED", message: "no verified poll contract" };
|
|
4393
4379
|
}
|
|
4394
4380
|
const result = await client.request({
|
|
4395
|
-
url: `${
|
|
4381
|
+
url: `${contract4.path}?action=execute&queryId=${contract4.queryId}`,
|
|
4396
4382
|
method: "POST",
|
|
4397
|
-
body: { variables: { poll }, queryId:
|
|
4383
|
+
body: { variables: { poll }, queryId: contract4.queryId, includeWebMetadata: true },
|
|
4398
4384
|
spendClass: "write",
|
|
4399
4385
|
operation: "create-poll"
|
|
4400
4386
|
});
|
|
@@ -4427,8 +4413,8 @@ function firstUrl(text6) {
|
|
|
4427
4413
|
return url;
|
|
4428
4414
|
}
|
|
4429
4415
|
function urlPreviewUrl(url) {
|
|
4430
|
-
const
|
|
4431
|
-
return `${
|
|
4416
|
+
const contract4 = contractFor("urlPreview");
|
|
4417
|
+
return `${contract4?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract4?.queryId}`;
|
|
4432
4418
|
}
|
|
4433
4419
|
function parseUrlPreview(json) {
|
|
4434
4420
|
const error = gqlError(json);
|
|
@@ -4725,9 +4711,9 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
|
|
|
4725
4711
|
if ("ok" in gated) return gated;
|
|
4726
4712
|
const result = await deletePost(gated.confirmed, createLiveClient(session.session));
|
|
4727
4713
|
if (!result.ok) return err("delete", result.code, result.message, result.hint);
|
|
4728
|
-
const
|
|
4729
|
-
const cached = typeof post?.urn === "string" ? post.urn :
|
|
4730
|
-
const evicted = evict(
|
|
4714
|
+
const target2 = evictionTarget(result);
|
|
4715
|
+
const cached = typeof post?.urn === "string" ? post.urn : target2;
|
|
4716
|
+
const evicted = evict(target2 === null ? null : cached, now);
|
|
4731
4717
|
return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
|
|
4732
4718
|
}
|
|
4733
4719
|
|
|
@@ -4868,7 +4854,7 @@ function parseEvent(json) {
|
|
|
4868
4854
|
};
|
|
4869
4855
|
}
|
|
4870
4856
|
const byUrn = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4871
|
-
const
|
|
4857
|
+
const range2 = e.timeRange ?? {};
|
|
4872
4858
|
const address2 = e.address ?? null;
|
|
4873
4859
|
const place = address2 === null ? void 0 : [address2.city, address2.geographicArea, address2.country].filter((x) => typeof x === "string" && x !== "").join(", ");
|
|
4874
4860
|
const status = byUrn.get(e["*viewerStatus"])?.scheduledContentViewerStatus;
|
|
@@ -4888,8 +4874,8 @@ function parseEvent(json) {
|
|
|
4888
4874
|
"when",
|
|
4889
4875
|
typeof e.displayEventTime === "string" ? e.displayEventTime.replace(/\n/g, " \u2013 ") : void 0
|
|
4890
4876
|
);
|
|
4891
|
-
set("start", typeof
|
|
4892
|
-
set("end", typeof
|
|
4877
|
+
set("start", typeof range2.start === "number" ? new Date(range2.start).toISOString() : void 0);
|
|
4878
|
+
set("end", typeof range2.end === "number" ? new Date(range2.end).toISOString() : void 0);
|
|
4893
4879
|
set("timeZone", typeof e.timeZone === "string" ? e.timeZone : void 0);
|
|
4894
4880
|
set("state", typeof e.lifecycleState === "string" ? e.lifecycleState : void 0);
|
|
4895
4881
|
if (e.cancelled === true) out.cancelled = true;
|
|
@@ -5282,25 +5268,6 @@ async function runWhoami(raw = false) {
|
|
|
5282
5268
|
raw ? { ...shapeEntity(result.value), raw: result.value } : shapeEntity(result.value)
|
|
5283
5269
|
);
|
|
5284
5270
|
}
|
|
5285
|
-
async function runProfile(memberId, raw = false) {
|
|
5286
|
-
if (memberId === void 0 || memberId === "") {
|
|
5287
|
-
return err(
|
|
5288
|
-
"profile",
|
|
5289
|
-
"INVALID_INPUT",
|
|
5290
|
-
"a member id or urn is required",
|
|
5291
|
-
"lnrelay profile <public-id|urn>"
|
|
5292
|
-
);
|
|
5293
|
-
}
|
|
5294
|
-
const ctx = withSession("profile");
|
|
5295
|
-
if ("ok" in ctx) return ctx;
|
|
5296
|
-
const result = await ctx.engine.profile(normaliseMemberId(memberId));
|
|
5297
|
-
if (!result.ok) return toEnvelope("profile", result);
|
|
5298
|
-
if (result.value === void 0) {
|
|
5299
|
-
return err("profile", "NOT_FOUND", `no profile for '${memberId}'`);
|
|
5300
|
-
}
|
|
5301
|
-
const shaped = shapeProfile(result.value.profile, result.value.index);
|
|
5302
|
-
return ok("profile", raw ? { ...shaped, raw: result.value.profile } : shaped);
|
|
5303
|
-
}
|
|
5304
5271
|
async function runFeed(limit, opts = {}) {
|
|
5305
5272
|
const ctx = withSession("feed", opts.quiet === true);
|
|
5306
5273
|
if ("ok" in ctx) return ctx;
|
|
@@ -5362,13 +5329,6 @@ function normalisePostUrn(input) {
|
|
|
5362
5329
|
if (found !== null) return found[0];
|
|
5363
5330
|
return /^\d+$/.test(input) ? `urn:li:activity:${input}` : void 0;
|
|
5364
5331
|
}
|
|
5365
|
-
function normaliseMemberId(input) {
|
|
5366
|
-
const fromUrl = input.match(/linkedin\.com\/in\/([^/?#]+)/);
|
|
5367
|
-
if (fromUrl?.[1] !== void 0) return fromUrl[1];
|
|
5368
|
-
const fromUrn = input.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/);
|
|
5369
|
-
if (fromUrn?.[1] !== void 0) return fromUrn[1];
|
|
5370
|
-
return input;
|
|
5371
|
-
}
|
|
5372
5332
|
function collection(result, opts = {}) {
|
|
5373
5333
|
const { parsed, index } = result;
|
|
5374
5334
|
const shaped = shapeAll(parsed.items, index);
|
|
@@ -6713,6 +6673,425 @@ function runOauthStatus() {
|
|
|
6713
6673
|
});
|
|
6714
6674
|
}
|
|
6715
6675
|
|
|
6676
|
+
// src/engine/contact-info.ts
|
|
6677
|
+
var SCREEN2 = "com.linkedin.sdui.flagshipnav.profile.ProfileContactDetailsOverlay";
|
|
6678
|
+
var CONTACT_INFO_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/navigation?screenId=${SCREEN2}&sduiid=${SCREEN2}`;
|
|
6679
|
+
function contactInfoBody(publicId, firstName, lastName) {
|
|
6680
|
+
return {
|
|
6681
|
+
clientArguments: {
|
|
6682
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
6683
|
+
requestedStateKeys: [],
|
|
6684
|
+
payload: {
|
|
6685
|
+
vanityName: publicId,
|
|
6686
|
+
givenName: firstName,
|
|
6687
|
+
familyName: lastName,
|
|
6688
|
+
isVanityNameResolved: true
|
|
6689
|
+
},
|
|
6690
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" },
|
|
6691
|
+
states: [],
|
|
6692
|
+
screenId: SCREEN2,
|
|
6693
|
+
knownTemplateIds: []
|
|
6694
|
+
},
|
|
6695
|
+
isModal: true
|
|
6696
|
+
};
|
|
6697
|
+
}
|
|
6698
|
+
var drift7 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6699
|
+
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
6700
|
+
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
6701
|
+
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
6702
|
+
var LINK = /"urlValue":\{"\$case":"url","url":"((?:[^"\\]|\\.)+)"/g;
|
|
6703
|
+
var TEXT2 = /"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g;
|
|
6704
|
+
var TYPE = /"\(([^"()]+)\)"/g;
|
|
6705
|
+
function target(link) {
|
|
6706
|
+
const url = unquote2(link);
|
|
6707
|
+
const away = url.match(/\/safety\/go\/?\?url=([^&]+)/)?.[1];
|
|
6708
|
+
if (away !== void 0) return decodeURIComponent(away);
|
|
6709
|
+
return url.replace(/^(mailto|tel):/, "");
|
|
6710
|
+
}
|
|
6711
|
+
function fieldsOf(stream) {
|
|
6712
|
+
const start = stream.indexOf("profile-contact-info-details-view");
|
|
6713
|
+
const upsell = stream.indexOf('"viewName":"premium-upsell-card"', start);
|
|
6714
|
+
const region = stream.slice(start, upsell === -1 ? void 0 : upsell);
|
|
6715
|
+
const labels = [...region.matchAll(LABEL)];
|
|
6716
|
+
const fields = [];
|
|
6717
|
+
let before = 0;
|
|
6718
|
+
labels.forEach((m, i) => {
|
|
6719
|
+
const at = m.index ?? 0;
|
|
6720
|
+
const end = at + m[0].length;
|
|
6721
|
+
const seg = region.slice(end, labels[i + 1]?.index ?? region.length);
|
|
6722
|
+
const view = [...region.slice(before, at).matchAll(VIEW)].pop()?.[1];
|
|
6723
|
+
fields.push({
|
|
6724
|
+
label: unquote2(m[1]).trim(),
|
|
6725
|
+
view,
|
|
6726
|
+
links: [...seg.matchAll(LINK)].map((l) => target(l[1])),
|
|
6727
|
+
texts: [...seg.matchAll(TEXT2)].map((t) => unquote2(t[1]).trim()),
|
|
6728
|
+
types: [...seg.matchAll(TYPE)].map((t) => t[1])
|
|
6729
|
+
});
|
|
6730
|
+
before = end;
|
|
6731
|
+
});
|
|
6732
|
+
return fields;
|
|
6733
|
+
}
|
|
6734
|
+
var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6735
|
+
function put(contact, f) {
|
|
6736
|
+
const text6 = f.texts.join(", ");
|
|
6737
|
+
switch (f.view) {
|
|
6738
|
+
case "your-profile":
|
|
6739
|
+
return;
|
|
6740
|
+
// `profile` already has the profile URL.
|
|
6741
|
+
case "email":
|
|
6742
|
+
contact.email = f.links[0] ?? text6;
|
|
6743
|
+
return;
|
|
6744
|
+
case "website":
|
|
6745
|
+
contact.websites = [
|
|
6746
|
+
...contact.websites ?? [],
|
|
6747
|
+
...f.links.map((url, i) => f.types[i] ? { url, type: f.types[i] } : { url })
|
|
6748
|
+
];
|
|
6749
|
+
return;
|
|
6750
|
+
case "phone":
|
|
6751
|
+
contact.phones = [
|
|
6752
|
+
...contact.phones ?? [],
|
|
6753
|
+
...f.texts.map((number, i) => f.types[i] ? { number, type: f.types[i] } : { number })
|
|
6754
|
+
];
|
|
6755
|
+
return;
|
|
6756
|
+
case "twitter":
|
|
6757
|
+
contact.twitter = [...contact.twitter ?? [], ...f.texts];
|
|
6758
|
+
return;
|
|
6759
|
+
case void 0:
|
|
6760
|
+
if (/^connected since$/i.test(f.label)) contact.connectedSince = text6;
|
|
6761
|
+
else contact.other = { ...contact.other, [f.label]: text6 };
|
|
6762
|
+
return;
|
|
6763
|
+
default:
|
|
6764
|
+
contact[camel(f.view)] = text6;
|
|
6765
|
+
}
|
|
6766
|
+
}
|
|
6767
|
+
function parseContactInfo(stream) {
|
|
6768
|
+
if (!stream.includes("profile-contact-info-details-view"))
|
|
6769
|
+
return drift7("the contact info answer was not the contact info overlay");
|
|
6770
|
+
const fields = fieldsOf(stream);
|
|
6771
|
+
if (fields.length === 0) return drift7("the contact info overlay had no fields");
|
|
6772
|
+
const contact = {};
|
|
6773
|
+
for (const f of fields) put(contact, f);
|
|
6774
|
+
return { ok: true, contact };
|
|
6775
|
+
}
|
|
6776
|
+
|
|
6777
|
+
// src/engine/full-profile.ts
|
|
6778
|
+
function contract3(name) {
|
|
6779
|
+
const c = CONTRACTS[name];
|
|
6780
|
+
if (c?.decorationId === void 0) throw new Error(`the '${name}' contract is missing`);
|
|
6781
|
+
return c;
|
|
6782
|
+
}
|
|
6783
|
+
function fullProfileUrl(memberId) {
|
|
6784
|
+
const c = contract3("fullProfile");
|
|
6785
|
+
return `${c.path}?q=memberIdentity&memberIdentity=${encodeURIComponent(memberId)}&decorationId=${c.decorationId}`;
|
|
6786
|
+
}
|
|
6787
|
+
var POSITIONS_PAGE = 50;
|
|
6788
|
+
function positionsPageUrl(profileUrn, start) {
|
|
6789
|
+
const c = contract3("profilePositions");
|
|
6790
|
+
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
6791
|
+
}
|
|
6792
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6793
|
+
var str4 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
6794
|
+
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
6795
|
+
function defined7(obj) {
|
|
6796
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
6797
|
+
return obj;
|
|
6798
|
+
}
|
|
6799
|
+
function date(v) {
|
|
6800
|
+
const d = v;
|
|
6801
|
+
if (typeof d?.year !== "number") return void 0;
|
|
6802
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
6803
|
+
if (typeof d.month !== "number") return String(d.year);
|
|
6804
|
+
return typeof d.day === "number" ? `${d.year}-${two(d.month)}-${two(d.day)}` : `${d.year}-${two(d.month)}`;
|
|
6805
|
+
}
|
|
6806
|
+
function range(v) {
|
|
6807
|
+
const r = v;
|
|
6808
|
+
const start = date(r?.start);
|
|
6809
|
+
const end = date(r?.end);
|
|
6810
|
+
return defined7({
|
|
6811
|
+
start,
|
|
6812
|
+
end,
|
|
6813
|
+
current: start !== void 0 && end === void 0 ? true : void 0
|
|
6814
|
+
});
|
|
6815
|
+
}
|
|
6816
|
+
var Index = class {
|
|
6817
|
+
byUrn;
|
|
6818
|
+
constructor(included) {
|
|
6819
|
+
this.byUrn = new Map(included.map((n) => [n.entityUrn, n]));
|
|
6820
|
+
}
|
|
6821
|
+
get(urn) {
|
|
6822
|
+
return typeof urn === "string" ? this.byUrn.get(urn) : void 0;
|
|
6823
|
+
}
|
|
6824
|
+
/** The node as a list of one, or none. */
|
|
6825
|
+
list(urn) {
|
|
6826
|
+
const n = this.get(urn);
|
|
6827
|
+
return n === void 0 ? [] : [n];
|
|
6828
|
+
}
|
|
6829
|
+
/** A collection's nodes, in its order, and how many LinkedIn says there are. */
|
|
6830
|
+
collection(urn) {
|
|
6831
|
+
const c = this.get(urn);
|
|
6832
|
+
const refs = Array.isArray(c?.["*elements"]) ? c?.["*elements"] : [];
|
|
6833
|
+
const nodes = refs.flatMap((r) => this.list(r));
|
|
6834
|
+
const total = c?.paging?.total;
|
|
6835
|
+
return typeof total === "number" ? { nodes, total } : { nodes };
|
|
6836
|
+
}
|
|
6837
|
+
};
|
|
6838
|
+
function role(p, group, ix) {
|
|
6839
|
+
const companyUrn = p.companyUrn ?? group?.companyUrn;
|
|
6840
|
+
return defined7({
|
|
6841
|
+
title: str4(p.title),
|
|
6842
|
+
company: str4(p.companyName) ?? str4(group?.companyName),
|
|
6843
|
+
companyId: idOf3(companyUrn),
|
|
6844
|
+
employmentType: str4(ix.get(p["*employmentType"])?.name),
|
|
6845
|
+
location: str4(p.locationName) ?? str4(p.geoLocationName),
|
|
6846
|
+
...range(p.dateRange),
|
|
6847
|
+
description: str4(p.description)
|
|
6848
|
+
});
|
|
6849
|
+
}
|
|
6850
|
+
function rolesOf(groups, ix) {
|
|
6851
|
+
return groups.flatMap((g) => {
|
|
6852
|
+
const inGroup = ix.collection(g["*profilePositionInPositionGroup"]).nodes;
|
|
6853
|
+
return inGroup.map((p) => role(p, g, ix));
|
|
6854
|
+
});
|
|
6855
|
+
}
|
|
6856
|
+
function school(e) {
|
|
6857
|
+
return defined7({
|
|
6858
|
+
school: str4(e.schoolName),
|
|
6859
|
+
schoolId: idOf3(e.schoolUrn),
|
|
6860
|
+
degree: str4(e.degreeName),
|
|
6861
|
+
field: str4(e.fieldOfStudy),
|
|
6862
|
+
...range(e.dateRange),
|
|
6863
|
+
grade: str4(e.grade),
|
|
6864
|
+
activities: str4(e.activities),
|
|
6865
|
+
description: str4(e.description)
|
|
6866
|
+
});
|
|
6867
|
+
}
|
|
6868
|
+
function entry(n) {
|
|
6869
|
+
const proficiency = str4(n.proficiency);
|
|
6870
|
+
return defined7({
|
|
6871
|
+
name: str4(n.name),
|
|
6872
|
+
title: str4(n.title),
|
|
6873
|
+
role: str4(n.role),
|
|
6874
|
+
organization: str4(n.companyName),
|
|
6875
|
+
authority: str4(n.authority),
|
|
6876
|
+
issuer: str4(n.issuer),
|
|
6877
|
+
publisher: str4(n.publisher),
|
|
6878
|
+
proficiency: proficiency?.toLowerCase().replace(/_/g, " "),
|
|
6879
|
+
number: str4(n.number) ?? str4(n.licenseNumber) ?? str4(n.patentNumber),
|
|
6880
|
+
score: str4(n.score),
|
|
6881
|
+
cause: str4(n.cause)?.toLowerCase().replace(/_/g, " "),
|
|
6882
|
+
...range(n.dateRange),
|
|
6883
|
+
issued: date(n.issuedOn),
|
|
6884
|
+
published: date(n.publishedOn),
|
|
6885
|
+
url: str4(n.url),
|
|
6886
|
+
description: str4(n.description)
|
|
6887
|
+
});
|
|
6888
|
+
}
|
|
6889
|
+
var SECTIONS = {
|
|
6890
|
+
certifications: "*profileCertifications",
|
|
6891
|
+
languages: "*profileLanguages",
|
|
6892
|
+
honors: "*profileHonors",
|
|
6893
|
+
publications: "*profilePublications",
|
|
6894
|
+
projects: "*profileProjects",
|
|
6895
|
+
volunteering: "*profileVolunteerExperiences",
|
|
6896
|
+
courses: "*profileCourses",
|
|
6897
|
+
organizations: "*profileOrganizations",
|
|
6898
|
+
patents: "*profilePatents",
|
|
6899
|
+
testScores: "*profileTestScores"
|
|
6900
|
+
};
|
|
6901
|
+
var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
6902
|
+
function parseFullProfile(json) {
|
|
6903
|
+
const root = json;
|
|
6904
|
+
const listed2 = root?.data?.["*elements"];
|
|
6905
|
+
if (!Array.isArray(listed2)) return drift8("the profile answer carried no profile list");
|
|
6906
|
+
if (listed2.length === 0)
|
|
6907
|
+
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
6908
|
+
const ix = new Index(root?.included ?? []);
|
|
6909
|
+
const p = ix.get(listed2[0]);
|
|
6910
|
+
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
6911
|
+
if (p === void 0 || urn === void 0) return drift8("the profile was listed but not sent");
|
|
6912
|
+
const counts2 = {};
|
|
6913
|
+
const count3 = (key, shown, total) => {
|
|
6914
|
+
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
6915
|
+
};
|
|
6916
|
+
const groups = ix.collection(p["*profilePositionGroups"]);
|
|
6917
|
+
count3("experience", groups.nodes.length, groups.total);
|
|
6918
|
+
const experience = rolesOf(groups.nodes, ix);
|
|
6919
|
+
const schools = ix.collection(p["*profileEducations"]);
|
|
6920
|
+
const education = schools.nodes.map(school);
|
|
6921
|
+
const skillNodes = ix.collection(p["*profileSkills"]);
|
|
6922
|
+
count3("skills", skillNodes.nodes.length, skillNodes.total);
|
|
6923
|
+
const skills = skillNodes.nodes.flatMap((s) => str4(s.name) ?? []);
|
|
6924
|
+
const sections = {};
|
|
6925
|
+
for (const [key, field] of Object.entries(SECTIONS)) {
|
|
6926
|
+
const c = ix.collection(p[field]);
|
|
6927
|
+
count3(key, c.nodes.length, c.total);
|
|
6928
|
+
const rows = c.nodes.map(entry);
|
|
6929
|
+
if (rows.length > 0) sections[key] = rows;
|
|
6930
|
+
}
|
|
6931
|
+
const publicId = str4(p.publicIdentifier);
|
|
6932
|
+
const name = [str4(p.firstName), str4(p.lastName)].filter(Boolean).join(" ");
|
|
6933
|
+
const geo = ix.get(p.geoLocation?.["*geo"]);
|
|
6934
|
+
const bool3 = (v) => v === true ? true : void 0;
|
|
6935
|
+
return {
|
|
6936
|
+
ok: true,
|
|
6937
|
+
profile: defined7({
|
|
6938
|
+
id: urn.split(":").pop(),
|
|
6939
|
+
urn,
|
|
6940
|
+
publicId,
|
|
6941
|
+
name: name === "" ? void 0 : name,
|
|
6942
|
+
firstName: str4(p.firstName),
|
|
6943
|
+
lastName: str4(p.lastName),
|
|
6944
|
+
headline: str4(p.headline),
|
|
6945
|
+
url: publicId === void 0 ? void 0 : `https://www.linkedin.com/in/${publicId}/`,
|
|
6946
|
+
location: str4(geo?.defaultLocalizedName),
|
|
6947
|
+
industry: str4(ix.get(p["*industry"])?.name),
|
|
6948
|
+
about: str4(p.summary),
|
|
6949
|
+
title: experience[0]?.title,
|
|
6950
|
+
company: experience[0]?.company,
|
|
6951
|
+
school: education[0]?.school,
|
|
6952
|
+
premium: bool3(p.premium),
|
|
6953
|
+
influencer: bool3(p.influencer),
|
|
6954
|
+
creator: bool3(p.creator),
|
|
6955
|
+
experience: some(experience),
|
|
6956
|
+
education: some(education),
|
|
6957
|
+
skills: some(skills),
|
|
6958
|
+
...sections,
|
|
6959
|
+
counts: Object.keys(counts2).length > 0 ? counts2 : void 0
|
|
6960
|
+
})
|
|
6961
|
+
};
|
|
6962
|
+
}
|
|
6963
|
+
function parsePositionsPage(json) {
|
|
6964
|
+
const root = json;
|
|
6965
|
+
const refs = root?.data?.["*elements"];
|
|
6966
|
+
if (!Array.isArray(refs)) return drift8("the experience page carried no position groups");
|
|
6967
|
+
const ix = new Index(root?.included ?? []);
|
|
6968
|
+
const groups = refs.flatMap((r) => ix.list(r));
|
|
6969
|
+
if (refs.length > 0 && groups.length === 0)
|
|
6970
|
+
return drift8(`${refs.length} position groups were listed but none sent`);
|
|
6971
|
+
const total = root?.data?.paging?.total;
|
|
6972
|
+
return {
|
|
6973
|
+
ok: true,
|
|
6974
|
+
experience: rolesOf(groups, ix),
|
|
6975
|
+
groups: groups.length,
|
|
6976
|
+
...typeof total === "number" ? { total } : {}
|
|
6977
|
+
};
|
|
6978
|
+
}
|
|
6979
|
+
|
|
6980
|
+
// src/commands/profile.ts
|
|
6981
|
+
function liveFetch8(quiet) {
|
|
6982
|
+
const session = loadSession();
|
|
6983
|
+
if (session.state !== "ok")
|
|
6984
|
+
return err("profile", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
6985
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
6986
|
+
return async (url, spendClass, body) => {
|
|
6987
|
+
const r = await client.request({
|
|
6988
|
+
url,
|
|
6989
|
+
...body !== void 0 ? { method: "POST", body } : {},
|
|
6990
|
+
spendClass,
|
|
6991
|
+
operation: "profile"
|
|
6992
|
+
});
|
|
6993
|
+
if (!r.ok) return r;
|
|
6994
|
+
return { ok: true, json: r.json, raw: r.classification.raw ?? "" };
|
|
6995
|
+
};
|
|
6996
|
+
}
|
|
6997
|
+
function memberIdOf(input) {
|
|
6998
|
+
const s = input.trim();
|
|
6999
|
+
const slug = s.match(/linkedin\.com\/in\/([^/?#]+)/)?.[1];
|
|
7000
|
+
if (slug !== void 0) {
|
|
7001
|
+
try {
|
|
7002
|
+
return decodeURIComponent(slug);
|
|
7003
|
+
} catch {
|
|
7004
|
+
return slug;
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
7007
|
+
return s.match(/urn:li:fsd?_(?:mini)?[Pp]rofile:([^,)]+)/)?.[1] ?? s;
|
|
7008
|
+
}
|
|
7009
|
+
async function readRestOfExperience(get, p) {
|
|
7010
|
+
const want = p.counts?.experience;
|
|
7011
|
+
if (want === void 0) return;
|
|
7012
|
+
let start = want.shown;
|
|
7013
|
+
while (start < want.total) {
|
|
7014
|
+
const res = await get(positionsPageUrl(p.urn, start), "profile");
|
|
7015
|
+
const page = res.ok ? parsePositionsPage(res.json) : res;
|
|
7016
|
+
if (!page.ok) {
|
|
7017
|
+
p.experienceError = `${page.code}: ${page.message}`;
|
|
7018
|
+
return;
|
|
7019
|
+
}
|
|
7020
|
+
p.experience = [...p.experience ?? [], ...page.experience];
|
|
7021
|
+
start += page.groups;
|
|
7022
|
+
if (page.groups < POSITIONS_PAGE) break;
|
|
7023
|
+
}
|
|
7024
|
+
const counts2 = { ...p.counts };
|
|
7025
|
+
if (start >= want.total) delete counts2.experience;
|
|
7026
|
+
else counts2.experience = { shown: start, total: want.total };
|
|
7027
|
+
if (Object.keys(counts2).length > 0) p.counts = counts2;
|
|
7028
|
+
else delete p.counts;
|
|
7029
|
+
}
|
|
7030
|
+
async function readContact(get, p) {
|
|
7031
|
+
if (p.publicId === void 0 || p.firstName === void 0) {
|
|
7032
|
+
p.contactError = "NOT_FOUND: the profile has no public id or name to ask with";
|
|
7033
|
+
return;
|
|
7034
|
+
}
|
|
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
|
+
};
|
|
7050
|
+
var LISTS2 = [
|
|
7051
|
+
"certifications",
|
|
7052
|
+
"languages",
|
|
7053
|
+
"honors",
|
|
7054
|
+
"publications",
|
|
7055
|
+
"projects",
|
|
7056
|
+
"volunteering",
|
|
7057
|
+
"courses",
|
|
7058
|
+
"organizations",
|
|
7059
|
+
"patents",
|
|
7060
|
+
"testScores"
|
|
7061
|
+
];
|
|
7062
|
+
function compact(p) {
|
|
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;
|
|
7071
|
+
}
|
|
7072
|
+
async function runProfile(input, opts = {}, fetch2, req = {}) {
|
|
7073
|
+
if (input === void 0 || input.trim() === "")
|
|
7074
|
+
return err(
|
|
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);
|
|
7093
|
+
}
|
|
7094
|
+
|
|
6716
7095
|
// src/commands/registry.ts
|
|
6717
7096
|
var COMMANDS = [
|
|
6718
7097
|
// ─── local / meta — no network, available today ────────────────────────────
|
|
@@ -6765,9 +7144,9 @@ var COMMANDS = [
|
|
|
6765
7144
|
},
|
|
6766
7145
|
{
|
|
6767
7146
|
name: "profile",
|
|
6768
|
-
cost: "1
|
|
6769
|
-
summary: "A
|
|
6770
|
-
usage: "lnrelay profile <public-id|urn|url> [--
|
|
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]",
|
|
6771
7150
|
audience: ["cli", "mcp"],
|
|
6772
7151
|
risk: "read",
|
|
6773
7152
|
implemented: true
|
|
@@ -7153,7 +7532,7 @@ var PROFILE_FIELDS = {
|
|
|
7153
7532
|
maxLength: 2600
|
|
7154
7533
|
}
|
|
7155
7534
|
};
|
|
7156
|
-
var
|
|
7535
|
+
var drift9 = (message) => ({
|
|
7157
7536
|
ok: false,
|
|
7158
7537
|
code: "SCHEMA_DRIFT",
|
|
7159
7538
|
message,
|
|
@@ -7161,10 +7540,10 @@ var drift7 = (message) => ({
|
|
|
7161
7540
|
});
|
|
7162
7541
|
function readForm(stream, field) {
|
|
7163
7542
|
const states2 = readModel(stream);
|
|
7164
|
-
if (states2 === null) return
|
|
7543
|
+
if (states2 === null) return drift9("the profile form carried no initial values");
|
|
7165
7544
|
const args = findRequest(stream, field.save);
|
|
7166
7545
|
if (args === null)
|
|
7167
|
-
return
|
|
7546
|
+
return drift9(`the profile form carried no ${field.save.split(".").pop()} action`);
|
|
7168
7547
|
return { ok: true, args, states: states2, screen: field.screen, save: field.save };
|
|
7169
7548
|
}
|
|
7170
7549
|
function boundKey(form, property) {
|
|
@@ -7180,7 +7559,7 @@ function topSkills(form) {
|
|
|
7180
7559
|
return (key) => {
|
|
7181
7560
|
if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
|
|
7182
7561
|
const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
|
|
7183
|
-
if (initial === void 0) return
|
|
7562
|
+
if (initial === void 0) return drift9("the About form carried no initial top skills");
|
|
7184
7563
|
if (!Array.isArray(initial.value) || initial.value.length > 0) {
|
|
7185
7564
|
return {
|
|
7186
7565
|
ok: false,
|
|
@@ -7200,13 +7579,13 @@ function saveBody(form, field, value) {
|
|
|
7200
7579
|
message: `the ${field.name} is ${value.length} characters; LinkedIn allows ${field.maxLength}`
|
|
7201
7580
|
};
|
|
7202
7581
|
}
|
|
7203
|
-
const
|
|
7204
|
-
const current =
|
|
7205
|
-
if (
|
|
7206
|
-
return
|
|
7582
|
+
const target2 = boundKey(form, field.binding);
|
|
7583
|
+
const current = target2 === void 0 ? void 0 : form.states.get(target2);
|
|
7584
|
+
if (target2 === void 0 || current === void 0) {
|
|
7585
|
+
return drift9(`the profile form has no ${field.name} field`);
|
|
7207
7586
|
}
|
|
7208
7587
|
const model = new Map(form.states);
|
|
7209
|
-
model.set(
|
|
7588
|
+
model.set(target2, { ...current, value });
|
|
7210
7589
|
const states2 = wireStates(keysOf(form.args), model, topSkills(form));
|
|
7211
7590
|
if (!Array.isArray(states2)) return states2;
|
|
7212
7591
|
return { ok: true, body: requestBody(form.save, form.args, states2, form.screen) };
|
|
@@ -7272,7 +7651,7 @@ var POSITION = {
|
|
|
7272
7651
|
var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
7273
7652
|
function listPositions(stream) {
|
|
7274
7653
|
if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
|
|
7275
|
-
return
|
|
7654
|
+
return drift9("the Experience screen could not be read");
|
|
7276
7655
|
}
|
|
7277
7656
|
const positions = [];
|
|
7278
7657
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -7290,17 +7669,17 @@ function listPositions(stream) {
|
|
|
7290
7669
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
7291
7670
|
}
|
|
7292
7671
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
7293
|
-
return
|
|
7672
|
+
return drift9("the Experience screen listed no roles and did not look like one");
|
|
7294
7673
|
}
|
|
7295
7674
|
return { ok: true, positions };
|
|
7296
7675
|
}
|
|
7297
7676
|
function readPositionForm(stream) {
|
|
7298
7677
|
const model = readModel(stream);
|
|
7299
|
-
if (model === null) return
|
|
7678
|
+
if (model === null) return drift9("the position form carried no initial values");
|
|
7300
7679
|
const media = findRequest(stream, POSITION.media);
|
|
7301
7680
|
const prefix = media?.payload.formIdPrefix;
|
|
7302
7681
|
if (media === null || typeof prefix !== "string") {
|
|
7303
|
-
return
|
|
7682
|
+
return drift9("the position form carried no save step (uploadPositionMedia)");
|
|
7304
7683
|
}
|
|
7305
7684
|
const del = findRequest(stream, POSITION.delete);
|
|
7306
7685
|
return {
|
|
@@ -7312,7 +7691,7 @@ function readPositionForm(stream) {
|
|
|
7312
7691
|
screen: del === null ? POSITION.addScreen : POSITION.editScreen
|
|
7313
7692
|
};
|
|
7314
7693
|
}
|
|
7315
|
-
var
|
|
7694
|
+
var date2 = (d) => ({
|
|
7316
7695
|
$type: "proto.sdui.common.Date",
|
|
7317
7696
|
day: 0,
|
|
7318
7697
|
month: d.month,
|
|
@@ -7343,15 +7722,15 @@ function applyChanges(form, changes) {
|
|
|
7343
7722
|
need("organizationId", -1);
|
|
7344
7723
|
need("organizationEntityId", { type: "bigint", value: "-1" });
|
|
7345
7724
|
}
|
|
7346
|
-
if (changes.start !== void 0) need("startDate",
|
|
7725
|
+
if (changes.start !== void 0) need("startDate", date2(changes.start));
|
|
7347
7726
|
if (changes.end === "present") need("isCurrentPosition", true);
|
|
7348
7727
|
else if (changes.end !== void 0) {
|
|
7349
7728
|
need("isCurrentPosition", false);
|
|
7350
|
-
need("endDate",
|
|
7729
|
+
need("endDate", date2(changes.end));
|
|
7351
7730
|
}
|
|
7352
7731
|
need("dynamicallyCreateHeadline", false);
|
|
7353
7732
|
need("allowProfileEditBroadcasts", changes.notify === true);
|
|
7354
|
-
if (missing.length > 0) return
|
|
7733
|
+
if (missing.length > 0) return drift9(`the position form has no ${missing.join(", ")} field`);
|
|
7355
7734
|
const s = roleSummary(model);
|
|
7356
7735
|
if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
|
|
7357
7736
|
return {
|
|
@@ -7396,7 +7775,7 @@ function mediaBody(form, model) {
|
|
|
7396
7775
|
}
|
|
7397
7776
|
function saveFromReply(reply) {
|
|
7398
7777
|
const args = findRequest(reply, POSITION.save);
|
|
7399
|
-
return args === null ?
|
|
7778
|
+
return args === null ? drift9("the media step did not hand back the save action") : { ok: true, args };
|
|
7400
7779
|
}
|
|
7401
7780
|
function positionSaveBody(save, model, screen) {
|
|
7402
7781
|
const sending = new Map(model);
|
|
@@ -7408,7 +7787,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
7408
7787
|
}
|
|
7409
7788
|
function deleteBody(form) {
|
|
7410
7789
|
if (form.del === null)
|
|
7411
|
-
return
|
|
7790
|
+
return drift9("this form has no delete action (it is not an existing role)");
|
|
7412
7791
|
const states2 = wireStates(keysOf(form.del), form.model, resolver);
|
|
7413
7792
|
if (!Array.isArray(states2)) return states2;
|
|
7414
7793
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
|
|
@@ -7724,16 +8103,16 @@ function targetFor(urn) {
|
|
|
7724
8103
|
`'${urn}' does not identify a post or a comment \u2014 expected urn:li:activity:<id> or urn:li:comment:(urn:li:activity:<id>,<id>)`
|
|
7725
8104
|
);
|
|
7726
8105
|
}
|
|
7727
|
-
function reactionPayload(
|
|
8106
|
+
function reactionPayload(target2, reaction) {
|
|
7728
8107
|
return {
|
|
7729
|
-
threadUrn:
|
|
8108
|
+
threadUrn: target2.threadUrn,
|
|
7730
8109
|
reactionType: `ReactionType_${reaction}`,
|
|
7731
|
-
reactionSource:
|
|
8110
|
+
reactionSource: target2.reactionSource
|
|
7732
8111
|
};
|
|
7733
8112
|
}
|
|
7734
|
-
function sduiBody(op,
|
|
8113
|
+
function sduiBody(op, target2, reaction) {
|
|
7735
8114
|
const requestId = `com.linkedin.sdui.reactions.${op}`;
|
|
7736
|
-
const payload = reactionPayload(
|
|
8115
|
+
const payload = reactionPayload(target2, reaction);
|
|
7737
8116
|
const args = {
|
|
7738
8117
|
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
7739
8118
|
requestedStateKeys: [],
|
|
@@ -7760,9 +8139,9 @@ function sduiBody(op, target, reaction) {
|
|
|
7760
8139
|
}
|
|
7761
8140
|
async function react(confirmed, client) {
|
|
7762
8141
|
const { urn, type, remove } = confirmed.payload;
|
|
7763
|
-
let
|
|
8142
|
+
let target2;
|
|
7764
8143
|
try {
|
|
7765
|
-
|
|
8144
|
+
target2 = targetFor(urn);
|
|
7766
8145
|
} catch (e) {
|
|
7767
8146
|
return { ok: false, code: "INVALID_INPUT", message: e.message };
|
|
7768
8147
|
}
|
|
@@ -7770,7 +8149,7 @@ async function react(confirmed, client) {
|
|
|
7770
8149
|
const result = await client.request({
|
|
7771
8150
|
url: reactionUrl(op),
|
|
7772
8151
|
method: "POST",
|
|
7773
|
-
body: sduiBody(op,
|
|
8152
|
+
body: sduiBody(op, target2, type),
|
|
7774
8153
|
spendClass: "write",
|
|
7775
8154
|
operation: `reaction.${op}`
|
|
7776
8155
|
});
|
|
@@ -8021,9 +8400,9 @@ function parseScheduleTime(input) {
|
|
|
8021
8400
|
const local = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})$/.exec(input);
|
|
8022
8401
|
if (local === null) return null;
|
|
8023
8402
|
const [y, mo, d, h, mi] = local.slice(1).map(Number);
|
|
8024
|
-
const
|
|
8025
|
-
const same =
|
|
8026
|
-
return same ?
|
|
8403
|
+
const date3 = new Date(y, mo - 1, d, h, mi);
|
|
8404
|
+
const same = date3.getFullYear() === y && date3.getMonth() === mo - 1 && date3.getDate() === d && date3.getHours() === h && date3.getMinutes() === mi;
|
|
8405
|
+
return same ? date3.getTime() : null;
|
|
8027
8406
|
}
|
|
8028
8407
|
var MIN_LEAD_MS = 10 * 6e4;
|
|
8029
8408
|
function mediaFrom(media, via2) {
|
|
@@ -8598,13 +8977,13 @@ function changesFrom(req) {
|
|
|
8598
8977
|
}
|
|
8599
8978
|
return c;
|
|
8600
8979
|
}
|
|
8601
|
-
var
|
|
8980
|
+
var span2 = (s) => `${s.start ?? "?"} \u2013 ${s.current ? "present" : s.end ?? "?"}`;
|
|
8602
8981
|
var q = (v) => `"${v.length > 160 ? `${v.slice(0, 160)}\u2026` : v.replace(/\n/g, " ")}"`;
|
|
8603
8982
|
function roleLines(s) {
|
|
8604
8983
|
return [
|
|
8605
8984
|
`title ${q(s.title)}`,
|
|
8606
8985
|
`company ${q(s.company)}`,
|
|
8607
|
-
`dates ${
|
|
8986
|
+
`dates ${span2(s)}`,
|
|
8608
8987
|
...s.location === "" ? [] : [`location ${q(s.location)}`],
|
|
8609
8988
|
...s.description === "" ? [] : [`about ${q(s.description)}`]
|
|
8610
8989
|
];
|
|
@@ -8616,7 +8995,7 @@ function diffLines(a, b) {
|
|
|
8616
8995
|
};
|
|
8617
8996
|
row("title", a.title, b.title);
|
|
8618
8997
|
row("company", a.company, b.company);
|
|
8619
|
-
row("dates",
|
|
8998
|
+
row("dates", span2(a), span2(b));
|
|
8620
8999
|
row("location", a.location, b.location);
|
|
8621
9000
|
row("about", a.description, b.description);
|
|
8622
9001
|
return out;
|
|
@@ -8625,7 +9004,7 @@ var SAFETY = (notify) => [
|
|
|
8625
9004
|
"headline unchanged (LinkedIn would otherwise rewrite it from this role)",
|
|
8626
9005
|
`notify ${notify ? "ON \u2014 your network may be told" : "off"}`
|
|
8627
9006
|
];
|
|
8628
|
-
async function runRole(sub,
|
|
9007
|
+
async function runRole(sub, target2, req, now = Date.now(), deps = terminalDeps(), surface) {
|
|
8629
9008
|
if (sub !== "add" && sub !== "edit" && sub !== "remove") {
|
|
8630
9009
|
return err(
|
|
8631
9010
|
"role",
|
|
@@ -8645,7 +9024,7 @@ async function runRole(sub, target, req, now = Date.now(), deps = terminalDeps()
|
|
|
8645
9024
|
`a new role needs ${missing.map((f) => `--${f}`).join(", ")}`
|
|
8646
9025
|
);
|
|
8647
9026
|
}
|
|
8648
|
-
} else if (
|
|
9027
|
+
} else if (target2 === void 0 || !/^\d+$/.test(target2)) {
|
|
8649
9028
|
return err(
|
|
8650
9029
|
"role",
|
|
8651
9030
|
"INVALID_INPUT",
|
|
@@ -8676,12 +9055,12 @@ async function runRole(sub, target, req, now = Date.now(), deps = terminalDeps()
|
|
|
8676
9055
|
const listed2 = await roles.list(me.vanity);
|
|
8677
9056
|
if (!listed2.ok) return err("role", listed2.code, listed2.message, listed2.hint);
|
|
8678
9057
|
if (sub === "add") return addRole(changes, me.vanity, listed2.positions, roles, ctx, deps);
|
|
8679
|
-
const position = listed2.positions.find((p) => p.positionId ===
|
|
9058
|
+
const position = listed2.positions.find((p) => p.positionId === target2);
|
|
8680
9059
|
if (position === void 0) {
|
|
8681
9060
|
return err(
|
|
8682
9061
|
"role",
|
|
8683
9062
|
"NOT_FOUND",
|
|
8684
|
-
`no role ${
|
|
9063
|
+
`no role ${target2} on your profile`,
|
|
8685
9064
|
`your roles: ${listed2.positions.map((p) => `${p.positionId} (${p.title})`).join(", ") || "none"}`
|
|
8686
9065
|
);
|
|
8687
9066
|
}
|
|
@@ -8694,11 +9073,11 @@ async function addRole(changes, vanity, before, roles, ctx, deps) {
|
|
|
8694
9073
|
if (!form.ok) return err("role", form.code, form.message, form.hint);
|
|
8695
9074
|
const applied = applyChanges(form, changes);
|
|
8696
9075
|
if (!applied.ok) return err("role", applied.code, applied.message, applied.hint);
|
|
8697
|
-
const
|
|
9076
|
+
const role3 = roleSummary(applied.model);
|
|
8698
9077
|
const plan = {
|
|
8699
9078
|
action: "add a role to your profile",
|
|
8700
9079
|
payload: { changes },
|
|
8701
|
-
summary: [authorLine(ctx.transport), ...roleLines(
|
|
9080
|
+
summary: [authorLine(ctx.transport), ...roleLines(role3), ...SAFETY(changes.notify === true)],
|
|
8702
9081
|
reversibility: "removable with `lnrelay role remove <position-id>`",
|
|
8703
9082
|
transport: "voyager"
|
|
8704
9083
|
};
|
|
@@ -8708,7 +9087,7 @@ async function addRole(changes, vanity, before, roles, ctx, deps) {
|
|
|
8708
9087
|
if (!saved.ok) return err("role", saved.code, saved.message, saved.hint);
|
|
8709
9088
|
const after = await roles.list(vanity);
|
|
8710
9089
|
const known = new Set(before.map((p) => p.positionId));
|
|
8711
|
-
const added = after.ok ? after.positions.find((p) => !known.has(p.positionId) && p.title ===
|
|
9090
|
+
const added = after.ok ? after.positions.find((p) => !known.has(p.positionId) && p.title === role3.title) : void 0;
|
|
8712
9091
|
if (added === void 0) {
|
|
8713
9092
|
return err(
|
|
8714
9093
|
"role",
|
|
@@ -8754,11 +9133,11 @@ async function editRole(position, form, changes, vanity, roles, ctx, deps) {
|
|
|
8754
9133
|
return ok("role", { edited: position.positionId, verified: true });
|
|
8755
9134
|
}
|
|
8756
9135
|
async function removeRole(position, form, vanity, roles, ctx, deps) {
|
|
8757
|
-
const
|
|
9136
|
+
const role3 = roleSummary(form.model);
|
|
8758
9137
|
const plan = {
|
|
8759
9138
|
action: "remove a role from your profile",
|
|
8760
|
-
payload: { positionId: position.positionId, role:
|
|
8761
|
-
summary: [authorLine(ctx.transport), `role ${position.positionId}`, ...roleLines(
|
|
9139
|
+
payload: { positionId: position.positionId, role: role3 },
|
|
9140
|
+
summary: [authorLine(ctx.transport), `role ${position.positionId}`, ...roleLines(role3)],
|
|
8762
9141
|
reversibility: "NONE. LinkedIn deletes it; re-adding makes a new role.",
|
|
8763
9142
|
transport: "voyager"
|
|
8764
9143
|
};
|
|
@@ -8964,10 +9343,10 @@ var SKILL = {
|
|
|
8964
9343
|
delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
|
|
8965
9344
|
};
|
|
8966
9345
|
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
|
|
8967
|
-
var
|
|
9346
|
+
var TEXT3 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
8968
9347
|
function skillsFromPage(stream) {
|
|
8969
9348
|
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
|
|
8970
|
-
return
|
|
9349
|
+
return drift9("the skills page could not be read");
|
|
8971
9350
|
}
|
|
8972
9351
|
const skills = [];
|
|
8973
9352
|
let from = 0;
|
|
@@ -8983,7 +9362,7 @@ function skillsFromPage(stream) {
|
|
|
8983
9362
|
const id = payload?.skillId;
|
|
8984
9363
|
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
8985
9364
|
continue;
|
|
8986
|
-
const names = [...stream.slice(from, end).matchAll(
|
|
9365
|
+
const names = [...stream.slice(from, end).matchAll(TEXT3)].map(
|
|
8987
9366
|
(m) => JSON.parse(`"${m[1]}"`)
|
|
8988
9367
|
);
|
|
8989
9368
|
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
@@ -9011,11 +9390,11 @@ function pagerFrom(payload, start) {
|
|
|
9011
9390
|
}
|
|
9012
9391
|
function readSkillForm(stream) {
|
|
9013
9392
|
const model = readModel(stream);
|
|
9014
|
-
if (model === null) return
|
|
9393
|
+
if (model === null) return drift9("the skill form carried no initial values");
|
|
9015
9394
|
const save = findRequest(stream, SKILL.save);
|
|
9016
9395
|
const del = findRequest(stream, SKILL.delete);
|
|
9017
9396
|
if (save === null && del === null)
|
|
9018
|
-
return
|
|
9397
|
+
return drift9("the skill form carried neither a save nor a delete");
|
|
9019
9398
|
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
9020
9399
|
}
|
|
9021
9400
|
var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
|
|
@@ -9027,10 +9406,10 @@ function skillNameOf(form) {
|
|
|
9027
9406
|
function addSkillBody(form, name) {
|
|
9028
9407
|
if (name.trim() === "")
|
|
9029
9408
|
return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
|
|
9030
|
-
if (form.save === null) return
|
|
9409
|
+
if (form.save === null) return drift9("this form has no save action (it is not the add form)");
|
|
9031
9410
|
const key = nameKey(form.model);
|
|
9032
9411
|
const current = key === void 0 ? void 0 : form.model.get(key);
|
|
9033
|
-
if (key === void 0 || current === void 0) return
|
|
9412
|
+
if (key === void 0 || current === void 0) return drift9("the skill form has no name field");
|
|
9034
9413
|
const model = new Map(form.model);
|
|
9035
9414
|
model.set(key, { ...current, value: name.trim() });
|
|
9036
9415
|
const states2 = wireStates(keysOf(form.save), model, () => void 0);
|
|
@@ -9039,7 +9418,7 @@ function addSkillBody(form, name) {
|
|
|
9039
9418
|
}
|
|
9040
9419
|
function removeSkillBody(form) {
|
|
9041
9420
|
if (form.del === null)
|
|
9042
|
-
return
|
|
9421
|
+
return drift9("this form has no delete action (it is not an existing skill)");
|
|
9043
9422
|
const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
|
|
9044
9423
|
if (!Array.isArray(states2)) return states2;
|
|
9045
9424
|
return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
|
|
@@ -9057,7 +9436,7 @@ async function fetchSkills(vanityName, client) {
|
|
|
9057
9436
|
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
9058
9437
|
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
9059
9438
|
const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
9060
|
-
if (text6 === null) return
|
|
9439
|
+
if (text6 === null) return drift9("the Skills screen carried no list request");
|
|
9061
9440
|
const payload = JSON.parse(text6);
|
|
9062
9441
|
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
9063
9442
|
const skills = [];
|
|
@@ -9182,23 +9561,23 @@ async function addSkill(name, current, vanity, skills, ctx, deps) {
|
|
|
9182
9561
|
return ok("skill", { added: added.skillId, name: added.name, verified: true });
|
|
9183
9562
|
}
|
|
9184
9563
|
async function removeSkill(arg, current, vanity, skills, ctx, deps) {
|
|
9185
|
-
const
|
|
9186
|
-
if (
|
|
9564
|
+
const target2 = current.find((s) => s.skillId === arg);
|
|
9565
|
+
if (target2 === void 0)
|
|
9187
9566
|
return err(
|
|
9188
9567
|
"skill",
|
|
9189
9568
|
"NOT_FOUND",
|
|
9190
9569
|
`no skill ${arg} on your profile`,
|
|
9191
9570
|
`your skills: ${listed(current)}`
|
|
9192
9571
|
);
|
|
9193
|
-
const form = await skills.open({ ...
|
|
9572
|
+
const form = await skills.open({ ...target2.payload, vanityName: vanity }, true);
|
|
9194
9573
|
if (!form.ok) return err("skill", form.code, form.message, form.hint);
|
|
9195
9574
|
const body = removeSkillBody(form);
|
|
9196
9575
|
if (!body.ok) return err("skill", body.code, body.message, body.hint);
|
|
9197
|
-
const name = skillNameOf(form) ??
|
|
9576
|
+
const name = skillNameOf(form) ?? target2.name ?? "?";
|
|
9198
9577
|
const plan = {
|
|
9199
9578
|
action: "remove a skill from your profile",
|
|
9200
|
-
payload: { skillId:
|
|
9201
|
-
summary: [authorLine(ctx.transport), `skill "${name}" (${
|
|
9579
|
+
payload: { skillId: target2.skillId, name },
|
|
9580
|
+
summary: [authorLine(ctx.transport), `skill "${name}" (${target2.skillId})`],
|
|
9202
9581
|
reversibility: "NONE for its endorsements, which go with it; the skill itself can be added again",
|
|
9203
9582
|
transport: "voyager"
|
|
9204
9583
|
};
|
|
@@ -9207,14 +9586,14 @@ async function removeSkill(arg, current, vanity, skills, ctx, deps) {
|
|
|
9207
9586
|
const sent = await skills.send(body.body, SKILL.delete);
|
|
9208
9587
|
if (!sent.ok) return err("skill", sent.code, sent.message, sent.hint);
|
|
9209
9588
|
const after = await skills.list(vanity);
|
|
9210
|
-
if (!after.ok || after.skills.some((s) => s.skillId ===
|
|
9589
|
+
if (!after.ok || after.skills.some((s) => s.skillId === target2.skillId)) {
|
|
9211
9590
|
return err(
|
|
9212
9591
|
"skill",
|
|
9213
9592
|
"SCHEMA_DRIFT",
|
|
9214
9593
|
"LinkedIn accepted the removal, but the skill is still listed"
|
|
9215
9594
|
);
|
|
9216
9595
|
}
|
|
9217
|
-
return ok("skill", { removed:
|
|
9596
|
+
return ok("skill", { removed: target2.skillId, verified: true });
|
|
9218
9597
|
}
|
|
9219
9598
|
async function runSkills(quiet = false) {
|
|
9220
9599
|
const session = loadSession();
|
|
@@ -9722,7 +10101,9 @@ async function dispatch(argv, now) {
|
|
|
9722
10101
|
case "whoami":
|
|
9723
10102
|
return runWhoami(bool(args, "raw"));
|
|
9724
10103
|
case "profile":
|
|
9725
|
-
return runProfile(args.positionals[0],
|
|
10104
|
+
return runProfile(args.positionals[0], output(args), void 0, {
|
|
10105
|
+
contact: bool(args, "contact")
|
|
10106
|
+
});
|
|
9726
10107
|
case "feed":
|
|
9727
10108
|
return runFeed(num(args, "limit") ?? 10, output(args));
|
|
9728
10109
|
case "post":
|
|
@@ -9758,12 +10139,12 @@ async function dispatch(argv, now) {
|
|
|
9758
10139
|
return err(command, "NOT_IMPLEMENTED", `'${command}' has no runner wired`);
|
|
9759
10140
|
}
|
|
9760
10141
|
}
|
|
9761
|
-
var
|
|
10142
|
+
var entry2 = shouldRunAsEntry(process.argv[1], import.meta.url, import.meta.main, [
|
|
9762
10143
|
"lnrelay",
|
|
9763
10144
|
"linkedin-relay-mcp"
|
|
9764
10145
|
]);
|
|
9765
|
-
if (
|
|
9766
|
-
if (
|
|
10146
|
+
if (entry2.run) {
|
|
10147
|
+
if (entry2.warning !== void 0) process.stderr.write(`${entry2.warning}
|
|
9767
10148
|
`);
|
|
9768
10149
|
const envelope = await dispatch(process.argv.slice(2), Date.now()).catch(
|
|
9769
10150
|
(e) => err(
|
|
@@ -9797,10 +10178,10 @@ async function write(command, args, now) {
|
|
|
9797
10178
|
return envelope;
|
|
9798
10179
|
}
|
|
9799
10180
|
function edit(args, now, deps) {
|
|
9800
|
-
const [
|
|
10181
|
+
const [target2, inline] = args.positionals;
|
|
9801
10182
|
if (args.flags.file === true) return err("edit", "INVALID_INPUT", "--file needs a path");
|
|
9802
10183
|
const file = str(args, "file");
|
|
9803
|
-
if (file === void 0) return runEdit(
|
|
10184
|
+
if (file === void 0) return runEdit(target2, inline, now, deps);
|
|
9804
10185
|
if (inline !== void 0) {
|
|
9805
10186
|
return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
|
|
9806
10187
|
}
|
|
@@ -9810,10 +10191,10 @@ function edit(args, now, deps) {
|
|
|
9810
10191
|
} catch {
|
|
9811
10192
|
return err("edit", "INVALID_INPUT", `cannot read ${file}`);
|
|
9812
10193
|
}
|
|
9813
|
-
return runEdit(
|
|
10194
|
+
return runEdit(target2, text6, now, deps);
|
|
9814
10195
|
}
|
|
9815
|
-
function
|
|
9816
|
-
const [sub,
|
|
10196
|
+
function role2(args, now, deps) {
|
|
10197
|
+
const [sub, target2] = args.positionals;
|
|
9817
10198
|
const valued = [
|
|
9818
10199
|
"title",
|
|
9819
10200
|
"company",
|
|
@@ -9844,7 +10225,7 @@ function role(args, now, deps) {
|
|
|
9844
10225
|
}
|
|
9845
10226
|
if (bool(args, "current")) req.current = true;
|
|
9846
10227
|
if (bool(args, "notify")) req.notify = true;
|
|
9847
|
-
return runRole(sub,
|
|
10228
|
+
return runRole(sub, target2, req, now, deps);
|
|
9848
10229
|
}
|
|
9849
10230
|
function runWrite(command, args, now, deps) {
|
|
9850
10231
|
const [first, second] = args.positionals;
|
|
@@ -9862,7 +10243,7 @@ function runWrite(command, args, now, deps) {
|
|
|
9862
10243
|
case "delete":
|
|
9863
10244
|
return runDelete(first, now, deps, bool(args, "quiet"));
|
|
9864
10245
|
case "role":
|
|
9865
|
-
return
|
|
10246
|
+
return role2(args, now, deps);
|
|
9866
10247
|
case "skill":
|
|
9867
10248
|
return runSkill(first, second, now, deps);
|
|
9868
10249
|
default:
|