Event contracts. State changes are immutable, attributable, versioned events. Current state is derived by folding events, never by mutating rows in place.

interface EventEnvelope<T, P> {
    actor: string;
    at: number;
    id: string;
    payload: P;
    schema: number;
    seq?: number;
    tenantId: string;
    type: T;
}

Type Parameters

  • T extends string = string
  • P = unknown

Properties

actor: string
at: number
id: string
payload: P
schema: number

Schema version of the payload for this event type. See schemas.ts.

seq?: number

Per tenant sequence assigned by the tenant stream (Durable Object). Absent until appended.

tenantId: string
type: T