@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.
18 lines • 1.04 kB
TypeScript
import { type ColumnFilter } from './operators.js';
/**
* True when `value` is a non-empty plain object whose keys are ALL filter operators — i.e. an
* operator map like `{ gt: 5, lt: 10 }` rather than a scalar equality value. Arrays and `null` are
* not operator objects. Single source of the shape classifier every adapter's auto-field path uses.
*/
export declare function isOperatorObject(value: unknown): value is Record<string, unknown>;
/**
* Normalize a raw auto-field value to canonical {@link ColumnFilter}[]:
* - an array → a single `in` filter,
* - an {@link isOperatorObject operator object} → one filter per operator,
* - any other (scalar) value → a single `equals` filter.
*
* Lets an adapter's auto-field/relation/computed surfaces drive the same `ColumnFilter` path the
* structured-filter input already uses, instead of re-implementing the scalar/array/object ladder.
*/
export declare function valueToColumnFilters(field: string, value: unknown): ColumnFilter[];
//# sourceMappingURL=value-shape.d.ts.map