import { StreamSubscriptionActions } from "./stream_subscription"; export interface StreamInterface { listen(onData: StreamListener, callbacks?: StreamListenOptions): StreamSubscriptionActions; asBroadcastStream(): StreamInterface; every(condition: (data: T) => boolean): Promise; first(): Promise; firstWhere(condition: (data: T) => boolean): Promise; forEach(fn: (data: T) => void): Promise; reduce(reducer: (prev: any, next: T) => any): Promise; map(transform: (data: T) => any): StreamInterface; take(n: number): StreamInterface; takeWhile(condition: (data: T) => boolean): StreamInterface; skip(n: number): StreamInterface; skipWhile(condition: (data: T) => boolean): StreamInterface; where(condition: (data: T) => boolean): StreamInterface; toArray(): Promise>; toSet(): Promise>; isBroadcast: boolean; } /** * streamMessageType - the types a message can be */ export declare enum StreamMessageType { Data = 0, Error = 1, Done = 2 } /** * StreamMessageData - represents data in a stream * @template T - The type of data i nthe stream */ export interface StreamMessageData { type: StreamMessageType.Data; data: T; } /** * StreamMessageError - represents errors in the stream */ export interface StreamMessageError { type: StreamMessageType.Error; data: Error; } /** * StreamMessageDone - represents the done message in the stream */ export interface StreamMessageDone { type: StreamMessageType.Done; } /** * StreamMessage - the messages in the stream */ export declare type StreamMessage = StreamMessageData | StreamMessageError | StreamMessageDone; /** * streamListener - listeners of the stream * @param data - the data passed to the listener * @template T - the type of the data */ export interface StreamListener { (data: T): void; } /** * streamErrorListener - error listeners on the stream * @param error - the error */ export interface StreamErrorListener { (e: Error): void; } /** * StreamCallback - callbacks for the stream (eg: onDone, onPause, onResume...) */ export interface StreamCallback { (): void; } /** * StreamListenOptions - the optional callbacks when listening to a stream */ export interface StreamListenOptions { onError?: StreamErrorListener; onDone?: StreamCallback; onPause?: StreamCallback; onResume?: StreamCallback; cancelOnError?: boolean; } //# sourceMappingURL=types.d.ts.map