import type { ValueOrPromise } from '@venizia/ignis-helpers/common'; /** * A figure a list route offers beside its rows: * - a function runs when the client names it; * - `{ isDefault: true, compute }` always runs, unless the client switches it off with `-name`; * - `{ keys, compute }` is a group - the client names the keys it wants (`facets(status,tag)`), and * `compute` receives exactly those, so one aggregate pass serves them all. */ export type TResponseExtra = (() => ValueOrPromise) | { isDefault: boolean; compute: () => ValueOrPromise; keys?: never; } | { keys: ReadonlyArray; compute: (opts: { keys: Array; }) => ValueOrPromise; isDefault?: never; }; /** One entry of `x-request-extra`: `name`, `-name` (a default switched off), `-*` (every default off) or `name(key,key)`. */ export interface IRequestedExtra { name: string; isExcluded: boolean; keys?: Array; } /** Parses `x-request-extra` and resolves it against what a route offers. */ export declare class ResponseExtras { /** The entries of the header, in the order written. Malformed input is a 400 naming it. */ static parse(opts: { header?: string | null; }): Array; /** * What to compute: the asked-for extras and the defaults, minus the ones switched off - each with the * keys asked for, de-duplicated in the order asked. Every name and key is checked against `offered`. */ static resolve(opts: { requested: Array; offered: Record; }): Map | undefined>; /** Runs the plan in parallel; each value under its name. */ static compute(opts: { plan: Map | undefined>; offered: Record; }): Promise>; /** Commas inside `( )` belong to the keys, not to the list of extras. */ private static splitTopLevel; private static badRequest; } //# sourceMappingURL=extras.d.ts.map