Function Reference

The functions section of a function library manifest defines the functions the library exposes. It's a map where each key is a function name and each value describes that function's parameters, return type, and execution characteristics.

Example

The following example declares a function that capitalizes text:

Copy

Function fields

A function has the following fields:

FieldRequiredDescription
parametersNoArray of parameter definitions. Maximum 10. Defaults to no parameters.
returnsNoReturn type definition. Defaults to void.
asyncNoWhether the function returns a Promise. Defaults to false.
displayNameNoName of the function shown in the editor.
descriptionNoFunction description.

Parameter fields

Each entry in parameters describes one argument the function accepts:

FieldRequiredDescription
dataTypeYesThe type of value the parameter accepts.
displayNameNoName of the parameter shown in the editor.
descriptionNoParameter description.
optionalNoWhether the parameter is optional. Only trailing parameters can be optional because JavaScript arguments are positional. Defaults to false.
defaultValueNoDefault the editor shows as a hint. Not passed at runtime, so your implementation must handle the missing value. Used only when optional is true.
arrayItemsWhen dataType is arrayItemsDefines what elements in the array look like.
dataWhen dataType is dataDefines the fields inside the nested object.
functionWhen dataType is functionDefines the parameters and return type of a callback parameter.
textEnumWhen dataType is textEnumList of allowed string options.
linkWhen dataType is linkConfiguration for the link parameter, such as supported link types.

Optional parameters

Set optional to true to make a parameter optional. Only trailing parameters can be optional because JavaScript arguments are positional. Use defaultValue to give the editor a hint to display for the missing value.

The following example declares roundNumber with an optional parameter and a default value:

Copy

Arrays

For array parameters, set dataType to 'arrayItems'. Then define the array elements under arrayItems.item.

Copy

Nested objects

For complex object parameters, set dataType to 'data'. Then define each field of the object under data.items.

Copy

Text enums

For a fixed set of string options, set dataType to 'textEnum' and list the choices under textEnum.options.

Copy

Callback parameters

A parameter can itself be a function. Set its dataType to 'function', then describe the callback's parameters and return type under function.

Copy

For a parameter that accepts a navigation link, set dataType to 'link'. The optional link field restricts which kinds of links are allowed. For the available fields, see Link.

Copy

Return type fields

The returns field describes a function's return value:

FieldRequiredDescription
dataTypeYesThe type of value this function returns.
displayNameNoName of the return value shown in the editor.
descriptionNoDescription of the return value.
arrayItemsWhen dataType is arrayItemsDefines what elements in the returned array look like.
dataWhen dataType is dataDefines the fields inside the returned nested object.
functionWhen dataType is functionDefines the parameters and return type of the returned callback.
textEnumWhen dataType is textEnumList of allowed string options.
linkWhen dataType is linkConfiguration for the returned link, such as supported link types.

Void functions

If a function doesn't return a value, omit returns.

Copy

Async functions

Set async to true for a function whose implementation returns a Promise. The returns field describes the resolved value's type, not the Promise.

Copy

See also

Last updated: 2 November 2026

Did this help?