Skip to main content

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​

PropertyKeyTypeRequiredDefaultPossible valuesApplies when
CodecodestringYesexport default async function main(args) { return { hello: "world", args }; }Source with a default-export functionAlways
Code TypecodeTypeoptionsNojsjs - javascript; py - pythonAlways
Custom ParameterscodeParamsobjectNo{}Key/value object, accessed via args.{paramValue} in the codeAlways
Global ParametersglobalParamsobjectNo{}Key/value object, injected as globals and accessed via {paramValue} directlyAlways

Notes​

  • Only the JavaScript runtime is currently wired up; selecting codeType = py has no effect.
  • If the returned value is a plain object with a json and/or binary key, that shape becomes the output directly; binary entries require base64 data and mimeType (missing either throws). Otherwise the whole result is wrapped under json.
  • User code runs in an isolated worker thread; an error thrown by user code or a non-zero worker exit fails the node.