@async/flow provides a small runtime for store state, event dispatch, async
signals, and ordered handler steps.
Use these docs when the README is too compact:
- Layer Guide: L1 signal/computed, async signal, and store examples; L2 Flow events; L2.5 composition; and L3 step helpers.
- Signals, Computed, Async Signals, And Store: computed values, async signal controllers, and store unwrapping.
- Async Signal Lifecycle: lazy and immediate async signals, load, reload, cancel, manual value writes, and snapshots.
- Compose And Status Helpers:
compose,parallel,remember,set,update,when,after,branch,dispatch,onError,status,transition,guard,bool,every,some,not,can,explain,inspect, andmatches.
The package has four public layers:
The root @async/flow entrypoint exports the complete opinionated surface.
Subpaths remain available when a consumer wants a narrower entrypoint.
import {
after,
asyncSignal,
bool,
branch,
compose,
createAsyncSignal,
createFlow,
createStore,
defineAsyncSignal,
defineFlow,
dispatch,
every,
flow,
not,
parallel,
remember,
set,
some,
status,
transition,
when
} from "@async/flow";Top-level flow(...) creates a live standalone Flow instance. Definition
helpers are import-safe and do not create shared live state at module load time.
Use the current entrypoints in new code:
flow(...) live Flow instance
instance.event(input) projected handler method
compose([...]) ordered handler pipeline
dispatch("event", input) reusable deferred sender
dispatch(target, "event") immediate event-sink dispatch
@async/flow/graph opt-in runtime graph helpers
@async/flow/builder opt-in graph-to-config compiler
@async/flow/protocol shared Symbol.for brands for layer interop
@async/flow/framework-runtime
scheduler-free runtime for framework integrations
@async/flow/helpers/core scheduler-free helper imports for framework integrations
status(...) live signal-based status ref
defineStatus(...) pure status declaration
The graph subpath exports toGraph(targetOrInspection, options?) and
toMermaid(graph, options?). It is intentionally separate from the root
entrypoint and reads Flow instances through the shared FLOW_INSPECT protocol
symbol.
The builder subpath exports toFlowConfig(graph, bindings?, options?). It
compiles a declarative store plus on graph into ordinary Flow config while
binding named handlers and external signals separately.