@node-red/runtime.nodes

addModule(opts) → {Promise.<ModuleInfo>}

Install a new module into the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module to install

version String

(optional) the version of the module to install

tarball Object

(optional) a tarball file to install. Object has properties name, size and buffer.

url String

(optional) url to install

req Object

the request to log (optional)

Returns:
Type:
Promise.<ModuleInfo>
  • the node module info

getIcon(opts) → {Promise.<Buffer>}

Gets a node icon

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module requesting the icon

icon String

the name of the icon

req Object

the request to log (optional)

Returns:
Type:
Promise.<Buffer>
  • the icon file as a Buffer or null if no icon available

getIconList(opts) → {Promise.<IconList>}

Gets the list of all icons available in the modules installed within the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

req Object

the request to log (optional)

Returns:
Type:
Promise.<IconList>
  • the list of all icons

getModuleCatalog(opts) → {Promise.<Object>}

Gets a modules message catalog

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module User

the module

lang User

the i18n language to return. If not set, uses runtime default (en-US)

req Object

the request to log (optional)

Returns:
Type:
Promise.<Object>
  • the message catalog

getModuleCatalogs(opts) → {Promise.<Object>}

Gets all registered module message catalogs

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

lang User

the i18n language to return. If not set, uses runtime default (en-US)

req Object

the request to log (optional)

Returns:
Type:
Promise.<Object>
  • the message catalogs

getModuleInfo(opts) → {Promise.<ModuleInfo>}

Gets the info of a node module

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module to return

req Object

the request to log (optional)

Returns:
Type:
Promise.<ModuleInfo>
  • the node module info

getModuleResource(opts) → {Promise.<Buffer>}

Gets a resource from a module

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module requesting the resource

path String

the path of the resource

req Object

the request to log (optional)

Returns:
Type:
Promise.<Buffer>
  • the resource file as a Buffer or null if not found

getNodeConfig(opts) → {Promise.<String>}

Gets an individual node's html content

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

id String

the id of the node set to return

lang String

the locale language to return

req Object

the request to log (optional)

Returns:
Type:
Promise.<String>
  • the node html content

getNodeConfigs(opts) → {Promise.<String>}

Gets all node html content

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

lang String

the locale language to return

req Object

the request to log (optional)

Returns:
Type:
Promise.<String>
  • the node html content

getNodeInfo(opts) → {Promise.<NodeInfo>}

Gets the info of an individual node set

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

id String

the id of the node set to return

req Object

the request to log (optional)

Returns:
Type:
Promise.<NodeInfo>
  • the node information

getNodeList(opts) → {Promise.<NodeList>}

Gets the list of node modules installed in the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

req Object

the request to log (optional)

Returns:
Type:
Promise.<NodeList>
  • the list of node modules

removeModule(opts) → {Promise}

Removes a module from the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module to remove

req Object

the request to log (optional)

Returns:
Type:
Promise
  • resolves when complete

setModuleState(opts) → {Promise.<ModuleInfo>}

Enables or disables a module in the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

module String

the id of the module to enable or disable

enabled String

whether the module should be enabled or disabled

req Object

the request to log (optional)

Returns:
Type:
Promise.<ModuleInfo>
  • the module info object

setNodeSetState(opts) → {Promise.<ModuleInfo>}

Enables or disables a n individual node-set in the runtime

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

id String

the id of the node-set to enable or disable

enabled String

whether the module should be enabled or disabled

req Object

the request to log (optional)

Returns:
Type:
Promise.<ModuleInfo>
  • the module info object