Skip to main content

Flow Builder

EcoFlowBuilder is a class that is responsible for building and managing a flow of nodes and connections.

Usage​

The config class can be accessed by global ecoflow instance of the application

Example Basic usage:

const { flowEditor } = ecoflow;

const flowBuilder = flowEditor.fLowBuilder;

API Reference​

Build Node Stack​

buildStack(flowConfigurations) ⇒ Promise<[stack, configuration]>

Builds a stack of nodes based on the given flow configurations.

Return: A promise that resolves to an array containing the nodes stack and node configurations.

Available arguments :

ParameterTypeDescription
flowConfigurationsFlowsDescriptionThe flow configurations to build the stack from.

Return arguments types :

ParameterTypeDescription
stackNodesStackThe nodes stack
configurationNodeConfiguration[]An array containing the node configurations.

Fetch Node Configuration​

getNodeConfigurations(nodeID) ⇒ object | {}

Retrieves the configurations for a specific node based on the node ID.

Return: The configurations for the specified node, or an empty object if no configurations are found.

Available arguments :

ParameterTypeDescription
nodeIDstringThe ID of the node to retrieve configurations for.

Fetch Node Stack Configuration​

getStackNodeConfigurations(nodeID) ⇒ object | {}

Retrieves the configurations for a specific node in the stack.

Return: The configurations for the specified node, or an empty object if no configurations are found.

Available arguments :

ParameterTypeDescription
nodeIDstringThe ID of the node to retrieve configurations for.

Properties​

ParameterTypeDescription
stackNodesStackThe Nodes Stack as an object.
stacksConfigurationsNodeConfiguration[]An array of NodeConfiguration objects representing the stack configurations.
nodesNodesThe Nodes from the flow.
edgesNodeConnectionsThe edges of the node.
configurationsNodeConfiguration[]An array of NodeConfiguration objects representing the configurations of the node.
startingNodesNodesThe starting nodes of the graph.
responseNodesNodesThe response nodes.
consoleNodesNodesThe console nodes.

TypeScript Properties​

FlowsDescription​

interface FlowsDescription {
/** Defining a mapping of flow keys to descriptions. */
[key: string]: Describtions;
}

NodeConfiguration​

interface NodeConfiguration {
/** The unique identifier for the node. */
nodeID: string;

/** The configuration settings for the node. */
configs: {
/** The configuration settings for the node as a key value pair. */
[key: string]: any;
};
}

NodeConnections​

/**
* Represents an array of NodeConnection objects.
*/
type NodeConnections = NodeConnection[];

NodesStack​

/**
* Represents an array of Node objects.
*/
type NodesStack = Node[];

Nodes​

/**
* Represents an array of Node objects.
*/
type Nodes = Node[];