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

    Interface CoreStream<T>

    A lazy AsyncIterable pipeline with composable operators and terminal methods.

    Create streams with from, defer, or another source factory. Each iteration runs an independent execution; whether a stream can be iterated more than once depends on its underlying source.

    interface CoreStream<T> {
        "[asyncIterator]"(): StreamIterator<T>;
        every(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
            options?: ExecutionOptions,
        ): Promise<boolean>;
        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>;
        forEach(
            effect: (value: T, context: OperatorContext) => unknown,
            options?: ExecutionOptions,
        ): Promise<void>;
        iterate(options?: ExecutionOptions): StreamIterator<T>;
        pipe(): CoreStream<T>;
        pipe<A>(op1: CoreOperator<T, A>): CoreStream<A>;
        pipe<A, B>(op1: CoreOperator<T, A>, op2: CoreOperator<A, B>): CoreStream<B>;
        pipe<A, B, C>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
        ): CoreStream<C>;
        pipe<A, B, C, D>(
            op1: CoreOperator<T, A>,
            op2: CoreOperator<A, B>,
            op3: CoreOperator<B, C>,
            op4: CoreOperator<C, D>,
        ): CoreStream<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>,
        ): CoreStream<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>,
        ): CoreStream<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>,
        ): CoreStream<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>,
        ): CoreStream<H>;
        reduce<A>(
            reducer: (
                accumulator: Awaited<A>,
                value: T,
                context: OperatorContext,
            ) => Awaited<A> | PromiseLike<Awaited<A>>,
            initial: A,
            options?: ExecutionOptions,
        ): Promise<Awaited<A>>;
        some(
            predicate: (
                value: T,
                context: OperatorContext,
            ) => boolean | PromiseLike<boolean>,
            options?: ExecutionOptions,
        ): Promise<boolean>;
        toArray(options?: ExecutionOptions): Promise<T[]>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implements

    • AsyncIterable<T>
    Index
    • Creates a new execution that starts reading on the first next() call.

      Returns StreamIterator<T>

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

      Parameters

      Returns Promise<boolean>

    • 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>

    • Runs effect sequentially for each value and waits for cleanup without collecting results.

      Parameters

      Returns Promise<void>

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

      Type Parameters

      • A

      Parameters

      Returns Promise<Awaited<A>>

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

      Parameters

      Returns Promise<boolean>

    • Collects all emitted values into an array and waits for cleanup before resolving.

      Parameters

      Returns Promise<T[]>