linkedin-relay-mcp 2.0.0 → 2.0.1
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 +25 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1673,10 +1673,14 @@ function sduiEnvelope(operation, payload, states2 = []) {
|
|
|
1673
1673
|
requestedArguments: { ...args, states: states2, screenId: SCREEN_ID, knownTemplateIds: [] }
|
|
1674
1674
|
};
|
|
1675
1675
|
}
|
|
1676
|
-
function menuBody(
|
|
1676
|
+
function menuBody(ref, trackingId) {
|
|
1677
|
+
const { activityId, commentId, threadType } = ref;
|
|
1677
1678
|
const activityUrn = { activityUrn: { activityId } };
|
|
1678
1679
|
return sduiEnvelope(MENU_OP, {
|
|
1679
|
-
|
|
1680
|
+
// Rebuilt in the namespace it came from. A comment threaded to a ugcPost
|
|
1681
|
+
// given an `urn:li:activity:` thread names a different entity, and that
|
|
1682
|
+
// does not error — it acts on the wrong thing or finds nothing.
|
|
1683
|
+
commentUrn: { commentId, thread: `urn:li:${threadType}:${activityId}` },
|
|
1680
1684
|
updateKey: {
|
|
1681
1685
|
feedType: 3,
|
|
1682
1686
|
items: [{ feedUpdateUrn: { updateUrnActivityUrn: activityUrn }, trackingId }],
|
|
@@ -1719,11 +1723,11 @@ function extractActionPayload(stream, operation) {
|
|
|
1719
1723
|
}
|
|
1720
1724
|
return null;
|
|
1721
1725
|
}
|
|
1722
|
-
async function fetchCommentMenu(
|
|
1726
|
+
async function fetchCommentMenu(ref, trackingId, client) {
|
|
1723
1727
|
const result = await client.request({
|
|
1724
1728
|
url: actionUrl(MENU_OP),
|
|
1725
1729
|
method: "POST",
|
|
1726
|
-
body: menuBody(
|
|
1730
|
+
body: menuBody(ref, trackingId),
|
|
1727
1731
|
spendClass: "page",
|
|
1728
1732
|
operation: "commentMenu"
|
|
1729
1733
|
});
|
|
@@ -1756,7 +1760,7 @@ function editStates(payload, text2) {
|
|
|
1756
1760
|
];
|
|
1757
1761
|
}
|
|
1758
1762
|
async function runCommentAction(ref, operation, trackingId, client, newText) {
|
|
1759
|
-
const menu = await fetchCommentMenu(ref
|
|
1763
|
+
const menu = await fetchCommentMenu(ref, trackingId, client);
|
|
1760
1764
|
if (!menu.ok) return { ok: false, code: menu.code, message: menu.message };
|
|
1761
1765
|
const payload = extractActionPayload(menu.stream, operation);
|
|
1762
1766
|
if (payload === null) {
|
|
@@ -1799,10 +1803,22 @@ async function runCommentAction(ref, operation, trackingId, client, newText) {
|
|
|
1799
1803
|
return { ok: true, operation };
|
|
1800
1804
|
}
|
|
1801
1805
|
function parseCommentUrn(urn) {
|
|
1802
|
-
const fsd = /^urn:li:fsd_comment:\((\d+),urn:li:activity:(\d+)\)$/.exec(urn);
|
|
1803
|
-
if (fsd !== null)
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
+
const fsd = /^urn:li:fsd_comment:\((\d+),urn:li:(activity|ugcPost):(\d+)\)$/.exec(urn);
|
|
1807
|
+
if (fsd !== null) {
|
|
1808
|
+
return {
|
|
1809
|
+
commentId: fsd[1],
|
|
1810
|
+
threadType: fsd[2],
|
|
1811
|
+
activityId: fsd[3]
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
const plain = /^urn:li:comment:\((?:urn:li:)?(activity|ugcPost):(\d+),(\d+)\)$/.exec(urn);
|
|
1815
|
+
if (plain !== null) {
|
|
1816
|
+
return {
|
|
1817
|
+
threadType: plain[1],
|
|
1818
|
+
activityId: plain[2],
|
|
1819
|
+
commentId: plain[3]
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1806
1822
|
return null;
|
|
1807
1823
|
}
|
|
1808
1824
|
|