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

    Interface Stream<T>

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

    interface Stream<T> {
        "[asyncIterator]"(): StreamIterator<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>;
        deadline(durationMs: number): Stream<T>;
        dedupe<K = T>(
            keySelector?: (value: T, context: OperatorContext) => K,
        ): Stream<T>;
        delayStart(ms: number): Stream<T>;
        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>;
        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>>;
        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>;
        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[]>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

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

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