defineEventStream
defineEventStream<
TPayload>(input):EventStreamEntry<TPayload>
Defined in: packages/contracts/src/event-stream.ts:136
Declare one Event stream for a registry’s streams map.
The Event-stream NAME is the record key it is registered under, so it is not named here — the name (and
this entry’s payload/identity shape) is validated fail-closed at defineSyncRegistry, which sees the
whole map and reports EVERY offender in one error rather than one per build.
import { z } from "zod";
export const registry = defineSyncRegistry({ tables: { issue }, streams: { board_issue_viewed: defineEventStream({ payload: z.object({ issueId: z.uuid() }).strict(), identity: { viewerId: { claimPath: ["sub"] } }, }), },});Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameters
Section titled “Parameters”identity
Section titled “identity”Record<string, EventStreamIdentityField>
payload
Section titled “payload”TPayload
revision?
Section titled “revision?”number
Bump on every change the JSON-Schema hash cannot see. See EventStreamEntry.revision.
Returns
Section titled “Returns”EventStreamEntry<TPayload>