mogami-stream - v0.4.0
    Preparing search index...

    Interface Stream<T>

    A lazy stream with fluent operators, composition, and terminal methods.

    interface Stream<T> {
        "[asyncIterator]"(): StreamIterator<T>;
        at(
            index: number,
            options?: ExecutionOptions,
        ): Promise<Awaited<T> | undefined>;
        broadcast<const K extends readonly string[]>(
            options: KeyedBroadcastOptions<K[number]> & { branches: K },
        ): FluentBranchGroup<{ readonly [P in string]: T }>;
        broadcast(options: BroadcastOptions): FluentBranchGroup<readonly T[]>;
        bufferTime(windowMs: number, options: BufferTimeOptions): Stream<T[]>;
        catchError<U>(
            handler: (
                error: unknown,
                context: ResourceContext,
            ) => Source<U> | PromiseLike<Source<U>>,
        ): Stream<T | U>;
        chunks(size: number): Stream<T[]>;
        concat<U>(this: Stream<Source<U>>, options?: HigherOrderOptions): Stream<U>;
        concatMap<U>(
            mapper: (value: T, context: OperatorContext) => Source<U>,
            options?: HigherOrderOptions,
        ): Stream<U>;
        count(options?: ExecutionOptions): Promise<number>;
        deadline(durationMs: number): Stream<T>;
        dedupe<K = T>(
            keySelector?: (value: T, context: OperatorContext) => K,
        ): Stream<T>;
        delayStart(ms: number): Stream<T>;
        drain(options?: ExecutionOptions): Promise<void>;
        every(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
            options?: ExecutionOptions,
        ): Promise<boolean>;
        filter<S>(
            predicate: (value: T, context: OperatorContext) => value is S,
        ): Stream<S>;
        filter(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
        ): Stream<T>;
        filterMap<U>(
            mapper: (value: T, context: OperatorContext) => U,
        ): Stream<NonNullable<Awaited<U>>>;
        finalize(effect: () => unknown): Stream<T>;
        find<S>(
            predicate: (value: T, context: OperatorContext) => value is S,
            options?: ExecutionOptions,
        ): Promise<Awaited<S> | undefined>;
        find(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
            options?: ExecutionOptions,
        ): Promise<Awaited<T> | undefined>;
        flatMap<U>(
            mapper: (value: T, context: OperatorContext) => Source<U>,
            options?: HigherOrderOptions,
        ): Stream<U>;
        flatten<U>(
            this: Stream<Source<U>>,
            options?: HigherOrderOptions,
        ): Stream<U>;
        forEach(
            effect: (value: T, context: OperatorContext) => unknown,
            options?: ExecutionOptions,
        ): Promise<void>;
        iterate(options?: ExecutionOptions): StreamIterator<T>;
        map<U>(
            mapper: (value: T, context: MapContext) => U,
            options?: MapOptions,
        ): Stream<Awaited<U>>;
        mapSettled<U>(
            mapper: (value: T, context: MapContext) => U,
            options?: MapOptions,
        ): Stream<SettledResult<Awaited<U>>>;
        pipe(): Stream<T>;
        pipe<A>(op1: CoreOperator<T, A>): Stream<A>;
        pipe<A, B>(op1: CoreOperator<T, A>, op2: CoreOperator<A, B>): Stream<B>;
        pipe<A, B, C>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
        ): Stream<C>;
        pipe<A, B, C, D>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
        ): Stream<D>;
        pipe<A, B, C, D, E>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
        ): Stream<E>;
        pipe<A, B, C, D, E, F>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
        ): Stream<F>;
        pipe<A, B, C, D, E, F, G>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
        ): Stream<G>;
        pipe<A, B, C, D, E, F, G, H>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
        ): Stream<H>;
        pipe<A, B, C, D, E, F, G, H, I>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
        ): Stream<I>;
        pipe<A, B, C, D, E, F, G, H, I, J>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
        ): Stream<J>;
        pipe<A, B, C, D, E, F, G, H, I, J, K>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
        ): Stream<K>;
        pipe<A, B, C, D, E, F, G, H, I, J, K, L>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
            op12: CoreOperator<K, L>,
        ): Stream<L>;
        pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
            op12: CoreOperator<K, L>,
            op13: CoreOperator<L, M>,
        ): Stream<M>;
        pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
            op12: CoreOperator<K, L>,
            op13: CoreOperator<L, M>,
            op14: CoreOperator<M, N>,
        ): Stream<N>;
        pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
            op12: CoreOperator<K, L>,
            op13: CoreOperator<L, M>,
            op14: CoreOperator<M, N>,
            op15: CoreOperator<N, O>,
        ): Stream<O>;
        pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
            op5: CoreOperator<D, E>,
            op6: CoreOperator<E, F>,
            op7: CoreOperator<F, G>,
            op8: CoreOperator<G, H>,
            op9: CoreOperator<H, I>,
            op10: CoreOperator<I, J>,
            op11: CoreOperator<J, K>,
            op12: CoreOperator<K, L>,
            op13: CoreOperator<L, M>,
            op14: CoreOperator<M, N>,
            op15: CoreOperator<N, O>,
            op16: CoreOperator<O, P>,
        ): Stream<P>;
        rateLimit(options: RateLimitOptions): Stream<T>;
        reduce<A>(
            reducer: (
                accumulator: Awaited<A>,
                value: T,
                context: OperatorContext,
            ) => Awaited<A> | PromiseLike<Awaited<A>>,
            initial: A,
            options?: ExecutionOptions,
        ): Promise<Awaited<A>>;
        route<
            const R extends Record<string, RoutePredicate<T>>,
            const D extends string | undefined = undefined,
        >(
            options: PredicateRouteOptions<T, R, D>,
        ): FluentBranchGroup<RoutedValues<T, R, D>>;
        route<const K extends readonly string[]>(
            options: KeyedRouteOptions<T, K[number]> & { branches: K },
        ): FluentBranchGroup<{ readonly [P in string]: T }>;
        route(options: RouteOptions<T>): FluentBranchGroup<readonly T[]>;
        scan<A>(
            reducer: (
                accumulator: Awaited<A>,
                value: T,
                context: OperatorContext,
            ) => Awaited<A> | PromiseLike<Awaited<A>>,
            initial: A,
        ): Stream<Awaited<A>>;
        skip(count: number): Stream<T>;
        skipWhile(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
        ): Stream<T>;
        slice(start?: number, end?: number): Stream<T>;
        slidingWindow(size: number): Stream<T[]>;
        some(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
            options?: ExecutionOptions,
        ): Promise<boolean>;
        spaceout(intervalMs: number): Stream<T>;
        take(count: number): Stream<T>;
        takeWhile<S>(
            predicate: (value: T, context: OperatorContext) => value is S,
        ): Stream<S>;
        takeWhile(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
        ): Stream<T>;
        tap(effect: (value: T, context: OperatorContext) => unknown): Stream<T>;
        timeoutEach(ms: number): Stream<T>;
        toArray(options?: ExecutionOptions): Promise<T[]>;
        toMap<K>(
            keySelector: (value: T, context: OperatorContext) => K,
            options?: ExecutionOptions,
        ): Promise<Map<Awaited<K>, T>>;
        toReadableStream(options?: ExecutionOptions): ReadableStream<T>;
        toSet(options?: ExecutionOptions): Promise<Set<T>>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index
    • Selects a zero-based position; negative indices count from the end.

      Parameters

      Returns Promise<Awaited<T> | undefined>

    • Groups values into arrays of at most size items.

      Parameters

      • size: number

      Returns Stream<T[]>

    • Limits the duration of this stage.

      Parameters

      • durationMs: number

      Returns Stream<T>

    • Delays opening upstream.

      Parameters

      • ms: number

      Returns Stream<T>

    • Returns false on the first non-matching value and closes upstream early, or true if all values match.

      Parameters

      Returns Promise<boolean>

    • Keeps matching values; synchronous type guards narrow the output type.

      Type Parameters

      • S

      Parameters

      Returns Stream<S>

    • Keeps matching values; synchronous type guards narrow the output type.

      Parameters

      • predicate: (value: T, context: OperatorContext) => boolean | PromiseLike<boolean>

      Returns Stream<T>

    • Maps values sequentially, omitting null and undefined results.

      Type Parameters

      • U

      Parameters

      Returns Stream<NonNullable<Awaited<U>>>

    • Runs an effect during cleanup and waits for it to finish.

      Parameters

      • effect: () => unknown

      Returns Stream<T>

    • Returns the first value matching predicate (or undefined if none match) and closes upstream.

      Type Parameters

      • S

      Parameters

      Returns Promise<Awaited<S> | undefined>

    • Returns the first value matching predicate (or undefined if none match) and closes upstream.

      Parameters

      Returns Promise<Awaited<T> | undefined>

    • Maps values with the same concurrency, ordering, and retry options as map.

      Type Parameters

      • U

      Parameters

      Returns Stream<Awaited<U>>

    • Reduces values sequentially from initial and returns the final accumulator after cleanup.

      Type Parameters

      • A

      Parameters

      Returns Promise<Awaited<A>>

    • Emits each updated accumulator after reducing a value.

      Type Parameters

      • A

      Parameters

      • reducer: (
            accumulator: Awaited<A>,
            value: T,
            context: OperatorContext,
        ) => Awaited<A> | PromiseLike<Awaited<A>>
      • initial: A

      Returns Stream<Awaited<A>>

    • Skips the first count values.

      Parameters

      • count: number

      Returns Stream<T>

    • Skips a matching prefix.

      Parameters

      • predicate: (value: T, context: OperatorContext) => boolean | PromiseLike<boolean>

      Returns Stream<T>

    • Selects a range with an exclusive end; negative bounds count from the end.

      Parameters

      • start: number = 0
      • Optionalend: number

      Returns Stream<T>

    • Emits overlapping full windows, advancing one item at a time.

      Parameters

      • size: number

      Returns Stream<T[]>

    • Returns true on the first matching value and closes upstream early, or false if no values match.

      Parameters

      Returns Promise<boolean>

    • Spaces delivery of values.

      Parameters

      • intervalMs: number

      Returns Stream<T>

    • Emits at most count values, then closes upstream.

      Parameters

      • count: number

      Returns Stream<T>

    • Emits a matching prefix; synchronous type guards narrow the output type.

      Type Parameters

      • S

      Parameters

      Returns Stream<S>

    • Emits a matching prefix; synchronous type guards narrow the output type.

      Parameters

      • predicate: (value: T, context: OperatorContext) => boolean | PromiseLike<boolean>

      Returns Stream<T>

    • Limits how long each upstream read may take.

      Parameters

      • ms: number

      Returns Stream<T>