MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / addOutput

Function addOutput

ts/workflow-builder/src/utils/functionOperations.ts:125–137  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

123// ── Outputs (declaration + assignment bundled) ─────────────────────────────────
124
125export function addOutput(id: string): void {
126 mutate(
127 id,
128 (fn) => {
129 const dataType: DataType = "string";
130 return {
131 ...fn,
132 outputs: [...fn.outputs, { uid: generateId(), name: `output${fn.outputs.length + 1}`, dataType, expression: emptyExpression(dataType) }],
133 };
134 },
135 true,
136 );
137}
138
139/** Update an output's declaration (name/dataType). A dataType change retags the
140 * bundled expression's dataType but keeps the entered text. */

Callers 1

FunctionConfigPanelFunction · 0.90

Calls 3

generateIdFunction · 0.90
mutateFunction · 0.85
emptyExpressionFunction · 0.85

Tested by

no test coverage detected