import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; import { Params, PropertyName, SortByProperty } from '.'; export declare enum AggregateSteps { GROUPBY = "GROUPBY", SORTBY = "SORTBY", APPLY = "APPLY", LIMIT = "LIMIT", FILTER = "FILTER" } interface AggregateStep { type: T; } export declare enum AggregateGroupByReducers { COUNT = "COUNT", COUNT_DISTINCT = "COUNT_DISTINCT", COUNT_DISTINCTISH = "COUNT_DISTINCTISH", SUM = "SUM", MIN = "MIN", MAX = "MAX", AVG = "AVG", STDDEV = "STDDEV", QUANTILE = "QUANTILE", TOLIST = "TOLIST", TO_LIST = "TOLIST", FIRST_VALUE = "FIRST_VALUE", RANDOM_SAMPLE = "RANDOM_SAMPLE" } interface GroupByReducer { type: T; AS?: string; } type CountReducer = GroupByReducer; interface CountDistinctReducer extends GroupByReducer { property: PropertyName; } interface CountDistinctishReducer extends GroupByReducer { property: PropertyName; } interface SumReducer extends GroupByReducer { property: PropertyName; } interface MinReducer extends GroupByReducer { property: PropertyName; } interface MaxReducer extends GroupByReducer { property: PropertyName; } interface AvgReducer extends GroupByReducer { property: PropertyName; } interface StdDevReducer extends GroupByReducer { property: PropertyName; } interface QuantileReducer extends GroupByReducer { property: PropertyName; quantile: number; } interface ToListReducer extends GroupByReducer { property: PropertyName; } interface FirstValueReducer extends GroupByReducer { property: PropertyName; BY?: PropertyName | { property: PropertyName; direction?: 'ASC' | 'DESC'; }; } interface RandomSampleReducer extends GroupByReducer { property: PropertyName; sampleSize: number; } type GroupByReducers = CountReducer | CountDistinctReducer | CountDistinctishReducer | SumReducer | MinReducer | MaxReducer | AvgReducer | StdDevReducer | QuantileReducer | ToListReducer | FirstValueReducer | RandomSampleReducer; interface GroupByStep extends AggregateStep { properties?: PropertyName | Array; REDUCE: GroupByReducers | Array; } interface SortStep extends AggregateStep { BY: SortByProperty | Array; MAX?: number; } interface ApplyStep extends AggregateStep { expression: string; AS: string; } interface LimitStep extends AggregateStep { from: number; size: number; } interface FilterStep extends AggregateStep { expression: string; } type LoadField = PropertyName | { identifier: PropertyName; AS?: string; }; export interface AggregateOptions { VERBATIM?: true; LOAD?: LoadField | Array; STEPS?: Array; PARAMS?: Params; DIALECT?: number; TIMEOUT?: number; } export declare const FIRST_KEY_INDEX = 1; export declare const IS_READ_ONLY = true; export declare function transformArguments(index: string, query: string, options?: AggregateOptions): RedisCommandArguments; export declare function pushAggregatehOptions(args: RedisCommandArguments, options?: AggregateOptions): RedisCommandArguments; export type AggregateRawReply = [ total: number, ...results: Array> ]; export interface AggregateReply { total: number; results: Array>; } export declare function transformReply(rawReply: AggregateRawReply): AggregateReply; export {};