(node: NodeData, outputId: string)
| 21 | * entries should walk the declaration list directly via `arguments[out.id]`. |
| 22 | */ |
| 23 | export function getOutputBinding(node: NodeData, outputId: string): OutputBinding | undefined { |
| 24 | const args = node.arguments as Record<string, unknown>; |
| 25 | |
| 26 | if (node.type === "FunctionCall") { |
| 27 | return getStaticBinding(args, outputId); |
| 28 | } |
| 29 | |
| 30 | const def = NodeRegistry.getByType(node.type); |
| 31 | if (!def?.outputs) return undefined; |
| 32 | |
| 33 | for (const out of def.outputs) { |
| 34 | if (out.type === "static") { |
| 35 | if (out.id === outputId) return getStaticBinding(args, out.id); |
| 36 | } else { |
| 37 | const entries = args[out.id] as OutputDeclaration[] | undefined; |
| 38 | const entry = entries?.find((e) => e.mode === "emit" && e.uid === outputId); |
| 39 | if (entry && entry.mode === "emit") return { active: true, mode: "emit", name: entry.name }; |
| 40 | } |
| 41 | } |
| 42 | return undefined; |
| 43 | } |
| 44 | |
| 45 | // --------------------------------------------------------------------------- |
| 46 | // External input requirements for debug mode |
no test coverage detected