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.

25 lines 1.06 kB
/** * Pure, ORM-agnostic parser for to-many aggregate field paths — a verbatim port * of the NestJS `nestjs-filter` `aggregate/aggregate-path.ts` (commit 3f21e1f). * It only parses the client-facing field *string* into a structured * {@link AggregatePath}; turning that into SQL (a correlated subquery) is the * Lucid-specific compiler's job (see `filter_spec.ts` aggregate discovery). */ export type AggregateFn = 'count' | 'sum' | 'avg' | 'min' | 'max'; export interface AggregatePath { relation: string; fn: AggregateFn; column?: string; } /** * Parses a to-many aggregate field path. * * Grammar (single relation hop only): * - `<relation>.$count` → { relation, fn: 'count' } * - `<relation>.$<fn>.<childColumn>` → { relation, fn, column } for fn in sum|avg|min|max * * Returns `null` for anything else so callers can fall through to * non-aggregate field handling instead of throwing. */ export declare function parseAggregatePath(path: string): AggregatePath | null; //# sourceMappingURL=aggregate_path.d.ts.map