import type { Plan, QueryPayload } from "../../worksheet"; import type { IDataQueryWorkflowStep, IFilterWorkflowStep, IViewWorkflowStep } from '../../interfaces'; type Measure = Extract['measures'][number]; /** * The editor's filters on aggregated values, such as sum(Sales) >= 100. The editor applies them to * the rows of its one aggregated query, so they hold at one grain: the dimensions that query * groups by. `measures` are the aggregates the filters read, under the names the filters use. */ export interface Having { groupBy: string[]; measures: Measure[]; filters: IFilterWorkflowStep[]; } /** * What the editor's own workflow says about a chart, for the worksheet's queries to be built around. * - `before`: the steps ahead of the editor's view step, which every worksheet query starts with: * row filters, computed fields, filters on those. * - `expressions`: the aggregate expressions of the chart by field id, as the editor's workflow * builder wrote them out, with the fields they name resolved. * - `having`: the filters on aggregated values that come after the view step. */ export interface Around { before: IDataQueryWorkflowStep[]; expressions: Record; having?: Having; } /** Reads `Around` out of the workflow the editor would run for the chart. */ export declare function splitWorkflow(steps: IDataQueryWorkflowStep[]): Around; /** * Whether every query the sheet draws its marks from is an aggregate at the grain the filters hold * at. Only then do the filters mean in the sheet what they mean in the editor's other renderers. * Queries that only order members are at a coarser grain and are not asked about. */ export declare function drawnAtGrain(plan: Plan, groupBy: string[]): boolean; /** * The workflow sent for one worksheet query: the editor's steps before its view step, the * worksheet's own grouping, the filters on aggregated values where the query is at their grain, * and the worksheet's ordering. A query at another grain, which orders members by their totals, * is not filtered. * * An aggregate expression is asked for by field id and sent as the editor's expression, to be * worked out by the data source over the rows of each group of this query. So a query that orders * members gets the expression's value for each member as a whole, not one put together from the * values of the marks. */ export declare function composeWorkflow({ before, expressions, having }: Around, aggregated: boolean, payload: QueryPayload): IDataQueryWorkflowStep[]; export {};