import type { Entity } from '../Entity'; import type { ExcludeFunctions, OmitEntityCollections, OmitFunctions } from '../types'; export type SortString = `${string & keyof OmitFunctions>} ASC` | `${string & keyof OmitFunctions>} asc` | `${string & keyof OmitFunctions>} DESC` | `${string & keyof OmitFunctions>} desc` | `${string & keyof OmitFunctions>}`; type ValidateMultipleSorts = TNextSortPart extends `, ${SortString}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts : `${TPreviouslyValidatedSortString}, ${SortString}`; export type MultipleSortString = TSortString extends `${SortString}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts : SortString; export type SortObjectValue = -1 | 'asc' | 'desc' | 1; export type SortObject = { [K in keyof T as ExcludeFunctions, K>]?: SortObjectValue; }; export type Sort = MultipleSortString | SortObject; export interface OrderBy { propertyName: string & keyof OmitFunctions>; descending?: boolean; } export {};