flow

js/ui/web/flow.ts

fino:ui/web/flow — workflow-backed server-rendered pages.

flowPage() connects bounded multi-step workflows to ordinary HTTP pages. A GET without ?run= starts the workflow and redirects to a URL containing the run id. Later GETs render the persisted WorkflowState; POSTs deliver the signal the workflow is currently waiting on, resume the run, and redirect back to the same run URL.

import { flowPage } from 'fino:ui/web/flow';
import { SqliteWorkflowStore } from 'fino:workflow';

app.get('/checkout').handle(flowPage(checkout, { store, start, render }));
app.post('/checkout').handle(flowPage(checkout, { store, start, render }));

Interfaces

interface FlowPageOptions<In = unknown> {

Properties

store: WorkflowStore

Durable workflow store containing runs for this page.

start: (ctx: HttpContext) => In | Promise<In>

Input factory used when a GET starts a new run.

render: (ctx: HttpContext, state: WorkflowState) => VNode

Render the current workflow state as a Fino UI tree.

Functions

function flowPage< In, Out >(workflow: Workflow<In, Out>, opts: FlowPageOptions<In>): Handler

Create a route handler for a bounded workflow-backed page.