Skip to content

EventGate

EventGate = (input) => EventGateDecision | Promise<EventGateDecision>

Defined in: packages/server/src/events/route.ts:71

The consent/entitlement gate (ADR-0053 decision 1): the one FUNCTION of the Event lane’s contract, and so a createSyncServer option rather than a registry field (the registry stays declarative data only).

Called once per event, after the payload validated and the identity resolved, and before anything is enqueued. Per-event (rather than per stream × batch) is the simplest correct shape: a consent or entitlement decision may legitimately depend on the payload, and a per-batch hook could only express the subset that does not. The claims are constant across a batch, so a hook that consults a store should memoize on them — a batch can carry up to MAX_EVENTS_PER_BATCH events.

A hook that THROWS fails the whole batch retryably (500, nothing enqueued): a gate that cannot decide must never be read as “allow”.

EventGateInput

EventGateDecision | Promise<EventGateDecision>