/** * Shared realtime catalog SSE envelope unwrap (kiosk + customer). * * Backend SSEService wraps events as `{ eventId, eventVersion, eventType, payload, checksum, … }`. * Fail-closed: unsupported version or bad checksum → drop. * product_update unwrap: when `payload.type` is a string, use payload as the normalized message. */ import { REALTIME_SSE_VALIDATION_CODES, type RealtimeEnvelope } from './realtimeEnvelope.js'; export type ParseRealtimeCatalogSseStatus = 'ok' | 'passthrough' | 'drop' | 'invalid_json'; export interface ParseRealtimeCatalogSseOk { readonly status: 'ok'; readonly message: Record; readonly envelope: RealtimeEnvelope; } export interface ParseRealtimeCatalogSsePassthrough { readonly status: 'passthrough'; readonly message: unknown; } export interface ParseRealtimeCatalogSseDrop { readonly status: 'drop'; readonly code?: (typeof REALTIME_SSE_VALIDATION_CODES)[keyof typeof REALTIME_SSE_VALIDATION_CODES]; } export interface ParseRealtimeCatalogSseInvalidJson { readonly status: 'invalid_json'; } export type ParseRealtimeCatalogSseResult = ParseRealtimeCatalogSseOk | ParseRealtimeCatalogSsePassthrough | ParseRealtimeCatalogSseDrop | ParseRealtimeCatalogSseInvalidJson; /** * Unwrap a parsed JSON value that may be a realtime envelope. * Non-envelopes pass through unchanged. */ export declare function unwrapRealtimeCatalogSsePayload(parsed: unknown): ParseRealtimeCatalogSseResult; /** * Parse raw EventSource `data` and unwrap realtime envelopes for catalog handlers. */ export declare function parseRealtimeCatalogSseMessage(rawData: string): ParseRealtimeCatalogSseResult; /** * Customer EventSource detail helper: return JSON string of unwrapped message, * original raw for non-envelopes, or empty string when fail-closed drop / bad JSON. */ export declare function normalizeRealtimeCatalogSseEventData(rawData: string): string; //# sourceMappingURL=parseRealtimeCatalogSseMessage.d.ts.map