UNPKG

@kurrent/kurrentdb-client

Version:
36 lines (35 loc) 1.32 kB
import type { BaseOptions, Direction, EventType, ReadRevision, ResolvedEvent } from "../types"; export interface ReadStreamOptions extends BaseOptions { /** * The number of events to read. * @defaultValue Number.MAX_SAFE_INTEGER */ maxCount?: number | bigint; /** * Starts the read at the given event revision. * @defaultValue START */ fromRevision?: ReadRevision; /** * The best way to explain link resolution is when using system projections. When reading the stream `$streams` (which * contains all streams), each event is actually a link pointing to the first event of a stream. By enabling link * resolution feature, the server will also return the event targeted by the link. * @defaultValue false */ resolveLinkTos?: boolean; /** * Sets the read direction of the stream. * @defaultValue FORWARDS */ direction?: Direction; } declare module "../Client" { interface Client { /** * Reads events from a given stream. * @param streamName - A stream name. * @param options - Reading options. */ readStream<KnownEventType extends EventType = EventType>(streamName: string, options?: ReadStreamOptions): AsyncIterableIterator<ResolvedEvent<KnownEventType>>; } }