import type { WindowSort } from "./WindowSort.js"; /** * The serialized form of [`WindowSpec`]. */ export type WindowSpec = { /** * The input column - either a real `Table` column or an expression * alias from the same `ViewConfig`. */ column: string; aggregate: string; /** * Columns whose distinct value tuples partition the rows; empty * partitions the whole `Table` as one group. */ partition_by?: Array; /** * The `Table` column which orders each partition, and the direction. * This orders rows WITHIN the window frame only — it does not * reorder the `View`, which is what the view-level `sort` does. */ order_by?: WindowSort | null; /** * A frame of the `rows` preceding each row, plus the row itself. * Mutually exclusive with `range` and `cumulative`. */ rows?: number | null; /** * A frame of the rows whose `order_by` value lies within `range` of * each row's, requiring a numeric or temporal `order_by`. Mutually * exclusive with `rows` and `cumulative`. */ range?: number | null; /** * `true` frames all rows from the partition start through each row. * Default can be omitted. */ cumulative?: boolean | null; /** * Row offset for `lag`/`lead` (default 1). */ offset?: number | null; /** * Smoothing factor in `(0, 1]` for `ema`. */ alpha?: number | null; };