import { MetaType } from '../metaTypeCreator'; import { WhereFilterOp } from '../alias'; import { QueryConstraints, WhereConstraint, OrderByConstraint, CursorConstraint, LimitConstraint, QueryAllConstraints, QueryFilterConstraints, CursorType, QueryCompositeFilterConstraint } from '../queryConstraints'; import { GeneralQuery } from '../refs'; import { LimitToLastConstraintLimitation } from './limit'; import { CursorConstraintLimitation } from './cursor'; import { GetFirstOrderBy } from './orderBy'; import { GetFirstInequalityWhere, WhereConstraintLimitation, ValidateWhereArrayContainsArrayContainsAny } from './where'; import { InequalityOpStr } from './utils'; import { IsSame } from '../utils'; import { ErrorWhereOrderByAndInEquality } from '../error'; import { FlattenQueryCompositeFilterConstraint, QueryFilterConstraintLimitation } from './composite'; export type ValidateOrderByAndInequalityWhere = GetFirstInequalityWhere extends infer W extends WhereConstraint ? GetFirstOrderBy extends infer O ? O extends OrderByConstraint ? IsSame extends true ? true : ErrorWhereOrderByAndInEquality : true : true : true; export type QueryConstraintLimitation, RestQQCs extends readonly QueryAllConstraints[], PreviousQCs extends readonly QueryConstraints[], AllQCs extends readonly QueryConstraints[]> = RestQQCs extends [ infer Head extends QueryAllConstraints, ...infer Rest extends QueryAllConstraints[] ] ? [ Head extends LimitConstraint<'limit', number> | OrderByConstraint ? Head : Head extends LimitConstraint<'limitToLast', number> ? LimitToLastConstraintLimitation : Head extends WhereConstraint ? ValidateWhereArrayContainsArrayContainsAny extends infer J extends string ? J : WhereConstraintLimitation : Head extends CursorConstraint ? CursorConstraintLimitation : Head extends QueryCompositeFilterConstraint<'and' | 'or', QueryFilterConstraints[]> ? QueryFilterConstraintLimitation extends [infer P] ? P : never : never, ...QueryConstraintLimitation ], AllQCs> ] : RestQQCs;