waygraph / DefinedBlock
Type Alias: DefinedBlock<In, Out>
DefinedBlock<
In,Out> =Omit<Block<In,Out>,"withVerify"|"modVerify"|"modVerifyAll"> &object
Defined in: src/engine/block/block.ts:186
A Block guaranteed to have withVerify/modVerify/modVerifyAll attached - what defineBlock() and, since they're built on it, withVerify()/modVerify()/ modVerifyAll()/branch() all return. Lets LoginBlock.withVerify(...) be called directly, no !/?. needed - the type says the method is there, not "maybe". A plain Block<In, Out> (a raw object literal) doesn't get this; DefinedBlock is still assignable anywhere a Block is expected.
Type Parameters
In
In extends Checkpoint<string>
Out
Out extends Checkpoint<string>
Type Declaration
modVerify()
modVerify(
nameOrIndex,newCheck):DefinedBlock<In,Out>
Parameters
nameOrIndex
string | number
newCheck
Trait | ((page, mem) => Promise<boolean | TraitResult>)
Function
(page, mem) => Promise<boolean | TraitResult>
Returns
DefinedBlock<In, Out>
modVerifyAll()
modVerifyAll(
patches):DefinedBlock<In,Out>
Parameters
patches
Record<string, Trait["check"] | Trait>
Returns
DefinedBlock<In, Out>
stub()
stub(
stub):DefinedBlock<In,Out>
Demo narration after resolve. Prefer ctx callbacks over slot-map objects.
Parameters
stub
StubLifecycleFn<Out>
Returns
DefinedBlock<In, Out>
stubBefore()
stubBefore(
stub):DefinedBlock<In,Out>
Demo narration before act - prefer (ctx) => { ctx.ring(...); ctx.mem?.get(...) }. Chains after any existing stubBefore on this Block (library then call-site). Overloads keep ctx typed when the author passes a lifecycle function (a single union parameter would make the callback param any).
Parameters
stub
StubLifecycleFn<Out>
Returns
DefinedBlock<In, Out>
stubOnError()
stubOnError(
stub):DefinedBlock<In,Out>
Demo narration when the step fails / expected-failure path.
Parameters
stub
StubLifecycleFn<Out>
Returns
DefinedBlock<In, Out>
withVerify()
withVerify(
verify):DefinedBlock<In,Out>
Parameters
verify
Returns
DefinedBlock<In, Out>