import type { EponymeSchema } from '../types/index.js'; import type { EponymeRelationTarget } from '../types/relations.js'; export { EPONYME_DEFAULT_POPULATE_DEPTH, EPONYME_MAX_POPULATE_DEPTH } from './populate-depth.js'; /** What the population walk needs from the store, so it never touches the database itself. */ export interface EponymePopulateLoader { /** Schema of a target, to walk its own relations one level further. */ schemaOf: (name: string) => EponymeSchema | undefined; /** * Loads every name it can, in as few queries as it likes, and leaves out what the reader may not see: a * missing, trashed, unpublished or forbidden target is simply absent from the map. */ load: (names: string[]) => Promise>; } export interface EponymePopulateResult { data: Record[]; /** Every target that was resolved, at any level, so a response can carry their cache tags. */ targets: Set; } /** * Reads a depth the caller asked for. A depth above the ceiling is refused rather than clamped: the read's * type promises that many levels, and a silent clamp would hand back slugs where objects were promised. */ export declare function readEponymePopulateDepth(raw: unknown, maxDepth: number): number | { error: string; }; /** * Replaces each relation of `items` by its target, `depth` levels deep. * * Level by level rather than entry by entry: every reference of one level is loaded in one batch, so a * listing of a hundred entries pointing at a hundred authors costs one query per level, not a hundred. The * depth bounds the walk, which is what makes a cycle safe: `a -> b -> a` is expanded until the depth runs * out, and each name is loaded once whatever the number of times it appears. */ export declare function populateEponymeData(items: Array<{ schema: EponymeSchema; data: Record; }>, depth: number, loader: EponymePopulateLoader): Promise; type Lookup = (entryName: string) => unknown; /** A copy of `data` with every relation value swapped for what `lookup` answers. */ export declare function replaceEponymeRelations(schema: EponymeSchema, data: Record, lookup: Lookup): Record;