waygraph / account
Function: account()
account(
name,opts):Account
Defined in: src/engine/flow/account.ts:48
Declares an account: name is how runs and the demo call it; signIn is the flow that signs it in from a fresh browser; mem says who the person is (their email, their credentials), set right before they sign in, so a flow as the account needs nothing more. Without it, the sign-in flow's keys come from mem, like any flow's. ttl is how long the app keeps a session signed in ("15m", "2h", or ms): a session older than that signs in again, and one still good is saved (.waygraph/sessions/) for the next run and every test worker, so they don't sign in again either.
Parameters
name
string
opts
mem?
(mem) => void
signIn
Flow<Checkpoint<string>>
ttl?
Duration
Returns
Example
ts
export const Planner = account("planner", {
signIn: magicLinkSignInFlow,
mem: (m) => m.set(PiaKeys.expectedRecipient, { email: "kat@jbtec.example" }),
ttl: "15m",
});
export const addMachineFlow = engine.map({ as: Planner }).gotoPage(NavEquipmentBlock).method(AddMachineBlock);