import type { WhereClauseRaw, RetainQueryPrimitiveFields } from './where-clause.ts'; type SelectClauseRaw = { [P in keyof T]?: T[P] extends object ? SelectClauseRaw> : (1 | 0 | boolean); }; type GroupClauseRaw = { [P in keyof T]?: T[P] extends object ? GroupClauseRaw> : (1 | 0 | boolean); }; type SortClauseRaw = { [P in keyof T]?: T[P] extends object ? SortClauseRaw> : 1 | -1; }; type QueryOptionsRaw = { sort?: SortClauseRaw[]; limit?: number; offset?: number | string; }; type QueryMain = { select?: SelectClauseRaw; where?: WhereClauseRaw; // TODO: Add grouping in later // group?: GroupClauseRaw; }; type QueryRaw = QueryMain & QueryOptionsRaw; type ModelQueryRaw = QueryMain; type PageableModelQueryRaw = ModelQueryRaw & QueryOptionsRaw; /** * Type of a full query */ export type Query = QueryRaw>; /** * Query with support for pagination (limit, offset) */ export type PageableModelQuery = PageableModelQueryRaw>; /** * Standard query options (limit, offset) */ export type QueryOptions = QueryOptionsRaw>; /** * Select clause */ export type SelectClause = SelectClauseRaw>; /** * Sort clause */ export type SortClause = SortClauseRaw>; /** * Group clause */ export type GroupClause = GroupClauseRaw>; /** * Model query, requiring a model object */ export type ModelQuery = ModelQueryRaw>;