Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/protocol / server-message / isEventFrame

Function: isEventFrame()

ts
function isEventFrame(message): message is { eventId: string; kind: "event"; payload?: unknown; subject: string; subscriptionId: string; type: string; v: "1" };

Defined in: server-message.ts:184

Type guard helpers, one per discriminator. The narrow over the ServerMessage union without forcing consumers to memorize the exact field names.

Parameters

ParameterType
message| { id: string | number; jsonrpc: "2.0"; result?: unknown; v: "1"; } | { error: { code: number; data?: unknown; message: string; }; id: string | number; jsonrpc: "2.0"; v: "1"; } | { kind: "subscribed"; snapshotEventId?: string; subject: string; subscriptionId: string; v: "1"; } | { kind: "unsubscribed"; subscriptionId: string; v: "1"; } | { eventId: string; kind: "event"; payload?: unknown; subject: string; subscriptionId: string; type: string; v: "1"; } | { kind: "lifecycle"; reason?: string; status: "aborted" | "running" | "paused" | "completed" | "failed"; subscriptionId: string; v: "1"; } | { code: string; data?: unknown; fatal?: boolean; kind: "error"; message: string; subscriptionId?: string; v: "1"; } | { kind: "pong"; nonce?: string; v: "1"; } | { droppedCount?: number; eventId: string; kind: "replay-marker"; note?: string; subscriptionId: string; v: "1"; }

Returns

message is { eventId: string; kind: "event"; payload?: unknown; subject: string; subscriptionId: string; type: string; v: "1" }

Stable