import express from 'express'; import { Sort } from 'mongodb'; import { Base } from './base'; export declare type TMatchOperator = '$and' | '$or'; export declare type TMatch = { [p in TMatchOperator]: object; }; export declare type TFilterOperator = 'less-than' | 'less-than-equal' | 'equal' | 'not-equal' | 'array-all' | 'array-some' | 'starts-with' | 'ends-with' | 'contains' | 'greater-than-equal' | 'greater-than'; export interface IFilter { field: string; operator: TFilterOperator; value: any; } export interface IQueryObject { [p: string]: Array; } export interface IRequestParams { path: object; query: object; } export interface IRequestParams { path: object; query: object; } export interface IQueryFind { [key: string]: object; } export declare type TQueryQueriesKey = 'search' | 'api' | 'permissions' | 'aggregate' | 'find'; export interface IQueryObjects { search?: IQueryObject; api?: IQueryObject; permissions?: IQueryObject; aggregate?: IQueryObject; find?: IQueryFind; } export interface IQuerySettings { type?: '$and' | '$or'; } export declare type TQueryMetaProperty = 'limit' | 'total' | 'next' | 'previous' | 'sort' | 'skip'; export declare type IQueryMeta = { [p in TQueryMetaProperty]?: any; }; export interface IKeys { allowed: string[]; } export interface IQuery { query?: any; queries?: IQueryObjects; setting?: IQuerySettings; params?: IRequestParams; projection?: object; sort?: Sort; limit?: number; skip?: number; total?: boolean; } export declare class Query extends Base implements IQuery { queries: IQueryObjects; query: any; settings: IQuerySettings; params: IRequestParams; limit: number; skip: number; sort: Sort; next: string | Record; previous: string | Record; total: boolean; projection?: object; static keys: IKeys; static collections: string[]; static limit: number; static LIMIT_MIN: number; static LIMIT_MAX: number; static sort: Sort; constructor(query?: IQuery); getMeta(value: IQuery): IQueryMeta; static getMetaValue(value: any, type?: string): any; static fromRequest(req: express.Request, validate?: boolean): Query; addToQuery(filters: any[] | object, collection: string, type?: TQueryQueriesKey): void; addToAllQueries(filters: any[] | object, type?: TQueryQueriesKey): void; }