axway-flow-graph
Graph structure for parsing and manipulating flows
API Reference
axway-flow-graph~FlowValidator
Helper for validating flows. The validation checks for:
- no cyclical loops
- no undefined nodes in the routing
Kind: inner class of axway-flow-graph
Access: public
-
~FlowValidator
- new FlowValidator(flowGraph, credentialManager)
- ._strongconnect(vertex, stack, stronglyConnectedGroups)
-
._parseParamValue(param) ⇒
object
- ._addValidationError(validationData, error)
- ._addValidationWarning(validationData, warning)
-
.checkForLoops(validationData) ⇒
boolean
-
.checkForMissingRoutes(validationData) ⇒
boolean
-
.checkForInvalidStart(validationData) ⇒
boolean
-
.checkNodeOutputContext(validationData) ⇒
boolean
-
.validate() ⇒
object
new FlowValidator(flowGraph, credentialManager)
Create a flow validator.
Param | Type | Description |
---|---|---|
flowGraph | object |
a FlowGraph instance |
credentialManager | object |
a credentialManager |
flowValidator._strongconnect(vertex, stack, stronglyConnectedGroups)
Using 'Tarjan's strongly connected components algorithm' to group strongly conencted nodes (loops).
Kind: instance method of FlowValidator
Access: protected
Param | Type | Description |
---|---|---|
vertex | object |
The node/vertex to process. |
stack | array |
The stack for vertex processing. |
stronglyConnectedGroups | array |
The resulting list of strongly connected groups. |
object
flowValidator._parseParamValue(param) ⇒ Parses a parameter to a given type.
Kind: instance method of FlowValidator
Returns: object
- containing error code in 'error' or parsed value in 'data'.
Param | Type | Description |
---|---|---|
param | object |
flow node param object |
param.type | string |
type of data to parse. Defaults to jsonpaht |
param.value | string |
stringified data to be parsed |
flowValidator._addValidationError(validationData, error)
Adds a validation error to validationData
Kind: instance method of FlowValidator
Param | Type | Description |
---|---|---|
validationData | object |
Object containing the validation warnings and errors |
error | object |
Object containg an error |
flowValidator._addValidationWarning(validationData, warning)
Adds a validation warning to validationData
Kind: instance method of FlowValidator
Param | Type | Description |
---|---|---|
validationData | object |
Object containing the validation warnings and errors |
warning | object |
Object containg an warning |
boolean
flowValidator.checkForLoops(validationData) ⇒ Check for any closed loops in the graph. If there are loops loop chains are stored in validationData.errors.flowErrors.loops.
Possible errors and error codes: type: loop code: INVALID_NODE
Kind: instance method of FlowValidator
Returns: boolean
- true if there are loops detected.
Access: public
Param | Type | Description |
---|---|---|
validationData | object |
The object to add the validation errors to. |
boolean
flowValidator.checkForMissingRoutes(validationData) ⇒ Check nodes that have connections to non-existent targets. If there are undefined connections the details are are stored in validationData.errors.nodeErrors[nodeId].missingRoutes.
Possible errors and error codes: type: invalidNodeRoute code: INVALID_NODE
Kind: instance method of FlowValidator
Returns: boolean
- true if there are missing routes detected.
Access: public
Param | Type | Description |
---|---|---|
validationData | object |
The object to add the validation errors to. |
boolean
flowValidator.checkForInvalidStart(validationData) ⇒ Check start to see if it is an invalid type or pointing to a non-existant node. If start is invalid the details are are stored in validationData.errors.flowErrors.invalidStart.
Possible errors and error codes: type: invalidStart code: INVALID_NODE
Kind: instance method of FlowValidator
Returns: boolean
- true if start is invalid.
Access: public
Param | Type | Description |
---|---|---|
validationData | object |
The object to add the validation errors to. |
boolean
flowValidator.checkNodeOutputContext(validationData) ⇒ Check that the flow node output contexts are valid JSONPath selectors. If output contexts are invalid, the details are are stored in validationData.errors.nodeErrors[nodeId].invalidOuputContext.
Possible errors and error codes: type: invalidNodeOutput code: INVALID_JSONPATH
Kind: instance method of FlowValidator
Returns: boolean
- true if there are invalid ouput contexts detected.
Access: public
Param | Type | Description |
---|---|---|
validationData | object |
The object to add the validation errors to. |
object
flowValidator.validate() ⇒ Run checks on the flow and report validation errors as they are found.
Possible errors and error codes: type: loop code: INVALID_NODE
type: invalidNodeRoute code: INVALID_NODE
type: invalidStart code: INVALID_NODE
type: invalidNodeOutput code: INVALID_JSONPATH
Kind: instance method of FlowValidator
Returns: object
- the validation report
Access: public
axway-flow-graph~FlowGraph
Kind: inner class of axway-flow-graph
-
~FlowGraph
- new FlowGraph()
- new FlowGraph(flowId, flowdef)
-
._ensureVertex(vertexId, info) ⇒
object
- ._deleteVertex(vertexId)
-
._getVertexChildren(vertexId, output, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
._getVertexParents(vertexId, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
._ensureEdge(output, fromId, toId) ⇒
object
- ._deleteEdge(fromId, output, toId)
- ._deleteEdges(fromId, toId)
- ._setValidation(validation)
-
._getOutputRoutes(nodeId) ⇒
object
- ._onChange()
- ._buildGraph()
- ._buildVertex(nodeId)
- .changeNodeName(nodeId, name)
- .changeMethod(nodeId, method, nodehandler)
-
.insertNode(node, nodeId) ⇒
string
- .deleteNode(nodeId)
- .deleteRoute(output, fromId, toId)
- .deleteRoutes(fromId, toId)
- .setStart(nodeId)
- .unsetStart()
- .addParameter(nodeId, name, value, [type])
- .updateParameter(nodeId, name, prop, newValue)
-
.removeParameter(nodeId, name) ⇒
object
- .addAuthorization(nodeId, name, value, [type])
- .updateAuthorization(nodeId, name, prop, newValue)
-
.removeAuthorization(nodeId, name) ⇒
object
- ._addParameter(location, nodeId, name, value, [type])
-
._getParameter(location, nodeId, name) ⇒
object
-
._getParameterIndex(location, nodeId, name) ⇒
number
- ._updateParameter(location, nodeId, name, prop, newValue)
-
._removeParameterByName(location, nodeId, name) ⇒
object
-
._removeParameter(location, nodeId, index) ⇒
object
- .updateOutputContext(nodeId, name, value)
- .connectNode(sourceId, sourceOutput, targetId)
- .disconnectNode(sourceId, sourceOutput, targetId)
-
.isEmpty() ⇒
boolean
-
.getName() ⇒
string
- .setName(name)
-
.getDescription() ⇒
string
- .setDescription(description)
-
.getSymbol() ⇒
symbol
-
.getDefinition() ⇒
object
-
.getGraph() ⇒
object
-
.getId() ⇒
string
-
.getEdges() ⇒
Array.<object>
-
.getEdge(output, fromId, toId) ⇒
object
|null
-
.getVertices([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getNodes([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getChildren(nodeId, output, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getParents(nodeId, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getTerminalNodes([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getVertex(vertexId) ⇒
object
-
.getNode(nodeId) ⇒
object
|null
-
.getNodeUnsafe(nodeId) ⇒
object
-
.getValidation() ⇒
object
- .registerValidator(validator)
-
.validate() ⇒
object
new FlowGraph()
FlowGraph object
new FlowGraph(flowId, flowdef)
Creates an instance of FlowGraph.
Param | Type | Description |
---|---|---|
flowId | string |
The id of this flow. |
flowdef | object |
The flow definition. |
object
flowGraph._ensureVertex(vertexId, info) ⇒ Ensures that a vertex will exist
Kind: instance method of FlowGraph
Returns: object
- the vertex which matched or was created.
Access: protected
Param | Type | Description |
---|---|---|
vertexId | string |
the ID of the vertex |
info | object |
info to be set on the vertex. If vertex already exists, the info will be merged with the existing info. |
flowGraph._deleteVertex(vertexId)
Deletes a vertex from the graph
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
vertexId | string |
the id of the vertex to delete |
Array.<string>
| Array.<object>
flowGraph._getVertexChildren(vertexId, output, [idsOnly]) ⇒ Gets the children of a vertex in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the child vertices of a vertex in the flow
Param | Type | Description |
---|---|---|
vertexId | string |
the Id of the vertex to get children for. |
output | string |
the vetex output to get the children for. |
[idsOnly] | bool |
if the vertex idsOnly should be returned rather than the vertices |
Array.<string>
| Array.<object>
flowGraph._getVertexParents(vertexId, [idsOnly]) ⇒ Gets the parents of a vertex in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the parent nodes of a vertex in the flow
Param | Type | Description |
---|---|---|
vertexId | string |
the Id of the vertex to get parents for. |
[idsOnly] | bool |
if the vertex ids should be returned rather than the vertices |
object
flowGraph._ensureEdge(output, fromId, toId) ⇒ Ensures that an edge will exist between any two vertices. If any of the vertices do not exist, they will be created.
Kind: instance method of FlowGraph
Returns: object
- the edge which matched or was created.
Access: protected
Param | Type | Description |
---|---|---|
output | string |
the vertex output group the edge belongs to. |
fromId | string |
the ID of the vertex where the edge starts |
toId | string |
this ID of the vertex where the edge ends |
flowGraph._deleteEdge(fromId, output, toId)
Deletes an edge from one node to another. Removes the parent/child where necesarry from each vertex.
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
fromId | string |
the vertex where the edge starts |
output | string |
the vertex output group the edge belongs to. |
toId | string |
the vertex where the edge ends |
flowGraph._deleteEdges(fromId, toId)
Deletes the edges from one node to another (across all outputs). Removes the parent/child where necesarry from each vertex.
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
fromId | string |
the vertex where the edge starts |
toId | string |
the vertex where the edge ends |
flowGraph._setValidation(validation)
Sets the validation state on the flow definition
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
validation | object |
the validation state |
object
flowGraph._getOutputRoutes(nodeId) ⇒ Gets a list of all nodes which a node may route to grouped by output.
Kind: instance method of FlowGraph
Returns: object
- A map of IDs for routes from the node specified grouped by output.
Access: protected
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of a node to get routes for |
flowGraph._onChange()
Generates a unique symbol of the flow. Should be called whenever the flow changes.
Kind: instance method of FlowGraph
flowGraph._buildGraph()
Build a graph from the flow definition.
Kind: instance method of FlowGraph
Access: protected
flowGraph._buildVertex(nodeId)
Builds a vertex for a nodeId
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The nodeId from which to build a vertex. |
flowGraph.changeNodeName(nodeId, name)
Sets the name of a node
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
Node ID |
name | string |
New node name |
flowGraph.changeMethod(nodeId, method, nodehandler)
Modifies the method of a node to match a new spec
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The id of the node to update. |
method | string |
the method to use |
nodehandler | object |
the node handler in use |
string
flowGraph.insertNode(node, nodeId) ⇒ Inserts a node into the flow graph.
Kind: instance method of FlowGraph
Returns: string
- - the inserted nodeId
Param | Type | Description |
---|---|---|
node | object |
The node to insert. |
nodeId | string |
The id of the node to insert. If supplied, it must be unique. If not supplied, the node id will be generated. |
flowGraph.deleteNode(nodeId)
Delete a specific node from the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the id of the node to delete |
flowGraph.deleteRoute(output, fromId, toId)
Delete the output route from one node to another.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
output | string |
the output to delete the route for. |
fromId | string |
the node id the routes are being deleted from. |
toId | string |
the node id being removed from the routes. |
flowGraph.deleteRoutes(fromId, toId)
Delete all the output routes from one node to another.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
fromId | string |
the node id the routes are being deleted from. |
toId | string |
the node id being removed from the routes. |
flowGraph.setStart(nodeId)
Sets a node as the start node for the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The start node for the flow. |
flowGraph.unsetStart()
Clears the start node for the flow. This action will make the flow invalid.
Kind: instance method of FlowGraph
flowGraph.addParameter(nodeId, name, value, [type])
Adds a parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
flowGraph.updateParameter(nodeId, name, prop, newValue)
Updates a parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph.removeParameter(nodeId, name) ⇒ Removes a parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph.addAuthorization(nodeId, name, value, [type])
Adds a authorization parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
flowGraph.updateAuthorization(nodeId, name, prop, newValue)
Updates a authorization parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph.removeAuthorization(nodeId, name) ⇒ Removes a authorization parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph._addParameter(location, nodeId, name, value, [type])
Adds a parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
location | string |
the parameter location, one of: parameters | |
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
object
flowGraph._getParameter(location, nodeId, name) ⇒ Gets a parameter from the node by name
Kind: instance method of FlowGraph
Returns: object
- the parameter
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the name of the parameter |
number
flowGraph._getParameterIndex(location, nodeId, name) ⇒ Gets a parameter index from the node by name
Kind: instance method of FlowGraph
Returns: number
- the parameter index
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph._updateParameter(location, nodeId, name, prop, newValue)
Updates a parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph._removeParameterByName(location, nodeId, name) ⇒ Removes a parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | number |
the name of the parameter |
object
flowGraph._removeParameter(location, nodeId, index) ⇒ Removes a parameter by index from a node in the flow. Does not trigger change.
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
index | number |
the index of the parameter |
flowGraph.updateOutputContext(nodeId, name, value)
Modifies the JSONPath context of an output
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the output |
value | string |
the new JSONPath context |
flowGraph.connectNode(sourceId, sourceOutput, targetId)
Connects a node output to the specified target.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
sourceId | string |
The source node for the connection. |
sourceOutput | string |
The output in the source node for the connection. |
targetId | string |
The id of the target node to connect to. |
flowGraph.disconnectNode(sourceId, sourceOutput, targetId)
Disconnects a target node from a parent node's source and output.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
sourceId | string |
The source node for the connection. |
sourceOutput | string |
The output in the source node for the connection. |
targetId | string |
The id of the target node to connect to. |
boolean
flowGraph.isEmpty() ⇒ Indicates if the flow is empty, with no nodes.
Kind: instance method of FlowGraph
Returns: boolean
- true
if the flow is empty.
string
flowGraph.getName() ⇒ Gets the name of the flow from flow info meta-data.
Kind: instance method of FlowGraph
Returns: string
- The flow name.
flowGraph.setName(name)
Sets the name of the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
name | string |
The flow name. |
string
flowGraph.getDescription() ⇒ Gets the description of the flow from flow info meta-data.
Kind: instance method of FlowGraph
Returns: string
- The flow description.
flowGraph.setDescription(description)
Sets the description of the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
description | string |
The flow description. |
symbol
flowGraph.getSymbol() ⇒ Get the unique symbol of the flow
Kind: instance method of FlowGraph
Returns: symbol
- the flow symbol
object
flowGraph.getDefinition() ⇒ Gets the definition of the flow
Kind: instance method of FlowGraph
Returns: object
- the flow definition
object
flowGraph.getGraph() ⇒ Gets the graph representation of the flow
Kind: instance method of FlowGraph
Returns: object
- the flow graph representation
string
flowGraph.getId() ⇒ Gets the Id of the flow
Kind: instance method of FlowGraph
Returns: string
- the flow id
Array.<object>
flowGraph.getEdges() ⇒ Gets the edges of the flow graph
Kind: instance method of FlowGraph
Returns: Array.<object>
- the edges of the graph
object
| null
flowGraph.getEdge(output, fromId, toId) ⇒ Get the edge between two nodes.
Kind: instance method of FlowGraph
Returns: object
| null
- the edge between two nodes. Null if no edge exists.
Param | Type | Description |
---|---|---|
output | string |
the node output the edges belong to. |
fromId | string |
the ID of the vertex where the edge starts |
toId | string |
this ID of the vertex where the edge ends |
Array.<string>
| Array.<object>
flowGraph.getVertices([idsOnly]) ⇒ Gets the vertices of the graph
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the vertices of the graph
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the vertex ids should be returned rather than the vertices |
Array.<string>
| Array.<object>
flowGraph.getNodes([idsOnly]) ⇒ Gets the nodes of the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the nodes of the flow
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getChildren(nodeId, output, [idsOnly]) ⇒ Gets the children of a node in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the child nodes of a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the Id of the node to get children for. |
output | string |
the node output to get the children for. If omitted then all children are returned. |
[idsOnly] | bool |
if the node idsOnly should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getParents(nodeId, [idsOnly]) ⇒ Gets the parents of a node in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the parent nodes of a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the Id of the node to get parents for. |
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getTerminalNodes([idsOnly]) ⇒ Gets the terminal nodes of the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the terminal nodes of the flow
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
object
flowGraph.getVertex(vertexId) ⇒ Get the vertex which matches the ID specified
Kind: instance method of FlowGraph
Returns: object
- a vertex in the graph
Param | Type | Description |
---|---|---|
vertexId | string |
the ID of the vertex to return |
object
| null
flowGraph.getNode(nodeId) ⇒ Get the node which matches the ID specified
Kind: instance method of FlowGraph
Returns: object
| null
- a node in the flow, or null
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of the node to return |
object
flowGraph.getNodeUnsafe(nodeId) ⇒ Get the node which matches the ID specified and will throw an error if node was not found. Call this if you expect the node to exist
Kind: instance method of FlowGraph
Returns: object
- a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of the node to return |
object
flowGraph.getValidation() ⇒ Get the validation state of the flow
Kind: instance method of FlowGraph
Returns: object
- the validation state of the flow
flowGraph.registerValidator(validator)
Registers a FlowValidator type class to the flow. When validation is run, this class will be used to validate the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
validator | FlowValidator |
A class which is a FlowValidator |
object
flowGraph.validate() ⇒ Validate the flow - check all the nodes, no cycles, syntax, etc. Update the definition to make validation report available to clients
Kind: instance method of FlowGraph
Returns: object
- the validation state
axway-flow-graph~FlowGraph
Kind: inner class of axway-flow-graph
-
~FlowGraph
- new FlowGraph()
- new FlowGraph(flowId, flowdef)
-
._ensureVertex(vertexId, info) ⇒
object
- ._deleteVertex(vertexId)
-
._getVertexChildren(vertexId, output, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
._getVertexParents(vertexId, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
._ensureEdge(output, fromId, toId) ⇒
object
- ._deleteEdge(fromId, output, toId)
- ._deleteEdges(fromId, toId)
- ._setValidation(validation)
-
._getOutputRoutes(nodeId) ⇒
object
- ._onChange()
- ._buildGraph()
- ._buildVertex(nodeId)
- .changeNodeName(nodeId, name)
- .changeMethod(nodeId, method, nodehandler)
-
.insertNode(node, nodeId) ⇒
string
- .deleteNode(nodeId)
- .deleteRoute(output, fromId, toId)
- .deleteRoutes(fromId, toId)
- .setStart(nodeId)
- .unsetStart()
- .addParameter(nodeId, name, value, [type])
- .updateParameter(nodeId, name, prop, newValue)
-
.removeParameter(nodeId, name) ⇒
object
- .addAuthorization(nodeId, name, value, [type])
- .updateAuthorization(nodeId, name, prop, newValue)
-
.removeAuthorization(nodeId, name) ⇒
object
- ._addParameter(location, nodeId, name, value, [type])
-
._getParameter(location, nodeId, name) ⇒
object
-
._getParameterIndex(location, nodeId, name) ⇒
number
- ._updateParameter(location, nodeId, name, prop, newValue)
-
._removeParameterByName(location, nodeId, name) ⇒
object
-
._removeParameter(location, nodeId, index) ⇒
object
- .updateOutputContext(nodeId, name, value)
- .connectNode(sourceId, sourceOutput, targetId)
- .disconnectNode(sourceId, sourceOutput, targetId)
-
.isEmpty() ⇒
boolean
-
.getName() ⇒
string
- .setName(name)
-
.getDescription() ⇒
string
- .setDescription(description)
-
.getSymbol() ⇒
symbol
-
.getDefinition() ⇒
object
-
.getGraph() ⇒
object
-
.getId() ⇒
string
-
.getEdges() ⇒
Array.<object>
-
.getEdge(output, fromId, toId) ⇒
object
|null
-
.getVertices([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getNodes([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getChildren(nodeId, output, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getParents(nodeId, [idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getTerminalNodes([idsOnly]) ⇒
Array.<string>
|Array.<object>
-
.getVertex(vertexId) ⇒
object
-
.getNode(nodeId) ⇒
object
|null
-
.getNodeUnsafe(nodeId) ⇒
object
-
.getValidation() ⇒
object
- .registerValidator(validator)
-
.validate() ⇒
object
new FlowGraph()
FlowGraph object
new FlowGraph(flowId, flowdef)
Creates an instance of FlowGraph.
Param | Type | Description |
---|---|---|
flowId | string |
The id of this flow. |
flowdef | object |
The flow definition. |
object
flowGraph._ensureVertex(vertexId, info) ⇒ Ensures that a vertex will exist
Kind: instance method of FlowGraph
Returns: object
- the vertex which matched or was created.
Access: protected
Param | Type | Description |
---|---|---|
vertexId | string |
the ID of the vertex |
info | object |
info to be set on the vertex. If vertex already exists, the info will be merged with the existing info. |
flowGraph._deleteVertex(vertexId)
Deletes a vertex from the graph
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
vertexId | string |
the id of the vertex to delete |
Array.<string>
| Array.<object>
flowGraph._getVertexChildren(vertexId, output, [idsOnly]) ⇒ Gets the children of a vertex in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the child vertices of a vertex in the flow
Param | Type | Description |
---|---|---|
vertexId | string |
the Id of the vertex to get children for. |
output | string |
the vetex output to get the children for. |
[idsOnly] | bool |
if the vertex idsOnly should be returned rather than the vertices |
Array.<string>
| Array.<object>
flowGraph._getVertexParents(vertexId, [idsOnly]) ⇒ Gets the parents of a vertex in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the parent nodes of a vertex in the flow
Param | Type | Description |
---|---|---|
vertexId | string |
the Id of the vertex to get parents for. |
[idsOnly] | bool |
if the vertex ids should be returned rather than the vertices |
object
flowGraph._ensureEdge(output, fromId, toId) ⇒ Ensures that an edge will exist between any two vertices. If any of the vertices do not exist, they will be created.
Kind: instance method of FlowGraph
Returns: object
- the edge which matched or was created.
Access: protected
Param | Type | Description |
---|---|---|
output | string |
the vertex output group the edge belongs to. |
fromId | string |
the ID of the vertex where the edge starts |
toId | string |
this ID of the vertex where the edge ends |
flowGraph._deleteEdge(fromId, output, toId)
Deletes an edge from one node to another. Removes the parent/child where necesarry from each vertex.
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
fromId | string |
the vertex where the edge starts |
output | string |
the vertex output group the edge belongs to. |
toId | string |
the vertex where the edge ends |
flowGraph._deleteEdges(fromId, toId)
Deletes the edges from one node to another (across all outputs). Removes the parent/child where necesarry from each vertex.
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
fromId | string |
the vertex where the edge starts |
toId | string |
the vertex where the edge ends |
flowGraph._setValidation(validation)
Sets the validation state on the flow definition
Kind: instance method of FlowGraph
Access: protected
Param | Type | Description |
---|---|---|
validation | object |
the validation state |
object
flowGraph._getOutputRoutes(nodeId) ⇒ Gets a list of all nodes which a node may route to grouped by output.
Kind: instance method of FlowGraph
Returns: object
- A map of IDs for routes from the node specified grouped by output.
Access: protected
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of a node to get routes for |
flowGraph._onChange()
Generates a unique symbol of the flow. Should be called whenever the flow changes.
Kind: instance method of FlowGraph
flowGraph._buildGraph()
Build a graph from the flow definition.
Kind: instance method of FlowGraph
Access: protected
flowGraph._buildVertex(nodeId)
Builds a vertex for a nodeId
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The nodeId from which to build a vertex. |
flowGraph.changeNodeName(nodeId, name)
Sets the name of a node
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
Node ID |
name | string |
New node name |
flowGraph.changeMethod(nodeId, method, nodehandler)
Modifies the method of a node to match a new spec
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The id of the node to update. |
method | string |
the method to use |
nodehandler | object |
the node handler in use |
string
flowGraph.insertNode(node, nodeId) ⇒ Inserts a node into the flow graph.
Kind: instance method of FlowGraph
Returns: string
- - the inserted nodeId
Param | Type | Description |
---|---|---|
node | object |
The node to insert. |
nodeId | string |
The id of the node to insert. If supplied, it must be unique. If not supplied, the node id will be generated. |
flowGraph.deleteNode(nodeId)
Delete a specific node from the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the id of the node to delete |
flowGraph.deleteRoute(output, fromId, toId)
Delete the output route from one node to another.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
output | string |
the output to delete the route for. |
fromId | string |
the node id the routes are being deleted from. |
toId | string |
the node id being removed from the routes. |
flowGraph.deleteRoutes(fromId, toId)
Delete all the output routes from one node to another.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
fromId | string |
the node id the routes are being deleted from. |
toId | string |
the node id being removed from the routes. |
flowGraph.setStart(nodeId)
Sets a node as the start node for the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
The start node for the flow. |
flowGraph.unsetStart()
Clears the start node for the flow. This action will make the flow invalid.
Kind: instance method of FlowGraph
flowGraph.addParameter(nodeId, name, value, [type])
Adds a parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
flowGraph.updateParameter(nodeId, name, prop, newValue)
Updates a parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph.removeParameter(nodeId, name) ⇒ Removes a parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph.addAuthorization(nodeId, name, value, [type])
Adds a authorization parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
flowGraph.updateAuthorization(nodeId, name, prop, newValue)
Updates a authorization parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph.removeAuthorization(nodeId, name) ⇒ Removes a authorization parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph._addParameter(location, nodeId, name, value, [type])
Adds a parameter to a node in the flow
Kind: instance method of FlowGraph
Param | Type | Default | Description |
---|---|---|---|
location | string |
the parameter location, one of: parameters | |
nodeId | string |
the node id | |
name | string |
the name of the parameter | |
value | string |
the value of the parameter | |
[type] | string |
"jsonpath" |
the type of the parameter. |
object
flowGraph._getParameter(location, nodeId, name) ⇒ Gets a parameter from the node by name
Kind: instance method of FlowGraph
Returns: object
- the parameter
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the name of the parameter |
number
flowGraph._getParameterIndex(location, nodeId, name) ⇒ Gets a parameter index from the node by name
Kind: instance method of FlowGraph
Returns: number
- the parameter index
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the name of the parameter |
flowGraph._updateParameter(location, nodeId, name, prop, newValue)
Updates a parameter from a node in the flow
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | string |
the current name of the parameter |
prop |
string | object
|
the field to update (name |
newValue | string |
the new value of the prop specified if it is a string |
object
flowGraph._removeParameterByName(location, nodeId, name) ⇒ Removes a parameter by name from a node in the flow
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
name | number |
the name of the parameter |
object
flowGraph._removeParameter(location, nodeId, index) ⇒ Removes a parameter by index from a node in the flow. Does not trigger change.
Kind: instance method of FlowGraph
Returns: object
- the parameter that was removed
Param | Type | Description |
---|---|---|
location | string |
the parameter location, one of: parameters |
nodeId | string |
the node id |
index | number |
the index of the parameter |
flowGraph.updateOutputContext(nodeId, name, value)
Modifies the JSONPath context of an output
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
nodeId | string |
the node id |
name | string |
the name of the output |
value | string |
the new JSONPath context |
flowGraph.connectNode(sourceId, sourceOutput, targetId)
Connects a node output to the specified target.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
sourceId | string |
The source node for the connection. |
sourceOutput | string |
The output in the source node for the connection. |
targetId | string |
The id of the target node to connect to. |
flowGraph.disconnectNode(sourceId, sourceOutput, targetId)
Disconnects a target node from a parent node's source and output.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
sourceId | string |
The source node for the connection. |
sourceOutput | string |
The output in the source node for the connection. |
targetId | string |
The id of the target node to connect to. |
boolean
flowGraph.isEmpty() ⇒ Indicates if the flow is empty, with no nodes.
Kind: instance method of FlowGraph
Returns: boolean
- true
if the flow is empty.
string
flowGraph.getName() ⇒ Gets the name of the flow from flow info meta-data.
Kind: instance method of FlowGraph
Returns: string
- The flow name.
flowGraph.setName(name)
Sets the name of the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
name | string |
The flow name. |
string
flowGraph.getDescription() ⇒ Gets the description of the flow from flow info meta-data.
Kind: instance method of FlowGraph
Returns: string
- The flow description.
flowGraph.setDescription(description)
Sets the description of the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
description | string |
The flow description. |
symbol
flowGraph.getSymbol() ⇒ Get the unique symbol of the flow
Kind: instance method of FlowGraph
Returns: symbol
- the flow symbol
object
flowGraph.getDefinition() ⇒ Gets the definition of the flow
Kind: instance method of FlowGraph
Returns: object
- the flow definition
object
flowGraph.getGraph() ⇒ Gets the graph representation of the flow
Kind: instance method of FlowGraph
Returns: object
- the flow graph representation
string
flowGraph.getId() ⇒ Gets the Id of the flow
Kind: instance method of FlowGraph
Returns: string
- the flow id
Array.<object>
flowGraph.getEdges() ⇒ Gets the edges of the flow graph
Kind: instance method of FlowGraph
Returns: Array.<object>
- the edges of the graph
object
| null
flowGraph.getEdge(output, fromId, toId) ⇒ Get the edge between two nodes.
Kind: instance method of FlowGraph
Returns: object
| null
- the edge between two nodes. Null if no edge exists.
Param | Type | Description |
---|---|---|
output | string |
the node output the edges belong to. |
fromId | string |
the ID of the vertex where the edge starts |
toId | string |
this ID of the vertex where the edge ends |
Array.<string>
| Array.<object>
flowGraph.getVertices([idsOnly]) ⇒ Gets the vertices of the graph
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the vertices of the graph
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the vertex ids should be returned rather than the vertices |
Array.<string>
| Array.<object>
flowGraph.getNodes([idsOnly]) ⇒ Gets the nodes of the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the nodes of the flow
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getChildren(nodeId, output, [idsOnly]) ⇒ Gets the children of a node in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the child nodes of a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the Id of the node to get children for. |
output | string |
the node output to get the children for. If omitted then all children are returned. |
[idsOnly] | bool |
if the node idsOnly should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getParents(nodeId, [idsOnly]) ⇒ Gets the parents of a node in the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the parent nodes of a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the Id of the node to get parents for. |
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
Array.<string>
| Array.<object>
flowGraph.getTerminalNodes([idsOnly]) ⇒ Gets the terminal nodes of the flow
Kind: instance method of FlowGraph
Returns: Array.<string>
| Array.<object>
- the terminal nodes of the flow
Param | Type | Description |
---|---|---|
[idsOnly] | bool |
if the node ids should be returned rather than the nodes |
object
flowGraph.getVertex(vertexId) ⇒ Get the vertex which matches the ID specified
Kind: instance method of FlowGraph
Returns: object
- a vertex in the graph
Param | Type | Description |
---|---|---|
vertexId | string |
the ID of the vertex to return |
object
| null
flowGraph.getNode(nodeId) ⇒ Get the node which matches the ID specified
Kind: instance method of FlowGraph
Returns: object
| null
- a node in the flow, or null
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of the node to return |
object
flowGraph.getNodeUnsafe(nodeId) ⇒ Get the node which matches the ID specified and will throw an error if node was not found. Call this if you expect the node to exist
Kind: instance method of FlowGraph
Returns: object
- a node in the flow
Param | Type | Description |
---|---|---|
nodeId | string |
the ID of the node to return |
object
flowGraph.getValidation() ⇒ Get the validation state of the flow
Kind: instance method of FlowGraph
Returns: object
- the validation state of the flow
flowGraph.registerValidator(validator)
Registers a FlowValidator type class to the flow. When validation is run, this class will be used to validate the flow.
Kind: instance method of FlowGraph
Param | Type | Description |
---|---|---|
validator | FlowValidator |
A class which is a FlowValidator |
object
flowGraph.validate() ⇒ Validate the flow - check all the nodes, no cycles, syntax, etc. Update the definition to make validation report available to clients
Kind: instance method of FlowGraph
Returns: object
- the validation state
Array.<string>
| array
axway-flow-graph~objectToArray(object, map) ⇒ Converts an object into an array of keys or values
Kind: inner method of axway-flow-graph
Returns: Array.<string>
| array
- an array of values based on the map.
Param | Type | Description |
---|---|---|
object | object |
the object to convert into an array |
map |
function | bool
|
if true, return all the keys of the object if false, return all the values of the object if function, map object keys to array values. |
object
axway-flow-graph~validateJsonPathSelector(path) ⇒ Validates a JSONPath selector
Kind: inner method of axway-flow-graph
Returns: object
- - Validation error only if the selector is not valid
Param | Type | Description |
---|---|---|
path | string |
JSONPath selector to validate |
Building
npm run build
Author
Axway support@axway.com https://axway.com
License
This code is proprietary, closed source software licensed to you by Axway. All Rights Reserved. You may not modify Axway’s code without express written permission of Axway. You are licensed to use and distribute your services developed with the use of this software and dependencies, including distributing reasonable and appropriate portions of the Axway code and dependencies. Except as set forth above, this code MUST not be copied or otherwise redistributed without express written permission of Axway. This module is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement (General Conditions) located here: https://support.axway.com/en/auth/general-conditions; EXCEPT THAT IF YOU RECEIVED A FREE SUBSCRIPTION, LICENSE, OR SUPPORT SUBSCRIPTION FOR THIS CODE, NOTWITHSTANDING THE LANGUAGE OF THE GENERAL CONDITIONS, AXWAY HEREBY DISCLAIMS ALL SUPPORT AND MAINTENANCE OBLIGATIONS, AS WELL AS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO IMPLIED INFRINGEMENT WARRANTIES, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND YOU ACCEPT THE PRODUCT AS-IS AND WITH ALL FAULTS, SOLELY AT YOUR OWN RISK. Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.