@adonis-agora/filter
Version:
Server-side query filtering/sorting/pagination for AdonisJS — Spatie-style input, a Lucid adapter, and field allow-listing. Part of the Agora ecosystem.
19 lines • 745 B
JavaScript
/**
* Where a filtered query remembers the pagination the request resolved to.
*
* The builder is handed back to the caller so the endpoint can keep composing on it; the page and
* size it already resolved ride along on this symbol, so a later `filterPaginate()` needs no
* arguments and no second read of the request.
*/
const PAGINATION = Symbol.for('@adonis-agora/filter:pagination');
export function stashPagination(query, pagination) {
if (query !== null && typeof query === 'object') {
query[PAGINATION] = pagination;
}
}
export function readPagination(query) {
if (query === null || typeof query !== 'object')
return undefined;
return query[PAGINATION];
}
//# sourceMappingURL=pagination_stash.js.map