UNPKG

pretur.clay

Version:
25 lines (24 loc) 1.58 kB
import { SpecType } from 'pretur.spec'; import { Reducible, Action, Dispatch } from 'reducible-node'; import { Query, SubQuery, Filter, Ordering } from 'pretur.sync'; export declare function getFilters(query: Query<any>, path?: string[]): Filter<any>; export declare function getInclude(query: Query<any>, path?: string[]): SubQuery<any> | undefined; export declare function setInclude<T extends SpecType, S extends SpecType = SpecType>(query: Query<T>, include: SubQuery<S>, path?: string[]): void; export declare class Querier<T extends SpecType> implements Reducible<Querier<T>> { readonly identifier: symbol; readonly count?: number; readonly scope: string; readonly model: T['name']; readonly query: Query<T>; constructor(scope: string, model: T['name'], query: Query<T>, count?: number, identifier?: symbol); reduce(action: Action<any>): this; setAttributes(dispatch: Dispatch, attributes?: (keyof T['fields'])[]): void; resetFilters(dispatch: Dispatch, filters?: Filter<T>, path?: string[]): void; setFilter(dispatch: Dispatch, field: keyof T['fields'], filter: any, path?: string[]): void; clearFilter(dispatch: Dispatch, field: keyof T['fields'], path?: string[]): void; setPagination(dispatch: Dispatch, skip?: number, take?: number): void; setOrder(dispatch: Dispatch, field: string, ordering?: Ordering, chain?: string[]): void; setExtra(dispatch: Dispatch, extra?: any, resetPagination?: boolean): void; setCount(dispatch: Dispatch, count?: number): void; reset(dispatch: Dispatch, query: Query<T>): void; }