UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

19 lines (18 loc) 794 B
/** * A generic event that can be emitted with `squid.events().emit` and handled by one or more * subscribers declared with the backend `@eventHandler` decorator. Events are delivered over core's * internal event stream (not the public queue API), at-least-once and with no ordering guarantee. */ export interface TriggerEvent<T = unknown> { /** Unique event id (e.g. `generateUUID()`). */ id: string; /** The event type. Determines which `@eventHandler` subscribers receive the event. */ type: string; /** Arbitrary, JSON-serializable event payload. */ payload: T; } /** Request body for the `events/emit` core endpoint that publishes a `TriggerEvent`. */ export interface EmitEventRequest<T = unknown> { /** The event to emit. */ event: TriggerEvent<T>; }