Documentationcurrent version
Help us improve the docs by fixing typos and proposing enhancements.

Nikita

Action output

The action output is the value returned by the action handler and available inside a promise.

Usage

The action output is returned when its promise is fulfilled, thus, it is accessed using the async/await operators.

nikita
.call(async function() {  // Access the action output
  const {who} = await this.call(({tools: {log}}) => {    return {who: 'Nikita'}
  })
  // Print the output
  console.info(who)
  // Outputs the value "Nikita"
})

Plugin enrichment

This returned value is eventually modified by plugins.

The @nikitajs/core/lib/plugins/output/status plugin enriches the value with the $status property when an object literal is returned and converts the value true to { $status: true } when a boolean value is returned. The @nikitajs/core/lib/plugins/output/logs plugin returns the logs emitted inside the action handler.

Below is the description of those properties when the returned value is an object literal:

  • $status
    A boolean value of the action status.
  • $logs
    An array of objects with logging information of the action execution.

In case the returned value shall be preserved and untouched, the raw_output metadata instructs Nikita to not alter the value returned by the handler.

Edit on GitHub
Navigate
About

Nikita is an open source project hosted on GitHub and developed by Adaltas.