MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / getDefinedStateKeys

Function getDefinedStateKeys

packages/agentflow/src/core/utils/variableUtils.ts:86–105  ·  view source on GitHub ↗
(nodes: FlowNode[])

Source from the content-addressed store, hash-verified

84 * Scans each node's state-related inputs (startState, *UpdateState) for key definitions.
85 */
86export function getDefinedStateKeys(nodes: FlowNode[]): string[] {
87 const keys = new Set<string>()
88 for (const node of nodes) {
89 const inputs = node.data?.inputs
90 if (!inputs || typeof inputs !== 'object') continue
91 for (const inputName of Object.keys(inputs)) {
92 if (!STATE_INPUT_PATTERN.test(inputName)) continue
93 const updates = inputs[inputName]
94 if (!Array.isArray(updates)) continue
95 for (const entry of updates) {
96 if (!entry || typeof entry !== 'object') continue
97 const key = (entry as StateUpdate).key?.trim()
98 if (key) {
99 keys.add(key)
100 }
101 }
102 }
103 }
104 return Array.from(keys).sort()
105}

Callers 4

AgentflowStateProviderFunction · 0.90
useFlowStateKeysFunction · 0.90
useAvailableVariablesFunction · 0.90

Calls 2

testMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected