UNPKG

@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.

21 lines 1.1 kB
import type { InputNormalizer } from './types.js'; export interface NormalizeOptions { /** Key transform — a built-in case mode or a custom mapping function. */ normalizer: InputNormalizer; /** Strip a trailing `Id`/`_id` (and drop a bare `id`) from each key. Default false. */ dropId?: boolean; /** Strip `null`/`undefined`/empty-string values. Default true. */ stripEmpty?: boolean; } /** * Normalize a decoded input object's top-level keys — case-transforming them via * the chosen {@link InputNormalizer}, optionally stripping `Id` suffixes and * empty values — into a null-prototype object. * * Prototype-pollution keys (`__proto__`, `constructor`, `prototype`, `toString`, * `valueOf`) are dropped both before and after normalization, and the result has * a null prototype, so a hostile key can never reach `Object.prototype`. Nested * values are left untouched — only top-level keys are normalized. */ export declare function normalizeInput(input: unknown, options: NormalizeOptions): Record<string, unknown>; //# sourceMappingURL=normalizer.d.ts.map