Apart from inputs and outputs, nodes can have input fields from which the data can be consumed within the node.
Index
Structure data
The dataStructure object is the prefered way to specify what kind of data fields are available. This map is stored within the structure.json.
Implementation examples
Parameters
The following applies to the dataStructure
object
within the root of structure.json.
path (dataStructure.name) | type | description |
---|---|---|
type | String | text, textarea, string, password, number, date, select, checkbox |
options | String[] | A list of options for a select field. Only applies to data fields where dataStructure.type equals 'select'. |
required | Boolean | Specifies that the data field is a required field. |
vault | Boolean | Specifies that the value of this data field should be stored in the vault. |
description | String | A description for the data field. |
label | String | A label/name for the data field. If none is provided, the key of the dataStructure is used instead to reflect this field in the UI. |
input | Object | Relates the field in the dataStructure to a given input by name. Ensures that node.getData() returns a combined array of the field and the related input values. |
input |
String | The name of the related input. |
input |
Boolean | If set to true, this data field will be hidden and disabled when anything is connected to the given input. |
min | Number | Defines the minimum value that is acceptable and valid for a data field. |
max | Number | Defines the maximum value that is acceptable and valid for a data field. |
minlength | Number | Defines the minimum number of characters (as UTF-16 code units) a data field must contain. If no minlength is specified, or an invalid value is specified, the input has no minimum length. |
maxlength | Number | Defines the maximum number of characters (as UTF-16 code units) a data field must contain. If no maxlength is specified, or an invalid value is specified, the input has no maximum length. |
pattern | String | Specifies a regular expression the data value should match. Only applies to types 'text' & 'password'. |
Editor
If as a developer you want full control of what is rendered for a certain node within the editor, you can instead ahve a look at the editor documentation.
Note that this is not the preferred way of managing data, and should only be used when the dataStructure does not provide sufficient options.
Consuming data
Within a node, a (await
) call to NODE.getData(dataName, state)
is sufficient to fetch the following as an array;
- The data stored in the node for the given dataName.
- The data retrieved by related inputs, if
dataStructure[dataName].input.name
is set. - If
dataStructure[dataName].input.replaces
is set, the data stored in the node for the given dataName is ignored.
This method always returns an array, even when no input is related in the dataStructure.