|
|
|
|
@ -225,21 +225,27 @@ export function createPersonLinks(
@@ -225,21 +225,27 @@ export function createPersonLinks(
|
|
|
|
|
|
|
|
|
|
const nodeMap = new Map(nodes.map((n) => [n.id, n])); |
|
|
|
|
|
|
|
|
|
const links: PersonLink = personAnchors.map((anchor) => { |
|
|
|
|
if (!anchor.connectedNodes || !anchor.pubkey) return; |
|
|
|
|
const links: PersonLink[] = personAnchors.flatMap((anchor) => { |
|
|
|
|
if (!anchor.connectedNodes || !anchor.pubkey) { |
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const connection = personMap.get(anchor.pubkey); |
|
|
|
|
if (!connection) return; |
|
|
|
|
if (!connection) { |
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ...anchor.connectedNodes.map((nodeId) => { |
|
|
|
|
return anchor.connectedNodes.map((nodeId) => { |
|
|
|
|
const node = nodeMap.get(nodeId); |
|
|
|
|
if (node) { |
|
|
|
|
// Determine connection type
|
|
|
|
|
let connectionType: "signed-by" | "referenced" | undefined; |
|
|
|
|
if (!node) { |
|
|
|
|
return undefined; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let connectionType: 'signed-by' | 'referenced' | undefined; |
|
|
|
|
if (connection.signedByEventIds.has(nodeId)) { |
|
|
|
|
connectionType = "signed-by"; |
|
|
|
|
connectionType = 'signed-by'; |
|
|
|
|
} else if (connection.referencedInEventIds.has(nodeId)) { |
|
|
|
|
connectionType = "referenced"; |
|
|
|
|
connectionType = 'referenced'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
@ -248,8 +254,7 @@ export function createPersonLinks(
@@ -248,8 +254,7 @@ export function createPersonLinks(
|
|
|
|
|
isSequential: false, |
|
|
|
|
connectionType, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}).filter(Boolean); // Remove undefineds
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
debug("Created person links", { linkCount: links.length }); |
|
|
|
|
|