/** * Bounded, deterministic dataset transforms. * * A transform is data, not an expression: a fixed pipeline of five optional * stages that always run in the same order (filter → groupBy → sort → select → * limit). Comparison never consults a locale, and sorting is stable, so the same * rows and the same transform always produce the same rows in the same order. */ import type { PropSchema } from '../registry/prop-schema.js'; import { type DataRow, type DataScalar } from './dataset-types.js'; export type FilterOperator = 'equals' | 'notEquals' | 'in' | 'gt' | 'gte' | 'lt' | 'lte'; export declare const FILTER_OPERATORS: readonly FilterOperator[]; export interface FilterClause { field: string; equals?: DataScalar; notEquals?: DataScalar; in?: DataScalar[]; gt?: number; gte?: number; lt?: number; lte?: number; } export type Aggregate = 'count' | 'sum' | 'mean' | 'min' | 'max'; export declare const AGGREGATES: readonly Aggregate[]; export interface GroupBySpec { field: string; aggregate: Aggregate; /** Numeric field to aggregate; required for everything except `count`. */ value?: string; /** Output field name; defaults to `count`, or to the `value` field name. */ as?: string; } export interface SortKey { by: string; direction?: 'asc' | 'desc'; } export interface TransformSpec { /** Up to 8 clauses, combined with AND; each has exactly one operator. */ filter?: FilterClause[]; groupBy?: GroupBySpec; /** One key or up to 3 keys, applied in order. */ sort?: SortKey | SortKey[]; /** Fields to keep, in this order (up to 24). */ select?: string[]; /** Keep the first N rows (1–200). */ limit?: number; } export declare const TRANSFORM_LIMITS: { readonly maxFilters: 8; readonly maxSortKeys: 3; readonly maxSelect: 24; }; /** Prop schema for `transform`: used for validation, the JSON Schema, and describe. */ export declare const TRANSFORM_PROP_SCHEMA: PropSchema; /** The output field name of a groupBy aggregate. */ export declare function aggregateField(groupBy: GroupBySpec): string; /** Comparator for one key: nulls sort last in both directions. */ export declare function compareScalars(left: DataScalar, right: DataScalar, direction?: 'asc' | 'desc'): number; export declare function sortKeys(sort: TransformSpec['sort']): SortKey[]; /** * Apply a validated transform. Pure: the input rows are never mutated. * Fixed order: filter → groupBy → sort → select → limit. */ export declare function applyTransform(rows: DataRow[], spec: TransformSpec): DataRow[]; //# sourceMappingURL=transform-pipeline.d.ts.map