MCPcopy
hub / github.com/lightningpixel/modly / resolveDataSource

Function resolveDataSource

src/areas/workflows/nodeBehaviors.ts:43–57  ·  view source on GitHub ↗
(
  sourceId: string,
  edges:    WFEdge[],
  nodeMap:  Map<string, WFNode>,
)

Source from the content-addressed store, hash-verified

41 * undefined if a passthrough has no incoming edge.
42 */
43export function resolveDataSource(
44 sourceId: string,
45 edges: WFEdge[],
46 nodeMap: Map<string, WFNode>,
47): string | undefined {
48 let cur = sourceId
49 const seen = new Set<string>()
50 while (isPassthrough(nodeMap.get(cur)?.type) && !seen.has(cur)) {
51 seen.add(cur)
52 const parent = edges.find((e) => e.target === cur)
53 if (!parent) return undefined
54 cur = parent.source
55 }
56 return cur
57}
58
59/**
60 * Walks backwards from `nodeId` and returns the set of nearest upstream

Callers 3

resolveSourceFunction · 0.90
pushBranchSceneMeshFunction · 0.90

Calls 1

isPassthroughFunction · 0.85

Tested by

no test coverage detected