Flow API Reference

Complete generated reference for every exported Archyn Flow type, function, and helper.

Core Result

15 symbols
Awaitable

Represents a value that may be returned directly or through a Promise.

type
flow/core/result.tscore-result
err

Creates a branded failed result.

function
flow/core/result.tscore-result
Err

Failed `Result` variant.

type
flow/core/result.tscore-result
from

Converts a structural result-like value into a branded Flow result.

function
flow/core/result.tscore-result
isErr

Narrows a result to the failed variant.

function
flow/core/result.tscore-result
isOk

Narrows a result to the successful variant.

function
flow/core/result.tscore-result
isResult

Detects branded Flow results created by `ok`, `err`, or `from`.

function
flow/core/result.tscore-result
match

Exhaustively handles both result variants and returns one value.

function
flow/core/result.tscore-result
ok

Creates a branded successful result.

function
flow/core/result.tscore-result
Ok

Successful `Result` variant.

type
flow/core/result.tscore-result
Result

Explicit success-or-failure outcome used throughout Flow.

type
flow/core/result.tscore-result
Result

Namespace-style collection of core result helpers.

const
flow/core/result.tscore-result
ResultLike

Structural result shape accepted by `from`.

type
flow/core/result.tscore-result
unwrap

Returns the success value or throws the error value.

function
flow/core/result.tscore-result
unwrapOr

Returns the success value or a fallback.

function
flow/core/result.tscore-result

Core Runtime

22 symbols
abortController

Aborts a controller only when it has not already been aborted.

function
flow/core/runtime.tscore-runtime
Behavior

Executable Flow workflow unit.

type
flow/core/runtime.tscore-runtime
BehaviorContext

Extracts the custom context type from a behavior.

type
flow/core/runtime.tscore-runtime
BehaviorError

Extracts the expected domain error type from a behavior.

type
flow/core/runtime.tscore-runtime
BehaviorOutput

Extracts the output type from a behavior.

type
flow/core/runtime.tscore-runtime
cancelled

Creates a cancellation result.

function
flow/core/runtime.tscore-runtime
Cancelled

Runtime error returned when execution is cancelled through an `AbortSignal`.

type
flow/core/runtime.tscore-runtime
contextWithSignal

Replaces the signal on a runtime context.

function
flow/core/runtime.tscore-runtime
createLinkedController

Creates a child controller linked to a parent signal.

function
flow/core/runtime.tscore-runtime
define

Defines a behavior from a callback that returns a `Result`.

function
flow/core/runtime.tscore-runtime
isRuntimeError

Narrows an error value to a Flow runtime error.

function
flow/core/runtime.tscore-runtime
isThrown

Narrows an error value to `Thrown`.

function
flow/core/runtime.tscore-runtime
linkAbortSignal

Links a parent signal to a child controller.

function
flow/core/runtime.tscore-runtime
resultFromSignal

Converts an aborted signal into a cancellation result.

function
flow/core/runtime.tscore-runtime
run

Runs a behavior with an optional application context.

function
flow/core/runtime.tscore-runtime
runBehavior

Executes a behavior with runtime error protection.

function
flow/core/runtime.tscore-runtime
RuntimeContext

Execution context passed to every behavior.

type
flow/core/runtime.tscore-runtime
RuntimeError

Runtime-level failure union added around every behavior's domain error type.

type
flow/core/runtime.tscore-runtime
thrown

Creates a thrown-exception runtime result.

function
flow/core/runtime.tscore-runtime
Thrown

Runtime error returned when user code throws.

type
flow/core/runtime.tscore-runtime

Core Record

18 symbols
abortChildren

Aborts every tracked child controller.

function
flow/core/record.tscore-record
EmptyRaceError

Domain error returned when `race` is called with an empty behavior record.

type
flow/core/record.tscore-record
err

Re-exports core result helpers used by advanced record internals.

re-export
flow/core/record.tscore-record
ErrorUnion

Unions the expected domain error types of every behavior in a record.

type
flow/core/record.tscore-record
normalizedConcurrency

Normalizes a requested concurrency value for keyed parallel helpers.

function
flow/core/record.tscore-record
ok

Re-exports core result helpers used by advanced record internals.

re-export
flow/core/record.tscore-record
OutputRecord

Maps each behavior key to its successful output type.

type
flow/core/record.tscore-record
RaceError

Keyed failure value returned by `race`.

type
flow/core/record.tscore-record
raceFailure

Creates a keyed race failure payload.

function
flow/core/record.tscore-record
RaceOutput

Keyed success value returned by `race`.

type
flow/core/record.tscore-record
raceSuccess

Creates a keyed race success payload.

function
flow/core/record.tscore-record
RecordContext

Intersects the custom context types of every behavior in a record.

type
flow/core/record.tscore-record
RecordInput

Intersects the input types of every behavior in a record.

type
flow/core/record.tscore-record
runChild

Runs a child behavior with a linked abort controller.

function
flow/core/record.tscore-record
SettledRecord

Maps each behavior key to the full result returned by that child.

type
flow/core/record.tscore-record
thrown

Re-exports core result helpers used by advanced record internals.

re-export
flow/core/record.tscore-record

Composition

10 symbols
fail

Creates a behavior that always fails with the same domain error.

function
flow/fail.tsfail
input

Creates an identity behavior for starting typed pipelines.

function
flow/input.tsinput
map

Maps the successful output of a behavior.

function
flow/map.tsmap
pipe

Composes behaviors from top to bottom.

function
flow/pipe.tspipe
sequence

Runs two behaviors left-to-right.

function
flow/sequence.tssequence
succeed

Creates a behavior that always succeeds with the same value.

function
flow/succeed.tssucceed
tap

Runs a side effect after source success without changing the output.

function
flow/tap.tstap
task

Creates a typed behavior from synchronous or asynchronous application code.

function
flow/task.tstask
TaskContext

Runtime context provided to a `task` callback.

type
flow/task.tstask

Error Handling

3 symbols
catchKind

Recovers one discriminated domain error variant by its `kind` field.

function
flow/catch-kind.tscatch-kind
mapError

Maps expected domain errors without catching runtime errors.

function
flow/map-error.tsmap-error
recover

Recovers expected domain failures into success or a new domain failure.

function
flow/recover.tsrecover

Timing And Cancellation

8 symbols
delay

Waits before running a source behavior.

function
flow/delay.tsdelay
retry

Retries a behavior when it returns an expected domain failure.

function
flow/retry.tsretry
RetryOptions

Configuration for retrying expected domain failures.

type
flow/retry.tsretry
wait

Waits for a duration while observing an `AbortSignal`.

function
flow/wait.tswait

Branching

2 symbols
choose

Branches between two behaviors using a behavior predicate.

function
flow/choose.tschoose
when

Branches between two behaviors using a predicate function.

function
flow/when.tswhen

Parallel Execution

3 symbols
all

Runs keyed behaviors in parallel and fails fast on the first child failure.

function
flow/all.tsall
allSettled

Runs keyed behaviors and collects every child result.

function
flow/all-settled.tsall-settled
race

Runs keyed behaviors and returns the first settled child.

function
flow/race.tsrace