waygraph / PageBlock
Type Alias: PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
PageBlock<
Out,M,Nav,E,R,U,Q,F,Lk> =Omit<DefinedBlock<Checkpoint<string>,Out>,"withVerify"|"modVerify"|"modVerifyAll"|"stubBefore"|"stub"|"stubOnError"> &object&PageGo<Out,U,Q> &PageFolderGo<Out,F> &PageLinks<Lk>
Defined in: src/engine/block/kinds/page.ts:233
Page hub Block: one Checkpoint = this screen; methods hang off the hub for readability / auto grouping. Runtime is still a Block (__waygraphKind = "page"). act is goto/click when url/click is set, otherwise a no-op (already here). Child methods stay ordinary Blocks for graph edges - the page only registers them. Branded __wgFactory: "page" (not "nav") - both are accepted by MapBuilder.gotoPage / MapBuilder.gotoExternal.
Type Parameters
Out
Out extends Checkpoint<string>
M
M extends Record<string, PageMethodEntry> = Record<string, PageMethodEntry>
Nav
Nav = undefined
E
E extends Record<string, PageExpectEntry> = Record<never, never>
R
R = Record<never, never>
U
U extends string = string
Q
Q extends string = never
F
F extends "folder" | undefined = undefined
Lk
Lk extends Record<string, unknown> = Record<never, never>
Type Declaration
__wgFactory?
readonlyoptional__wgFactory?:"page"
checkpoint
readonlycheckpoint:Out
The page's Checkpoint, as a value: for lands, a Method's from/to, a flow's start.
do
readonlydo:PageMethods<M>
The page's Methods by name, each its own Block type: what a flow does on this page, from one import.
Example
map().gotoPage(Inventory.nav).method(Inventory.do.addItem, { expect: [ExpectBadgeBlock] })expects
readonlyexpects:PageMethods<E>
The page's expectations by name (Expect Blocks and Traits): what a step here can expect.
methods
readonlymethods: readonlySomeDefinedBlock[]
Resolved method Blocks registered at define time.
nav
readonlynav:Nav
The Nav Block that opens this page (nav in definePageBlock).
read
readonlyread:PageReadKeys<R>
What the page shows, as typed keys: Inventory.read.sort.is("az").
check()
check(
description,test):Trait
A check on what the page shows, for a step's expect: Lines.check("only marked", ({ rows }) => rows.every(...)).
Parameters
description
string
test
(read, mem) => CheckResult
Returns
modVerify()
modVerify(
nameOrIndex,newCheck):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
nameOrIndex
string | number
newCheck
Trait | ((page, mem) => Promise<boolean | TraitResult>)
Function
(page, mem) => Promise<boolean | TraitResult>
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
modVerifyAll()
modVerifyAll(
patches):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
patches
Record<string, Trait["check"] | Trait>
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
stub()
stub(
stub):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
stub
StubLifecycleFn<Out>
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
stubBefore()
stubBefore(
stub):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
stub
StubLifecycleFn<Out>
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
stubOnError()
stubOnError(
stub):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
stub
StubLifecycleFn<Out>
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>
withVerify()
withVerify(
verify):PageBlock<Out,M,Nav,E,R,U,Q,F,Lk>
Parameters
verify
Returns
PageBlock<Out, M, Nav, E, R, U, Q, F, Lk>