import { IStreamBuilder, KeyValue } from '../types.js'; export interface GroupedOrderByOptions { comparator?: (a: Ve, b: Ve) => number; limit?: number; offset?: number; } export interface GroupedOrderByWithFractionalIndexOptions extends GroupedOrderByOptions { setSizeCallback?: (getSize: () => number) => void; setWindowFn?: (windowFn: (options: { offset?: number; limit?: number; }) => void) => void; /** * Function to extract a group key from the element's key and value. * Elements with the same group key will be sorted and limited together. */ groupKeyFn: (key: KeyType, value: ValueType) => unknown; } /** * Orders the elements per group and limits the number of results per group, with optional offset and * annotates the value with a fractional index. * This requires a keyed stream, and uses the `groupedTopKWithFractionalIndex` operator to order elements within each group. * * Elements are grouped by the provided groupKeyFn, and each group maintains its own sorted collection * with independent limit/offset. * * @param valueExtractor - A function that extracts the value to order by from the element * @param options - Configuration including groupKeyFn, comparator, limit, and offset * @returns A piped operator that orders the elements per group and limits the number of results per group */ export declare function groupedOrderByWithFractionalIndex, Ve = unknown>(valueExtractor: (value: T extends KeyValue ? V : never) => Ve, options: GroupedOrderByWithFractionalIndexOptions ? K : never, T extends KeyValue ? V : never>): (stream: IStreamBuilder) => IStreamBuilder<[T extends KeyValue ? K : never, [T extends KeyValue ? V : never, string]]>;