linkedin-relay-mcp 1.2.1 → 1.2.3

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/dist/cli.js CHANGED
@@ -389,10 +389,16 @@ function shapeSearchRow(node) {
389
389
  url: cleanUrl(node.navigationUrl)
390
390
  });
391
391
  }
392
- function shapePost(node, index) {
392
+ function postUrn(node) {
393
393
  const meta = node.updateMetadata;
394
+ if (typeof meta?.urn === "string") return meta.urn;
395
+ const entityUrn = node.entityUrn;
396
+ if (typeof entityUrn !== "string") return void 0;
397
+ return /urn:li:(activity|ugcPost|share):\d+/.exec(entityUrn)?.[0];
398
+ }
399
+ function shapePost(node, index) {
394
400
  const actor = node.actor;
395
- const urn = typeof meta?.urn === "string" ? meta.urn : void 0;
401
+ const urn = postUrn(node);
396
402
  const social = deref(node, "*socialDetail", index);
397
403
  const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
398
404
  return defined({
@@ -1075,6 +1081,16 @@ var CONTRACTS = {
1075
1081
  },
1076
1082
  // The member's own posts. Verified 200; returns an empty collection on an
1077
1083
  // account with no posts, which is a true empty rather than a failure.
1084
+ // Needs the `fsd_profile` namespace, NOT the `fs_miniProfile` urn `whoami`
1085
+ // returns — the legacy form answers 200 with an empty result rather than an
1086
+ // error. That was invisible until the account had a post to return, and is
1087
+ // why engine.myPosts canonicalises the urn before sending it.
1088
+ //
1089
+ // KNOWN INCOMPLETE (2026-08-13): with the namespace fixed this returns the
1090
+ // owner's posts, but a post created minutes earlier did not appear here, nor
1091
+ // in `feed`, over ~1.5 hours. Whether that is an indexing lag or a coverage
1092
+ // limit of this projection is UNRESOLVED — do not treat this endpoint as an
1093
+ // authoritative "all my posts" until it is settled.
1078
1094
  myPosts: {
1079
1095
  name: "myPosts",
1080
1096
  transport: "voyager-graphql",
@@ -1402,7 +1418,11 @@ function createEngine(session, deps, quiet = false) {
1402
1418
  async myPosts(profileUrn, limit) {
1403
1419
  const contract = contractFor("myPosts");
1404
1420
  if (contract === void 0) return missingContract("myPosts");
1405
- const variables = encodeVariables({ count: Math.min(limit, 100), start: 0, profileUrn });
1421
+ const variables = encodeVariables({
1422
+ count: Math.min(limit, 100),
1423
+ start: 0,
1424
+ profileUrn: canonicalUrn(profileUrn)
1425
+ });
1406
1426
  const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1407
1427
  const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
1408
1428
  if (!res.ok) return res;
@@ -1453,13 +1473,13 @@ function createEngine(session, deps, quiet = false) {
1453
1473
  const envelope = res.json;
1454
1474
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1455
1475
  },
1456
- async post(postUrn, limit) {
1476
+ async post(postUrn2, limit) {
1457
1477
  const contract = contractFor("comments");
1458
1478
  if (contract === void 0) return missingContract("comments");
1459
1479
  const variables = encodeVariables({
1460
1480
  count: Math.min(limit, 100),
1461
1481
  numReplies: 1,
1462
- socialDetailUrn: socialDetailUrn(postUrn),
1482
+ socialDetailUrn: socialDetailUrn(postUrn2),
1463
1483
  sortOrder: "RELEVANCE",
1464
1484
  start: 0
1465
1485
  });
@@ -1475,13 +1495,13 @@ function createEngine(session, deps, quiet = false) {
1475
1495
  const envelope = res.json;
1476
1496
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1477
1497
  },
1478
- async reactions(postUrn, limit) {
1498
+ async reactions(postUrn2, limit) {
1479
1499
  const contract = contractFor("reactions");
1480
1500
  if (contract === void 0) return missingContract("reactions");
1481
1501
  const variables = encodeVariables({
1482
1502
  count: Math.min(limit, 100),
1483
1503
  start: 0,
1484
- threadUrn: postUrn
1504
+ threadUrn: postUrn2
1485
1505
  });
1486
1506
  const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1487
1507
  const res = await client.request({ url, spendClass: "page", operation: "reactions" });
@@ -1524,8 +1544,8 @@ function createEngine(session, deps, quiet = false) {
1524
1544
  }
1525
1545
  };
1526
1546
  }
1527
- function socialDetailUrn(postUrn) {
1528
- return `urn:li:fsd_socialDetail:(${postUrn},${postUrn},urn:li:highlightedReply:-)`;
1547
+ function socialDetailUrn(postUrn2) {
1548
+ return `urn:li:fsd_socialDetail:(${postUrn2},${postUrn2},urn:li:highlightedReply:-)`;
1529
1549
  }
1530
1550
  function totalResultCount(json) {
1531
1551
  const found = JSON.stringify(json ?? {}).match(/"totalResultCount":(\d+)/);
@@ -1953,8 +1973,8 @@ async function runSearch(kind, query, limit, opts = {}) {
1953
1973
  return ok("search", { query, kind, ...collection(result.value, opts) });
1954
1974
  }
1955
1975
  async function runPost(urn, limit, opts = {}) {
1956
- const postUrn = normalisePostUrn(urn);
1957
- if (postUrn === void 0) {
1976
+ const postUrn2 = normalisePostUrn(urn);
1977
+ if (postUrn2 === void 0) {
1958
1978
  return err(
1959
1979
  "post",
1960
1980
  "INVALID_INPUT",
@@ -1964,20 +1984,20 @@ async function runPost(urn, limit, opts = {}) {
1964
1984
  }
1965
1985
  const ctx = withSession("post", opts.quiet === true);
1966
1986
  if ("ok" in ctx) return ctx;
1967
- const result = await ctx.engine.post(postUrn, limit);
1987
+ const result = await ctx.engine.post(postUrn2, limit);
1968
1988
  if (!result.ok) return toEnvelope("post", result);
1969
- return ok("post", { urn: postUrn, ...collection(result.value, opts) });
1989
+ return ok("post", { urn: postUrn2, ...collection(result.value, opts) });
1970
1990
  }
1971
1991
  async function runReactions(urn, limit, opts = {}) {
1972
- const postUrn = normalisePostUrn(urn);
1973
- if (postUrn === void 0) {
1992
+ const postUrn2 = normalisePostUrn(urn);
1993
+ if (postUrn2 === void 0) {
1974
1994
  return err("reactions", "INVALID_INPUT", "a post urn or feed URL is required");
1975
1995
  }
1976
1996
  const ctx = withSession("reactions", opts.quiet === true);
1977
1997
  if ("ok" in ctx) return ctx;
1978
- const result = await ctx.engine.reactions(postUrn, limit);
1998
+ const result = await ctx.engine.reactions(postUrn2, limit);
1979
1999
  if (!result.ok) return toEnvelope("reactions", result);
1980
- return ok("reactions", { urn: postUrn, ...collection(result.value, opts) });
2000
+ return ok("reactions", { urn: postUrn2, ...collection(result.value, opts) });
1981
2001
  }
1982
2002
  function normalisePostUrn(input) {
1983
2003
  if (input === void 0 || input === "") return void 0;
@@ -3002,8 +3022,8 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
3002
3022
  note: "note" in result ? result.note : ctx.note
3003
3023
  });
3004
3024
  }
3005
- async function runComment(postUrn, text2, now = Date.now(), deps = terminalDeps()) {
3006
- if (postUrn === void 0 || text2 === void 0 || text2.trim() === "") {
3025
+ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps()) {
3026
+ if (postUrn2 === void 0 || text2 === void 0 || text2.trim() === "") {
3007
3027
  return err(
3008
3028
  "comment",
3009
3029
  "INVALID_INPUT",
@@ -3017,8 +3037,8 @@ async function runComment(postUrn, text2, now = Date.now(), deps = terminalDeps(
3017
3037
  if (unsupported !== null) return unsupported;
3018
3038
  const plan = {
3019
3039
  action: "comment on a post",
3020
- payload: { postUrn, text: text2 },
3021
- summary: [authorLine(ctx.transport), `on ${postUrn}`, `content "${text2}"`],
3040
+ payload: { postUrn: postUrn2, text: text2 },
3041
+ summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text2}"`],
3022
3042
  reversibility: "deletable from the LinkedIn UI; the author is notified immediately",
3023
3043
  transport: "oauth"
3024
3044
  };
@@ -3031,9 +3051,9 @@ async function runComment(postUrn, text2, now = Date.now(), deps = terminalDeps(
3031
3051
  return result.ok ? ok("comment", { id: result.id }) : err("comment", result.code, result.message, result.hint);
3032
3052
  }
3033
3053
  var REACTIONS = ["LIKE", "PRAISE", "EMPATHY", "INTEREST", "APPRECIATION", "ENTERTAINMENT"];
3034
- async function runReact(postUrn, type, now = Date.now(), deps = terminalDeps()) {
3054
+ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps()) {
3035
3055
  const reaction = type.toUpperCase();
3036
- if (postUrn === void 0) {
3056
+ if (postUrn2 === void 0) {
3037
3057
  return err(
3038
3058
  "react",
3039
3059
  "INVALID_INPUT",
@@ -3055,8 +3075,8 @@ async function runReact(postUrn, type, now = Date.now(), deps = terminalDeps())
3055
3075
  if (unsupported !== null) return unsupported;
3056
3076
  const plan = {
3057
3077
  action: "react to a post",
3058
- payload: { postUrn, type: reaction },
3059
- summary: [authorLine(ctx.transport), `on ${postUrn}`, `reaction ${reaction}`],
3078
+ payload: { postUrn: postUrn2, type: reaction },
3079
+ summary: [authorLine(ctx.transport), `on ${postUrn2}`, `reaction ${reaction}`],
3060
3080
  reversibility: "removable from the LinkedIn UI; the author is notified immediately",
3061
3081
  transport: "oauth"
3062
3082
  };