Skip to content

run

The run() function is the entry point of the flow system. It executes a synchronous or asynchronous flow, handles effects such as breaks, exits, finalizers, steps, and injections, then returns the final value.

Interactive example

Syntax

typescript
function run<
	GenericFlow extends TheFlowFunction | TheFlow
>(
	theFlow: GenericFlow,
	params?: {
		input?: unknown;
		includeDetails?: boolean;
		dependencies?: Record<string, unknown>;
	}
): unknown

Parameters

  • theFlow: The flow function or created flow to execute.
  • params.input: Optional input passed to the flow.
  • params.includeDetails: When true, returns an object with the final result and collected step names.
  • params.dependencies: Dependency bag used to satisfy F.inject() requests.

Return value

The final flow result, or a Promise when the executed flow is asynchronous. When includeDetails is enabled, the return value becomes { result, steps }.

See also

  • create - Creates a reusable flow
  • exec - Executes a nested flow from inside another flow
  • inject - Requests a dependency from the runner

Released under the MIT license.