import { IStreamBuilder, KeyValue } from '../types.js'; type GroupKey = Record; type BasicAggregateFunction = { preMap: (data: T) => V; reduce: (values: Array<[V, number]>) => V; postMap?: (result: V) => R; }; type PipedAggregateFunction = { pipe: (stream: IStreamBuilder) => IStreamBuilder>; }; type AggregateFunction = BasicAggregateFunction | PipedAggregateFunction; type ExtractAggregateReturnType = A extends AggregateFunction ? R : never; type AggregatesReturnType = { [K in keyof A]: ExtractAggregateReturnType; }; /** * Groups data by key and applies multiple aggregate operations * @param keyExtractor Function to extract grouping key from data * @param aggregates Object mapping aggregate names to aggregate functions */ export declare function groupBy>>(keyExtractor: (data: T) => K, aggregates?: A): (stream: IStreamBuilder) => IStreamBuilder>>; /** * Creates a sum aggregate function */ export declare function sum(valueExtractor?: (value: T) => number): AggregateFunction; /** * Creates a count aggregate function */ export declare function count(valueExtractor?: (value: T) => any): AggregateFunction; /** * Creates an average aggregate function */ export declare function avg(valueExtractor?: (value: T) => number): AggregateFunction; type CanMinMax = number | Date | bigint | string; /** * Creates a min aggregate function that computes the minimum value in a group * @param valueExtractor Function to extract a comparable value from each data entry */ export declare function min(): AggregateFunction; export declare function min(valueExtractor: (value: T) => V): AggregateFunction; /** * Creates a max aggregate function that computes the maximum value in a group * @param valueExtractor Function to extract a comparable value from each data entry */ export declare function max(): AggregateFunction; export declare function max(valueExtractor: (value: T) => V): AggregateFunction; /** * Creates a median aggregate function that computes the middle value in a sorted group * If there's an even number of values, returns the average of the two middle values * @param valueExtractor Function to extract a numeric value from each data entry */ export declare function median(valueExtractor?: (value: T) => number): AggregateFunction>; /** * Creates a mode aggregate function that computes the most frequent value in a group * If multiple values have the same highest frequency, returns the first one encountered * @param valueExtractor Function to extract a value from each data entry */ export declare function mode(valueExtractor?: (value: T) => number): AggregateFunction>; export declare const groupByOperators: { sum: typeof sum; count: typeof count; avg: typeof avg; min: typeof min; max: typeof max; median: typeof median; mode: typeof mode; }; export {};