import { topKWithFractionalIndex } from './topKWithFractionalIndex.js'; import { IStreamBuilder, KeyValue } from '../types.js'; export interface OrderByOptions { comparator?: (a: Ve, b: Ve) => number; limit?: number; offset?: number; } type OrderByWithFractionalIndexOptions = OrderByOptions & { setSizeCallback?: (getSize: () => number) => void; setWindowFn?: (windowFn: (options: { offset?: number; limit?: number; }) => void) => void; }; /** * Orders the elements and limits the number of results, with optional offset * This requires a keyed stream, and uses the `topK` operator to order all the elements. * * @param valueExtractor - A function that extracts the value to order by from the element * @param options - An optional object containing comparator, limit and offset properties * @returns A piped operator that orders the elements and limits the number of results */ export declare function orderBy, Ve = unknown>(valueExtractor: (value: T extends KeyValue ? V : never) => Ve, options?: OrderByOptions): (stream: IStreamBuilder) => IStreamBuilder; /** * Orders the elements and limits the number of results, with optional offset and * annotates the value with the index. * This requires a keyed stream, and uses the `topKWithIndex` operator to order all the elements. * * @param valueExtractor - A function that extracts the value to order by from the element * @param options - An optional object containing comparator, limit and offset properties * @returns A piped operator that orders the elements and limits the number of results */ export declare function orderByWithIndex, Ve = unknown>(valueExtractor: (value: T extends KeyValue ? V : never) => Ve, options?: OrderByOptions): (stream: IStreamBuilder) => IStreamBuilder ? K : never, [T extends KeyValue ? V : never, number]>>; export declare function orderByWithFractionalIndexBase, Ve = unknown>(topKFunction: typeof topKWithFractionalIndex, valueExtractor: (value: T extends KeyValue ? V : never) => Ve, options?: OrderByWithFractionalIndexOptions): (stream: IStreamBuilder) => IStreamBuilder<[T extends KeyValue ? K : never, [T extends KeyValue ? V : never, string]]>; /** * Orders the elements and limits the number of results, with optional offset and * annotates the value with a fractional index. * This requires a keyed stream, and uses the `topKWithFractionalIndex` operator to order all the elements. * * @param valueExtractor - A function that extracts the value to order by from the element * @param options - An optional object containing comparator, limit and offset properties * @returns A piped operator that orders the elements and limits the number of results */ export declare function orderByWithFractionalIndex, Ve = unknown>(valueExtractor: (value: T extends KeyValue ? V : never) => Ve, options?: OrderByWithFractionalIndexOptions): (stream: IStreamBuilder) => IStreamBuilder<[T extends KeyValue ? K : never, [T extends KeyValue ? V : never, string]]>; export {};