context-scopes

command
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Context Scopes

A noderun workflow demonstrating the three message-passing context scopes available to function-node JavaScript:

inject → function-write → function-read → debug

The writer stores one key in each scope; the reader reports what it can see — proving that context (node scope) is isolated per node while flow and global are shared.

// writer
context.set("marker", "writer only");   // node scope — this node only
flow.set("shared", "flow value");       // flow scope — whole workflow
global.set("appName", "GoFlow");        // global scope — whole engine

Things to notice:

  • context is namespaced per node (workflowID/nodeID), so the reader's context.get("marker") returns null — each node has its own private store.
  • flow is namespaced to the workflow: every node in this flow sees flow.get("shared").
  • global is engine-wide: shared across all workflows on the engine.
  • Each scope exposes get / set / keys; context values are backed by the host's ContextStore (in-memory by default, durable stores selectable per scope).
  • The same {{flow.X}}, {{global.X}} and {{env.X}} values are also reachable from template nodes — see examples/template-message.

Run from the noderun module root:

go run ./examples/context-scopes

Expected output:

{"nodeSees":null,"flowSees":"flow value","globalSees":"GoFlow"}

nodeSees being null is the point: the writer's node context is invisible to a different node, while flow and global reads succeed.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL