Code
Type ID: core.code · Kind: Action · Ports: 1 in, 1 out
Runs user-supplied code whose default export is a function. The function receives an args object and its return value becomes the node output. Currently only the JavaScript runtime is wired up.
Credentials
None
Properties
| Property | Key | Type | Required | Default | Possible values | Applies when |
|---|---|---|---|---|---|---|
| Code | code | string | Yes | export default async function main(args) { return { hello: "world", args }; } | Source with a default-export function | Always |
| Code Type | codeType | options | No | js | js - javascript; py - python | Always |
| Custom Parameters | codeParams | object | No | {} | Key/value object, accessed via args.{paramValue} in the code | Always |
| Global Parameters | globalParams | object | No | {} | Key/value object, injected as globals and accessed via {paramValue} directly | Always |
Notes
- Only the JavaScript runtime is currently wired up; selecting
codeType = pyhas no effect. - If the returned value is a plain object with a
jsonand/orbinarykey, that shape becomes the output directly; binary entries require base64dataandmimeType(missing either throws). Otherwise the whole result is wrapped underjson. - User code runs in an isolated worker thread; an error thrown by user code or a non-zero worker exit fails the node.