/** * @since 2.0.0 */ import * as internal from "./internal/groupBy.js" import type { Pipeable } from "./Pipeable.js" import type { Predicate } from "./Predicate.js" import type * as Queue from "./Queue.js" import type * as Stream from "./Stream.js" import type * as Take from "./Take.js" import type { Covariant, NoInfer } from "./Types.js" /** * @since 2.0.0 * @category symbols */ export const GroupByTypeId: unique symbol = internal.GroupByTypeId /** * @since 2.0.0 * @category symbols */ export type GroupByTypeId = typeof GroupByTypeId /** * Representation of a grouped stream. This allows to filter which groups will * be processed. Once this is applied all groups will be processed in parallel * and the results will be merged in arbitrary order. * * @since 2.0.0 * @category models */ export interface GroupBy extends GroupBy.Variance, Pipeable { readonly grouped: Stream.Stream>], E, R> } /** * @since 2.0.0 */ export declare namespace GroupBy { /** * @since 2.0.0 * @category models */ export interface Variance { readonly [GroupByTypeId]: { readonly _K: Covariant readonly _V: Covariant readonly _E: Covariant readonly _R: Covariant } } } /** * Run the function across all groups, collecting the results in an * arbitrary order. * * @since 2.0.0 * @category destructors */ export const evaluate: { /** * Run the function across all groups, collecting the results in an * arbitrary order. * * @since 2.0.0 * @category destructors */ ( f: (key: K, stream: Stream.Stream) => Stream.Stream, options?: { readonly bufferSize?: number | undefined } | undefined ): (self: GroupBy) => Stream.Stream /** * Run the function across all groups, collecting the results in an * arbitrary order. * * @since 2.0.0 * @category destructors */ ( self: GroupBy, f: (key: K, stream: Stream.Stream) => Stream.Stream, options?: { readonly bufferSize?: number | undefined } | undefined ): Stream.Stream } = internal.evaluate /** * Filter the groups to be processed. * * @since 2.0.0 * @category utils */ export const filter: { /** * Filter the groups to be processed. * * @since 2.0.0 * @category utils */ (predicate: Predicate>): (self: GroupBy) => GroupBy /** * Filter the groups to be processed. * * @since 2.0.0 * @category utils */ (self: GroupBy, predicate: Predicate): GroupBy } = internal.filter /** * Only consider the first `n` groups found in the `Stream`. * * @since 2.0.0 * @category utils */ export const first: { /** * Only consider the first `n` groups found in the `Stream`. * * @since 2.0.0 * @category utils */ (n: number): (self: GroupBy) => GroupBy /** * Only consider the first `n` groups found in the `Stream`. * * @since 2.0.0 * @category utils */ (self: GroupBy, n: number): GroupBy } = internal.first /** * Constructs a `GroupBy` from a `Stream`. * * @since 2.0.0 * @category constructors */ export const make: ( grouped: Stream.Stream>], E, R> ) => GroupBy = internal.make