import type { DatasetFreshnessResult, FreshnessConfig, FreshnessMessages, FreshnessRecord } from './types.js'; /** * Batch version of assessFreshness for a whole dataset of records that each * carry their own reviewed-on date — the generic form of "the oldest record * across N rows drives the page-level warning." One config is applied to * every record; the result rolls up to a single worst-case level a caller * can gate a build on, while still returning every per-record result so a * caller can instead (or also) flag individual rows. * * `oldest` is the record with the largest `ageDays`. Records that share the * same whole-day age are ordered by their exact review instant, earliest * first; if the instants are also equal, the first in input order wins. With * one shared config the level never decreases as age grows, so that record * always also has the worst level (a tie on `ageDays` has the same level, so * the tie-break never changes `level`). * * Each row is the caller's own extra fields plus `id`, `reviewedOn` and the * computed `result`. The computed fields always win: a caller field named * `result` is replaced, and a caller field named `level` is just passed * through as a caller extra; the computed level is only ever `row.result.level`. * * An empty `records` array returns `level: 'fresh'` and `oldest: undefined` * — there is nothing stale about a dataset with nothing in it. That is not * proof that the records you expected are present. * * Every input is read once, up front: `config`, `messages` and `now` once * each, and every slot of `records` in a single indexed pass. Each entry is * copied: its own enumerable properties (so extra fields survive) plus `id` and * `reviewedOn`, which are each read once with a normal property read, so a * class getter or an inherited field works. The copy is what is validated, * assessed and returned. Later changes to the caller's * objects, including from inside a message callback, cannot affect the result. * No message callback runs until every record has been checked, so a rejected * dataset produces no callbacks and no partial result. * * `records` must be a dense array of objects. A hole (a sparse slot), an * `undefined` entry, `null` or any non-object throws RangeError naming the * index; so does a non-array (including `null`/`undefined`). * * @throws {RangeError} for invalid thresholds or clock, a `records` value that * is not a dense array of objects, invalid date input in any record, or a * `messages` value that is not a plain object. Thresholds, clock and * `messages` are validated even for an empty array. * @throws {TypeError} when a `messages` entry is not a function, or a message * function returns something other than a string. */ export declare function checkDatasetFreshness(records: FreshnessRecord[], config: FreshnessConfig, messages?: FreshnessMessages, now?: Date): DatasetFreshnessResult;