Skip to main content
The utilities exported from automate.ax let you derive values and control which work becomes ready without awaiting a signal.

Interpolate text with t

Use the t tagged template to combine signals with static text or in-memory values:
automations/request-notification.automation.ts
t returns a Signal<string> that depends on every interpolated signal. It converts each resolved signal and ordinary interpolated value with String().

Transform values

Every signal has a .transform() method for deriving a value from one signal:
Use the top-level transform function when a result depends on several signals:
The transformer runs after all input signals materialize and returns a signal for its result. Keep transformers pure: use actions for external work.

Route values conditionally

Use filter to preserve a signal only when a predicate matches:
filter(signal, predicate) emits the original value when the predicate returns true. Otherwise, it closes without a value, so work that depends on it does not run. Use partition when both outcomes need separate paths:
Exactly one returned signal emits the original value; the other closes. Use gate when you already have a boolean signal:
gate(value, condition, expected) emits value when condition equals expected and closes otherwise. expected defaults to true.

Branch automation work

Use branch when different actions should run for the two outcomes of a boolean signal:
automations/route-request.automation.ts
Automate.ax traverses both callbacks while composing the automation, but only actions in the selected branch become ready during execution. If either callback returns a signal, both callbacks must return signals; branch then returns a signal for the selected result. When only the true callback is provided and it returns a signal, that result closes when the condition is false.

Add an ordering dependency

Use group when actions must wait for signals that they do not consume as inputs:
group(dependencies, callback) makes every action called synchronously inside the callback wait for one signal or an array of signals. It returns the callback’s result unchanged.

Handle closure and failure

A signal can emit a value, close without one, or fail. closed(signal) and failed(signal) project those lifecycle outcomes as ordinary signals:
failed(signal) emits { name: string, message: string } only when the source fails. closed(signal) emits void only when the source closes without a value. Each lifecycle signal closes for every other outcome.

Inspect a value

isSignal(value) is a TypeScript type guard for reusable helpers that accept ordinary values or signals:
Most automations do not need isSignal; action inputs already accept compatible signals.