typescript.script.run → scriptRuns TypeScript in a sandbox and adds what it returns as script. The body after -- is the function body of async function(input, n, ctx), and whatever it returns is added to the payload as script — the rest is kept, so the next node reads input.script.x. input is the current payload (right after a webhook, input.webhook.body.x; the request anywhere, $trigger.body.x); ctx.trigger.params/query/auth is the request and ctx.nodes.<id> an earlier node's output. It cannot set a status or header (web.response.send does), return null does not stop the run (logic.if does), and fetch, setTimeout, require and import are blocked (http.response.fetch calls out). Keep it to shaping data: compose, rename, compute — a run has 1 s and its return 256 KB (DenoSandboxError: timeout exceeded means do less here or split the work). A __signal key in the returned object is stripped and shown as live progress in the Studio; __zf_files stores files for the run.
Examples
Shape rows for a page
| typescript.script.run -- "return { posts: input.query.rows.map(r => ({ ...r, when: r.created_at.slice(0, 10) })), total: input.query.row_count }"The next node reads input.script.posts.
Input:
{ "query": { "rows": [ { "title": "Hi", "created_at": "2026-09-13T04:00:00Z" } ], "row_count": 1 }}It answers:
{ "query": { "rows": [ { "title": "Hi", "created_at": "2026-09-13T04:00:00Z" } ], "row_count": 1 }, "script": { "posts": [ { "title": "Hi", "created_at": "2026-09-13T04:00:00Z", "when": "2026-09-13" } ], "total": 1 }}Combine two earlier nodes
| typescript.script.run -- "return { user: $nodes.b.query.rows[0], orders: $nodes.c.query.rows }"Anywhere in graph mode downstream of b and c: wired from both, it runs once, when both have answered (each $nodes reference names an upstream node of this pipeline by a literal id; a computed $nodes[name] is refused at save).