mirror of
https://github.com/morluto/rea.git
synced 2026-11-08 07:46:28 +00:00
refactor(domain): split analysis boundaries
This commit is contained in:
1 parent
2e5b44365f
commit
e2c868c4bd
18 files changed
+2920
-2679
No files matched your search
@@ -250,39 +250,41 @@ const relationshipSignature = (
|
||||
const signatures = graph.edges.flatMap((edge) => {
|
||||
if (edge.source_node_id === node.node_id)
|
||||
return [
|
||||
edgeSignature(
|
||||
"out",
|
||||
edge.relation,
|
||||
edge.target_node_id,
|
||||
edgeSignature({
|
||||
direction: "out",
|
||||
relation: edge.relation,
|
||||
neighborId: edge.target_node_id,
|
||||
paired,
|
||||
nodeById,
|
||||
),
|
||||
}),
|
||||
];
|
||||
if (edge.target_node_id === node.node_id)
|
||||
return [
|
||||
edgeSignature(
|
||||
"in",
|
||||
edge.relation,
|
||||
edge.source_node_id,
|
||||
edgeSignature({
|
||||
direction: "in",
|
||||
relation: edge.relation,
|
||||
neighborId: edge.source_node_id,
|
||||
paired,
|
||||
nodeById,
|
||||
),
|
||||
}),
|
||||
];
|
||||
return [];
|
||||
});
|
||||
return canonical(signatures.sort(compareCodePoints));
|
||||
};
|
||||
|
||||
const edgeSignature = (
|
||||
direction: "in" | "out",
|
||||
relation: ApplicationEdge["relation"],
|
||||
neighborId: string,
|
||||
paired: ReadonlyMap<string, string>,
|
||||
nodeById: ReadonlyMap<string, ApplicationNode>,
|
||||
): string => {
|
||||
const mapped = paired.get(neighborId);
|
||||
const neighbor = nodeById.get(neighborId);
|
||||
return `${direction}\0${relation}\0${mapped ?? `unmatched:${neighbor?.kind ?? "unknown"}`}`;
|
||||
interface EdgeSignatureContext {
|
||||
readonly direction: "in" | "out";
|
||||
readonly relation: ApplicationEdge["relation"];
|
||||
readonly neighborId: string;
|
||||
readonly paired: ReadonlyMap<string, string>;
|
||||
readonly nodeById: ReadonlyMap<string, ApplicationNode>;
|
||||
}
|
||||
|
||||
const edgeSignature = (context: EdgeSignatureContext): string => {
|
||||
const mapped = context.paired.get(context.neighborId);
|
||||
const neighbor = context.nodeById.get(context.neighborId);
|
||||
return `${context.direction}\0${context.relation}\0${mapped ?? `unmatched:${neighbor?.kind ?? "unknown"}`}`;
|
||||
};
|
||||
|
||||
const itemEvidenceLinks = (
|
||||
|
||||
Reference in new issue
Block a user