import { MaybeAsync } from '../types';
export type GeneratorForEach<InType> = MaybeAsync<(value: InType, index: number, src: AsyncGenerator<InType>) => void>;
export type GeneratorFilter<InType> = MaybeAsync<(value: InType, index: number, src: AsyncGenerator<InType>) => any>;
export type GeneratorMap<InType, OutType> = (value: InType, index: number, src: AsyncGenerator<InType>) => OutType | Promise<OutType>;
type OnError<ValueType> = (err: Error, value: ValueType, index: number) => Promise<any> | any;
/**
 * Similar to Array#forEach or Stream.PassThrough.
 * Allows inspection of a pipeline without mutating it.
 * Note: Pipeline will block until forEach call resolves.
 */
export declare function forEach<InType>(src: AsyncGenerator<InType>, fn: GeneratorForEach<InType>, onError?: OnError<InType>): AsyncGenerator<InType>;
/**
 * Similar to Array#map or Stream.Transform.
 */
export declare function map<InType, OutType>(src: AsyncGenerator<InType>, fn: GeneratorMap<InType, OutType>, onError?: OnError<InType>): AsyncGenerator<OutType>;
/**
 * Similar to Array#filter
 */
export declare function filter<InType>(src: AsyncGenerator<InType>, fn: GeneratorFilter<InType>, onError?: OnError<InType>): AsyncGenerator<InType>;
/**
 * Start consuming generator.
 * Takes optional forEach function.
 */
export declare function consume<InType>(src: AsyncGenerator<InType>, fn?: GeneratorForEach<InType>, onError?: OnError<InType>): Promise<void>;
export declare function unique<T>(source: AsyncIterable<T>, getIdentity: (item: T) => string): AsyncGenerator<T>;
export declare const fromArray: <T>(items: T[]) => AsyncGenerator<T, any, unknown>;
export declare const transformError: <T>(src: AsyncGenerator<T, any, unknown>, transformFn: (err: any) => any) => AsyncGenerator<T, any, unknown>;
export {};
