linkedin-relay-mcp 1.2.1 → 1.2.2

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/mcp-shim.js CHANGED
@@ -319,10 +319,16 @@ function shapeSearchRow(node) {
319
319
  url: cleanUrl(node.navigationUrl)
320
320
  });
321
321
  }
322
- function shapePost(node, index) {
322
+ function postUrn(node) {
323
323
  const meta = node.updateMetadata;
324
+ if (typeof meta?.urn === "string") return meta.urn;
325
+ const entityUrn = node.entityUrn;
326
+ if (typeof entityUrn !== "string") return void 0;
327
+ return /urn:li:(activity|ugcPost|share):\d+/.exec(entityUrn)?.[0];
328
+ }
329
+ function shapePost(node, index) {
324
330
  const actor = node.actor;
325
- const urn = typeof meta?.urn === "string" ? meta.urn : void 0;
331
+ const urn = postUrn(node);
326
332
  const social = deref(node, "*socialDetail", index);
327
333
  const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
328
334
  return defined({
@@ -975,6 +981,16 @@ var CONTRACTS = {
975
981
  },
976
982
  // The member's own posts. Verified 200; returns an empty collection on an
977
983
  // account with no posts, which is a true empty rather than a failure.
984
+ // Needs the `fsd_profile` namespace, NOT the `fs_miniProfile` urn `whoami`
985
+ // returns — the legacy form answers 200 with an empty result rather than an
986
+ // error. That was invisible until the account had a post to return, and is
987
+ // why engine.myPosts canonicalises the urn before sending it.
988
+ //
989
+ // KNOWN INCOMPLETE (2026-08-13): with the namespace fixed this returns the
990
+ // owner's posts, but a post created minutes earlier did not appear here, nor
991
+ // in `feed`, over ~1.5 hours. Whether that is an indexing lag or a coverage
992
+ // limit of this projection is UNRESOLVED — do not treat this endpoint as an
993
+ // authoritative "all my posts" until it is settled.
978
994
  myPosts: {
979
995
  name: "myPosts",
980
996
  transport: "voyager-graphql",
@@ -1302,7 +1318,11 @@ function createEngine(session, deps, quiet = false) {
1302
1318
  async myPosts(profileUrn, limit) {
1303
1319
  const contract = contractFor("myPosts");
1304
1320
  if (contract === void 0) return missingContract("myPosts");
1305
- const variables = encodeVariables({ count: Math.min(limit, 100), start: 0, profileUrn });
1321
+ const variables = encodeVariables({
1322
+ count: Math.min(limit, 100),
1323
+ start: 0,
1324
+ profileUrn: canonicalUrn(profileUrn)
1325
+ });
1306
1326
  const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1307
1327
  const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
1308
1328
  if (!res.ok) return res;
@@ -1353,13 +1373,13 @@ function createEngine(session, deps, quiet = false) {
1353
1373
  const envelope = res.json;
1354
1374
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1355
1375
  },
1356
- async post(postUrn, limit) {
1376
+ async post(postUrn2, limit) {
1357
1377
  const contract = contractFor("comments");
1358
1378
  if (contract === void 0) return missingContract("comments");
1359
1379
  const variables = encodeVariables({
1360
1380
  count: Math.min(limit, 100),
1361
1381
  numReplies: 1,
1362
- socialDetailUrn: socialDetailUrn(postUrn),
1382
+ socialDetailUrn: socialDetailUrn(postUrn2),
1363
1383
  sortOrder: "RELEVANCE",
1364
1384
  start: 0
1365
1385
  });
@@ -1375,13 +1395,13 @@ function createEngine(session, deps, quiet = false) {
1375
1395
  const envelope = res.json;
1376
1396
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1377
1397
  },
1378
- async reactions(postUrn, limit) {
1398
+ async reactions(postUrn2, limit) {
1379
1399
  const contract = contractFor("reactions");
1380
1400
  if (contract === void 0) return missingContract("reactions");
1381
1401
  const variables = encodeVariables({
1382
1402
  count: Math.min(limit, 100),
1383
1403
  start: 0,
1384
- threadUrn: postUrn
1404
+ threadUrn: postUrn2
1385
1405
  });
1386
1406
  const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1387
1407
  const res = await client.request({ url, spendClass: "page", operation: "reactions" });
@@ -1424,8 +1444,8 @@ function createEngine(session, deps, quiet = false) {
1424
1444
  }
1425
1445
  };
1426
1446
  }
1427
- function socialDetailUrn(postUrn) {
1428
- return `urn:li:fsd_socialDetail:(${postUrn},${postUrn},urn:li:highlightedReply:-)`;
1447
+ function socialDetailUrn(postUrn2) {
1448
+ return `urn:li:fsd_socialDetail:(${postUrn2},${postUrn2},urn:li:highlightedReply:-)`;
1429
1449
  }
1430
1450
  function totalResultCount(json) {
1431
1451
  const found = JSON.stringify(json ?? {}).match(/"totalResultCount":(\d+)/);
@@ -1524,8 +1544,8 @@ async function runSearch(kind, query, limit, opts = {}) {
1524
1544
  return ok("search", { query, kind, ...collection(result.value, opts) });
1525
1545
  }
1526
1546
  async function runPost(urn, limit, opts = {}) {
1527
- const postUrn = normalisePostUrn(urn);
1528
- if (postUrn === void 0) {
1547
+ const postUrn2 = normalisePostUrn(urn);
1548
+ if (postUrn2 === void 0) {
1529
1549
  return err(
1530
1550
  "post",
1531
1551
  "INVALID_INPUT",
@@ -1535,20 +1555,20 @@ async function runPost(urn, limit, opts = {}) {
1535
1555
  }
1536
1556
  const ctx = withSession("post", opts.quiet === true);
1537
1557
  if ("ok" in ctx) return ctx;
1538
- const result = await ctx.engine.post(postUrn, limit);
1558
+ const result = await ctx.engine.post(postUrn2, limit);
1539
1559
  if (!result.ok) return toEnvelope("post", result);
1540
- return ok("post", { urn: postUrn, ...collection(result.value, opts) });
1560
+ return ok("post", { urn: postUrn2, ...collection(result.value, opts) });
1541
1561
  }
1542
1562
  async function runReactions(urn, limit, opts = {}) {
1543
- const postUrn = normalisePostUrn(urn);
1544
- if (postUrn === void 0) {
1563
+ const postUrn2 = normalisePostUrn(urn);
1564
+ if (postUrn2 === void 0) {
1545
1565
  return err("reactions", "INVALID_INPUT", "a post urn or feed URL is required");
1546
1566
  }
1547
1567
  const ctx = withSession("reactions", opts.quiet === true);
1548
1568
  if ("ok" in ctx) return ctx;
1549
- const result = await ctx.engine.reactions(postUrn, limit);
1569
+ const result = await ctx.engine.reactions(postUrn2, limit);
1550
1570
  if (!result.ok) return toEnvelope("reactions", result);
1551
- return ok("reactions", { urn: postUrn, ...collection(result.value, opts) });
1571
+ return ok("reactions", { urn: postUrn2, ...collection(result.value, opts) });
1552
1572
  }
1553
1573
  function normalisePostUrn(input) {
1554
1574
  if (input === void 0 || input === "") return void 0;