Skip to content
Interfacecorev0.10.0

Gate

A precondition attached to a handler. It refuses by throwing a Notice (a reply) or a Silence (a drop with no reply), and passes by returning. Ctx is the context it requires, so a gate that reads a field absent on a handler's context is rejected at compile time. Name is captured as a literal so a mismatch error can name the gate. Build one with defineGate or defineEffectGate.

See also:defineGate

interface Gate<
    Ctx extends GateContextBase = GateContextBase,
    Name extends string = string
>

Properties

Methods

Name

The gate's literal name, named in a mismatch error.

Name extends string = string

name

The gate's name, surfaced in a mismatch error and joined by the combinators.

readonly name: Name

check()

Reads the context and refuses by throwing a Notice or a Silence, or passes by resolving.

check(ctx: Ctx): Promise<void>