import { ListItem } from './data.types'; import { Projection, SortingProjection } from './projection.types'; export type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace'; export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "gte", "lt", "lte", "typeof", "isTruthy", "size"]; export type DcuplQueryOperator = (typeof DcuplQueryOperatorsAsArray)[number]; export type DcuplQueryType = 'and' | 'or'; type DcuplQueryBase = { attribute: string; queryKey?: any; options?: { transform?: DcuplQueryTransformOptions[]; invert?: boolean; arrayValueHandling?: 'some' | 'every'; }; }; type DcuplQueryEq = DcuplQueryBase & { operator: 'eq'; /** * You may search for any value but * only values of type string and { key:string } may be used for indexed search */ value: any; }; type DcuplQueryFind = DcuplQueryBase & { operator: 'find'; value: Record | string; }; type DcuplQueryNumbers = DcuplQueryBase & { operator: 'gt' | 'lt' | 'gte' | 'lte'; value: string | number | Date; }; type DcuplQueryTypeOf = DcuplQueryBase & { operator: 'typeof'; value: string; }; type DcuplQueryIsTruthy = DcuplQueryBase & { operator: 'isTruthy'; value: boolean; }; type DcuplQuerySize = DcuplQueryBase & { operator: 'size'; value: number; }; export type DcuplQuery = DcuplQueryEq | DcuplQueryNumbers | DcuplQueryTypeOf | DcuplQueryIsTruthy | DcuplQuerySize | DcuplQueryFind; export type DcuplQueryGroup = { groupType?: DcuplQueryType; groupKey?: string; queries: Array; }; type DcuplItemOptions = { start?: number; count?: number; projection?: Projection; sort?: SortingProjection; }; export type DcuplGlobalQueryOptions = { modelKey: string; } & DcuplItemOptions & DcuplQueryGroup; export type DcuplGlobalItemOptions = { modelKey: string; itemKey: string; projection?: Projection; }; export type DcuplGlobalManyItemOptions = { modelKey: string; itemKeys: string[]; projection?: Projection; }; export type DcuplListQueryOptions = DcuplItemOptions & DcuplQueryGroup; export type DcuplListItemOptions = DcuplItemOptions & { itemKey: string; }; export type CustomOperatorFn = (query: DcuplQuery, listItem: ListItem) => boolean; export type CustomOperatorFnMap = Map; export type DcuplQueryStatement = DcuplItemOptions & { modelKey: string; groupType?: DcuplQueryType; queries: DcuplQuery[] | DcuplQueryGroup[] | DcuplQueryGroup>[]; }; export {};