Skip to content

unwrapSseData

function unwrapSseData<T>(source): AsyncIterable<T>;

Adapt a readSse iterable (frames with SSE envelope) into a bare data-only iterable. Callers that don't need the SSE event: name or id: field use this to expose a clean typed data stream — the SDK's streaming resource methods (runs.stream, evalRuns.events, adapters.prepare, the secrets rotation event stream) all go through this shim.

Errors from the underlying reader propagate through. Cancellation via AbortSignal on the source options is transparent (the source completes cleanly on abort — the wrapper follows).

Type Parameter
T
Parameter Type
source AsyncIterable<SseEvent<T>>

AsyncIterable<T>