Flow related API Reference - node-red-hitachi/node-red GitHub Wiki
This page is a work in progress
Flow-related API reference
Editor
Input/Output
RED.nodes.import(newNodesObj: [node|string], createNewIds: bool, createMissingWorkspace: bool): [node], [link], [workspace], [subflow], [workspace](/node-red-hitachi/node-red/wiki/node],-[link],-[workspace],-[subflow],-[workspace)- import flow data from nodesObj or string.
RED.nodes.createExpotableNodeSet(set: [node], exportedSubflows: [string], exportedConfigNodes: [node]): [node]- Converts the current node selection to an exportable JSON Object
Basic operation
Node
RED.nodes.getNode(id: string):..- get node object by id
RED.nodes.add(n: node): void- insert node
RED.nodes.remove(id: string): {links: [link], nodes: [node]}- remove node from flow and return removed links and nodes
Subflow
RED.nodes.subflow(id: string): node- get subflow by id
RED.nodes.addSubflow(subflowObj: node, createNewIds: bool): void- add subflow
RED.nodes.removeSubflow(subflowObj)- remove subflow from Flow
Flow (tab, workspace)
RED.nodes.workspace(id: string): node- get flow by id
RED.nodes.addWorkspace(workspaceObj: node): void- add flow
RED.nodes.removeWorkspace(id: string): {links: [link], nodes: [node]}- remove flow and return removed links and nodes
RED.nodes.getWorkspaceOrder(void): [string]- get flow order
RED.nodes.setWorkspaceOrder(orderList: [string])- set flow order
Link
RED.nodes.addLink(linkObj: link): void- connect node with linkObj
RED.nodes.removeLink(linkObj): void- remove the link
Bulk operation
Node
RED.nodes.eachNode(callback: function(n: node)): void- process all nodes by callback function
RED.nodes.filterNodes(filter: node): [node]- get nodes which has same property value (z and type) of filter
Subflow
RED.nodes.eachSubflow(callback: function(n: subflow)): void- process all subflows by callback function
Flow
RED.nodes.eachWorkspace(callback: function(ws: node)): void- process all flows by callback function
Link
RED.nodes.eachLink(callback: function(l: link)): void- process all links by callback function
RED.nodes.filterLinks(filter: link): [link]- get links which has same property value of filter
Config
RED.nodes.eachConfig(callback: function(c: node)): void- process all config nodes by callback function
Others
RED.nodes.getAllFlowNodes(nodeObj: node): [node]- retrieve connected element of the node
Runtime
Input/Output
RED.nodes.load(forceStart: bool): ...- load flow from storage
(INTERNAL)parseConfig(config: [node]): ...- create internal representation from config file
Basic operation
Nodes
RED.nodes.createNode(node, def)- create node
RED.nodes.getNode(id: string): node- get node by id
Flow (tab, workspace)
RED.nodes.addFlow(flow: {nodes: [node]}): string- add set of nodes as flow, and return id string
- if id === 'global', replace all flows
RED.nodes.getFlow(id: string) :...- get flow by id
RED.nodes.updateFlow(id: string, newFlow: flow): void- replace designated flow by newFlow
- if id === 'global', replace all flows
RED.nodes.removeFlow(id: string)- remove designated flow
Bulk operation
Node
RED.nodes.eachNode(callback: function(n: node)): void- process all nodes in active flow by callback function
Flow (tab, workspace)
Others
- (INTERNAL)
diffConfigs() - (INTERNAL)
diffNodes()
External Module
(Work in progress...)
Input/Output
- FlowBundle#parseFlow(..)
- FlowBundle.serialize(..)