UNPKG

@ahoo-wang/fetcher-wow

Version:

Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher

93 lines 4.24 kB
import { ConditionCapable } from './condition'; import { SortCapable } from './sort'; import { Pagination } from './pagination'; import { ProjectionCapable } from './projection'; /** * Interface for queryable objects that support conditions, projection, and sorting. */ export interface Queryable<FIELDS extends string = string> extends ConditionCapable<FIELDS>, ProjectionCapable<FIELDS>, SortCapable<FIELDS> { } /** * Interface for single query objects. */ export interface SingleQuery<FIELDS extends string = string> extends Queryable<FIELDS> { } /** * Creates a SingleQuery object with the provided parameters. * * This function is a factory for creating SingleQuery objects, which represent * queries that return a single result. It provides default values for optional * properties while allowing customization of condition, projection, and sort criteria. * * @param condition - The query condition. Defaults to an 'all' condition that matches everything. * @param projection - The field projection specification. Optional. * @param sort - The sort criteria. Optional. * @returns A SingleQuery object with the specified parameters */ export declare function singleQuery<FIELDS extends string = string>({ condition, projection, sort, }?: Partial<SingleQuery<FIELDS>>): SingleQuery<FIELDS>; /** * Interface for list query objects. * * Limit the number of results. Default: DEFAULT_PAGINATION.size */ export interface ListQuery<FIELDS extends string = string> extends Queryable<FIELDS> { limit?: number; } /** * Creates a ListQuery object with the provided parameters. * * This function is a factory for creating ListQuery objects, which represent * queries that return a list of results. It provides default values for optional * properties while allowing customization of condition, projection, sort criteria, * and result limit. * * @param condition - The query condition. Defaults to an 'all' condition that matches everything. * @param projection - The field projection specification. Optional. * @param sort - The sort criteria. Optional. * @param limit - The maximum number of results to return. Defaults to DEFAULT_PAGINATION.size. * @returns A ListQuery object with the specified parameters */ export declare function listQuery<FIELDS extends string = string>({ condition, projection, sort, limit, }?: Partial<ListQuery<FIELDS>>): ListQuery<FIELDS>; /** * Interface for paged query objects. */ export interface PagedQuery<FIELDS extends string = string> extends Queryable<FIELDS> { pagination?: Pagination; } /** * Creates a PagedQuery object with the provided parameters. * * This function is a factory for creating PagedQuery objects, which represent * queries that return a paged list of results. It provides default values for optional * properties while allowing customization of condition, projection, sort criteria, * and pagination. * * @param condition - The query condition. Defaults to an 'all' condition that matches everything. * @param projection - The field projection specification. Optional. * @param sort - The sort criteria. Optional. * @param pagination - The pagination specification. Optional. * * @returns A PagedQuery object with the specified parameters */ export declare function pagedQuery<FIELDS extends string = string>({ condition, projection, sort, pagination, }?: Partial<PagedQuery<FIELDS>>): PagedQuery<FIELDS>; /** * Interface for paged list results. */ export interface PagedList<T> { total: number; list: T[]; } export declare const EMPTY_PAGED_LIST: PagedList<any>; /** * Creates a PagedList object with the provided parameters. * * This function is a factory for creating PagedList objects, which represent * a page of results with total count information. It provides default values * for optional properties while allowing customization of total count and list data. * * @param total - The total number of items. Defaults to 0. * @param list - The array of items in the current page. Defaults to an empty array. * @returns A PagedList object with the specified parameters */ export declare function pagedList<T>({ total, list, }?: Partial<PagedList<T>>): PagedList<T>; //# sourceMappingURL=queryable.d.ts.map