import type { ColumnInfo, JoinSelect, PG_COLUMN_UDT_DATA_TYPE, Select, ValidatedColumnInfo } from "prostgles-types"; import type { PGIdentifier, SortItem } from "../DboBuilder"; import type { ParsedJoinPath } from "../ViewHandler/parseJoinPath"; import type { ViewHandler } from "../ViewHandler/ViewHandler"; import type { FieldSpec, FunctionSpec } from "./Functions/Functions"; export type SelectItem = { getFields: (args: any[]) => string[] | "*"; getQuery: (tableAliasRaw?: string) => string; columnPGDataType?: string; column_udt_type?: PG_COLUMN_UDT_DATA_TYPE; tsDataType?: ValidatedColumnInfo["tsDataType"]; alias: string; selected: boolean; } & ({ type: "column"; columnName: string; } | { type: "function" | "aggregation" | "joinedColumn" | "computed"; columnName?: undefined; }); export type SelectItemValidated = Omit & { fields: string[]; }; export type WhereOptions = Awaited>; export type NewQueryRoot = { /** * All fields from the table will be in nested SELECT and GROUP BY to allow order/filter by fields not in select */ allFields: string[]; /** * Contains user selection and all the allowed columns. Allowed columns not selected are marked with selected: false */ select: SelectItemValidated[]; table: PGIdentifier; where: string; whereOpts: WhereOptions; orderByItems: SortItem[]; having: string; limit: number | null; offset: number; isLeftJoin: boolean; tableAlias?: PGIdentifier; }; export type NewQueryJoin = NewQuery & { joinPath: ParsedJoinPath[]; joinAlias: PGIdentifier; }; export type NewQuery = NewQueryRoot & { joins?: NewQueryJoin[]; }; export declare const parseFunctionObject: (funcData: unknown) => { funcName: string; args: any[]; }; export declare class SelectItemBuilder { select: SelectItemValidated[]; private allFields; private allowedFields; private allowedOrderByFields; private computedFields; private functions; private allowedFieldsIncludingComputed; private columns; constructor(params: { allowedFields: string[]; allowedOrderByFields: string[]; computedFields: FieldSpec[]; functions: FunctionSpec[]; allFields: string[]; isView: boolean; columns: ColumnInfo[]; }); private checkField; private addItem; private addFunction; addColumn: (fieldName: string, selected: boolean) => void; parseUserSelect: (userSelect: Select, joinParse?: (key: string, val: JoinSelect, throwErr: (msg: string) => any) => any) => Promise; } //# sourceMappingURL=QueryBuilder.d.ts.map