Bixby Developer Center

References

Assertions Reference

This reference guide lists all the available methods for accessing nodes while developing assertions.

Step

All assertion models start with a step. A step is a global object that forms the basis of an assertion model, and allows you to access execution data from your capsule through your story.

A step object has the following properties:

PropertyTypeValue
currentNodeobjectA PlanNode that points to the node your step is currently on in the execution graph.
dialogsarrayOne or more Dialog elements.
isInterruptedbooleantrue if an action in your step is interrupted.

PlanNode

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.

A PlanNode object has the following properties:

PropertyTypeValue
capsuleIdstringCapsule ID of the PlanNode, including the organization namespace.
capsuleVersionstringCapsule version of the PlanNode.
dialogsarrayDialog elements executed by the PlanNode.
functionsarrayFunction elements executed by the PlanNode.
incomingEdgesarrayEdges (PlanEdge) entering the PlanNode. For example, if PlanNode is an action, PlanEdge[] would contain inputs for that action.
isGoalbooleantrue if the PlanNode is the goal.
isRecoveryGoalbooleantrue if the PlanNode is a recovery goal.
layoutsarrayLayout elements called by the PlanNode.
outgoingEdgesarrayEdges (PlanEdge) leaving the PlanNode. For example, if PlanNode is an action, PlanEdge[] would contain outputs for that action.
predecessorsarrayPlanNode elements that are parents of the current PlanNode.
qualifiedTypestringQualified type of the PlanNode.
resultsarrayResults the PlanNode returns, if any.
resultsPendingbooleantrue if there are pending results from the PlanNode.
actionStatusstringCurrent action status of the PlanNode.
successorsarrayPlanNode elements that are children of the current PlanNode.
typeobjectPlanNodeType of the PlanNode.
typeNamestringType name of the specified PlanNode.

Several PlanNode properties return parts of the node's fully qualified type, which consists of the capsule version, capsule ID (organization namespace and capsule name), and the relevant model.

  • Fully Qualified Type: 1.2.3-viv.foo.Bar
  • Capsule ID: viv.foo
  • Capsule Version: 1.2.3
  • Qualified Type: viv.foo.Bar
  • Type Name: Bar

A PlanNode object has the following methods:

find()

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:

ParameterTypeDescription
predicatefunctionName of the function that you want to find.
directionFindDirectionDirection that you want to search. Default: FindDirection.all.
neighborsBooleanDetermines 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)

findNeighbors()

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:

ParameterTypeDescription
predicatefunctionName of the function that you want to find
directionFindDirectionDirection that you want to search. Default: FindDirection.all
neighborsBooleanDetermines if you want to search within the immediate neighbors. Default: false

Returns: IterableIterator.PlanNode

findPredecessors()

findPredecessors(predicate: function): IterableIterator.PlanNode

Find the predecessors of specified PlanNode based on the function passed.

Parameters:

ParameterTypeDescription
predicatefunctionName of the function that you want to find

Returns: IterableIterator.PlanNode

findSuccessors()

findSuccessors(predicate: function): IterableIterator.PlanNode

Find the successor PlanNode based on the function specified.

Parameters:

ParameterTypeDescription
predicatefunctionName of the function that you want to find

Returns: IterableIterator.PlanNode

getAllNodesByType()

getAllNodesByType(type: PlanNodeType): PlanNode[]

Return a PlanNode array based on the type specified.

Parameters:

ParameterTypeDescription
typePlanNodeTypeType of PlanNode you want to find

Returns: PlanNode

getAllNodesByTypeId()

getAllNodesByTypeId(qualifiedTypeId: string): PlanNode[]

Return a PlanNode array specified by the action type ID.

Parameters:

ParameterTypeDescription
qualifiedTypeIdStringFully qualified name of an action ID

Returns: PlanNode

getEdgeBetween()

getEdgeBetween(node: PlanNode): PlanEdge

Return the edges between your current node and the specified PlanNode.

Parameters:

ParameterTypeDescription
nodePlanNodeNeighbor node to current node that you want to find the edge between

Returns: PlanEdge

PlanNodeType

Describes the PlanNode type. The type can be one of the following:

FindDirection

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.

Dialog

The Dialog object represents the dialog events that happen in your execution graph.

A Dialog object has the following properties:

PropertyTypeValue
bindingstringThe values of particular properties of concepts in templates. (Optional)
capsuleIdstringThe fully qualified capsule ID. (Optional)
componentsarrayDialog components. (Optional; see note)
filePathstringFull local file path of the dialog file. (Optional)
modestringThe dialog event mode.
templatestringThe dialog template being used for the message, if any. (Optional)
textstringThe text being output by the dialog.
Note

It's possible for a component to nest more component objects.

Function

The JavaScript functions being executed by the current step.

A Function object has the following properties:

PropertyTypeValue
pathstringRelative path name of function being passed by the action.
statusstringCurrent status of the function.
capsuleIdstringThe fully qualified capsule ID.
actionIdstringThe fully qualified action type (for example, viv.gratuity.calculate).
requestsobjectMap of web requests and responses. See below. (Optional)
idstringIdentifier of a function web request.
FunctionWebRequestobjectRequest object passed to a web service.
FunctionWebResponseobjectResponse object received from a web service.

Request and Response Maps

The requests property maps id values to FunctionWebRequest and FunctionWebResponse objects with the following structure:

requests: { [_id_: string]: { _req_: FunctionWebRequest, _res_: FunctionWebResponse } }

The FunctionWebRequest can include information such as the method and URL passed to the request. The FunctionWebResponse can include information such as the duration of the request, cached information, and HTTP status code. The specific values depend on the web service.

Layout

The Layout object represents layouts in your execution graph.

A Layout object has the following properties:

PropertyTypeValue
conceptIdstringIdentifier of the concept being used in the layout.
idstringUnique identifier of the layout.
isDeferredbooleantrue if the layout has been deferred from being generated.
layoutobjectThe JsonLayout object that represents the layout.
modestringThe layout mode, one of summary, details, input, or confirmation. (Optional)
refstringExecution reference identifier.
sortIdstringThe identifier of the sort being used in the layout.

PlanEdge

PlanEdge objects represent the edges in your execution graph. All edges are either incomingEdges or outgoingEdges of a given PlanNode.

Note that one node's incomingEdge can be another node's outgoingEdge. Consider the following execution graph:

Execution graph of weather capsule asking "What's the weather in Mountain View?"

For the VALUE node, the outgoingEdge is the geo.LocalityName of "Mountain View". This same edge is an incomingEdge, as an input for the search function geo.FindLocality. Be aware that the node you call an edge for will affect the output information.

JsonLayout

A JSON object representing the HTML for the layout. Any child in this JSON tree can also be a Dialog component.

A JsonLayout object has the following properties:

PropertyTypeValue
JsonElementobjectInterface representing the HTML content sections of a layout, namely header and content elements. Can contain Attribute, Type, and Children properties.
AttributestringAttributes of the parent HTML element.
TypestringTag name of the main HTML elements (for example, div).
ChildrenmixedChild elements of the given JsonElement. Children can be a single JsonElement, a JsonElement[] array, or a dialog fragment.
formBindingsarrayAssociated bindings in form layouts. (Optional)
stylestringStyle being used in the layout. (Optional)
submitRequiredbooleantrue if a submit is required to access this layout.
typestringLayout type, either layout or text.