UNPKG

@synet/patterns

Version:

Robust, battle-tested collection of stable patterns used in Synet packages

37 lines (36 loc) 875 B
import type { Event } from "../../patterns/event-emitter"; /** * A topic is a named channel for events * Examples: "users", "notifications", "system.alerts" */ export type Topic = string; /** * Extended event interface with additional fields required for realtime communication */ export interface RealtimeEvent<T = unknown> extends Event { /** * Unique identifier for the event */ id: string; /** * Source system that generated the event */ source: string; /** * When the event occurred */ timestamp: Date; /** * Event payload */ data: T; /** * Additional contextual information */ metadata?: Record<string, unknown>; /** * Client ID that originated the event (optional) * Used for routing and tracking in multi-client environments */ clientId?: string; }