PlanNode
objects are the main class of nodes you will be using to traverse through the execution graph with your assertions. A PlanNode
has a number of interface definitions and methods you can use to access other nodes and edges in the execution graph, as well as the metadata of that node.
This section describes the accessors and properties of PlanNode
.
String. The capsule ID for the specified PlanNode
, including the capsule's organization namespace. For example, if the fully qualified type ID is 1.2.3-viv.foo-Bar
, then the capsuleId
is viv.foo
with the capsule organization namepsace being viv
.
String. The capsule version number of a specified PlanNode
. For example, if the fully qualified type ID is 1.2.3-viv.foo.Bar
, then the capsule version is 1.2.3
.
Array of Dialog
s executed by specified PlanNode
.
Array of Function
s executed by specified PlanNode
.
Array of incoming edges PlanEdge[]
that enter the specified PlanNode
.
For example, if PlanNode
is an action, PlanEdge[]
would contain inputs for that action.
Boolean. Returns true
if the specified PlanNode
is the goal.
Boolean. Returns true
if the specified PlanNode
is a recovery goal.
Array of Layouts
called by the specified PlanNode
.
Array of the outgoing edges PlanEdge[]
that leave the specified PlanNode
.
For example, if PlanNode
is an action, outgoingEdges
would include all outputs of that action.
Array of nodes PlanNode[]
that are parents to the specified PlanNode
.
String. Qualified type name of the specified PlanNode
. For example, if the fully qualified type ID is 1.2.3-viv.foo.Bar
, then the qualifiedType
is viv.foo.Bar
.
Array of results that the specified PlanNode
returns, if any.
Boolean. Returns true
if there are pending results from the specified PlanNode
.
Current action status of the specified PlanNode
.
Array of nodes PlanNode[]
that are children to the specified PlanNode
.
PlanNodeType
of the specified PlanNode
.
String. Fully qualified identifier of the specified PlanNode
. For example, 1.2.3-viv.foo.Bar
.
String. Type name of the specified PlanNode
. For example, if the fully qualified type ID is 1.2.3-viv.foo.Bar
, then the typeName
is Bar
.
This section contains the methods of PlanNode
.
► find(predicate: function
, direction?: FindDirection, neighbors?: boolean
): IterableIterator
.PlanNode
Find the PlanNode
objects based on the function
passed. You can also specify the direction to search.
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | function | Name of the function that you want to find |
direction | FindDirection | Direction that you want to search. Default: FindDirection.all |
neighbors | Boolean | Determines if you want to search within the immediate neighbors. Default: false |
Returns: IterableIterator.PlanNode
Consider the following example, which is equivalent to currentNode.getAllNodesByType('action')
:
const iterable = currentNode.find((node) => node.type === 'action')
const actions = Array.from(iterable)
The following example finds all concepts that have at least one dialog:
const iterable = currentNode.find((node) => node.dialogs.length > 0 && node.type === 'concept')
const conceptsWithDialog = Array.from(iterable)
► find(predicate: function
, direction?: FindDirection, neighbors?: boolean
): IterableIterator.PlanNode
Find the PlanNode
's predecessors and/or successors based on the function
passed. You can also specify the direction to search.
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | function | Name of the function that you want to find |
direction | FindDirection | Direction that you want to search. Default: FindDirection.all |
neighbors | Boolean | Determines if you want to search within the immediate neighbors. Default: false |
Returns: IterableIterator.PlanNode
► findPredecessors(predicate: function
): IterableIterator.PlanNode
Find the predecessors of specified PlanNode
based on the function passed.
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | function | Name of the function that you want to find |
Returns: IterableIterator.PlanNode
► findSuccessors(predicate: function
): IterableIterator
.PlanNode
Find the successor PlanNode
based on the function specified.
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | function | Name of the function that you want to find |
Returns: IterableIterator.PlanNode
► getAllNodesByType(type: PlanNodeType): PlanNode[]
Return a PlanNode
array based on the type specified.
Parameters:
Parameter | Type | Description |
---|---|---|
type | PlanNodeType | Type of PlanNode you want to find |
Returns: PlanNode
► getAllNodesByTypeId(qualifiedTypeId: string
): PlanNode[]
Return a PlanNode
array specified by the action type ID.
Parameters:
Parameter | Type | Description |
---|---|---|
qualifiedTypeId | String | Fully qualified name of an action ID |
Returns: PlanNode
► getEdgeBetween(node: PlanNode
): PlanEdge
Return the edges between your current node and the specified PlanNode
.
Parameters:
Parameter | Type | Description |
---|---|---|
node | PlanNode | Neighbor node to current node that you want to find the edge between |
Returns: PlanEdge
Describes the PlanNode
type. The type can be one of the following:
Determines the direction to do a search. The following values are accepted:
all
: Search both directions.predecessors
: Search all nodes or edges preceeding current node.successors
: Search all nodes or edges proceeding current node.