/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * @file Reads and writes corpus-source manifests. */ import type { PathBuilderLike } from "path-ts"; import { type SourceManifest } from "#tools/fetch/download/network"; /** * Read a manifest.json; `null` when missing or corrupt (callers re-fetch from scratch). */ export declare function readManifest(path: PathBuilderLike): Promise; /** * Load manifest entries into a map so untouched keys survive a partial re-fetch. */ export declare function loadManifestEntries(path: PathBuilderLike, key: (entry: T) => string): Promise>; /** * Write a manifest.json in the house shape: pretty-printed, trailing newline. */ export declare function writeManifest(path: PathBuilderLike, manifest: unknown): Promise; /** * The sibling `manifest.json` shape for a source that is a collection of files behind one * portal (a monthly register published per region, per industry, or per first letter). * * It records what a trained artifact has to be able to cite later: the license the portal labels * the data with, the attribution wording it requires and one {@link SourceManifest} per file. */ export interface SourceCollectionManifest { source: string; source_url: string; license: string; attribution: string; downloaded_at: string; files: SourceManifest[]; } /** * Pipe a response body to `dest` and answer the byte count. * * The one primitive the portal fetchers share when the request is not a bare GET. * A session cookie, a csrf header, or a form post stands between the listing * and the file, so {@link streamDownload}'s URL-only interface does not fit * and each module builds its own `Response` first. * * Writes a `.tmp` sibling and renames, so an interrupted transfer never lands * at the final path looking complete. */ export declare function streamBodyToFile(res: Response, dest: PathBuilderLike): Promise; /** * The per-file entries of a {@link SourceCollectionManifest} keyed by file name, * or an empty map when the manifest is missing or not in the collection shape, * so a re-run after an interruption fetches only what is missing. * * The single-file modules' `loadManifestEntries` reads a bare array and is not this. */ export declare function loadCollectionFiles(path: PathBuilderLike): Promise>; //# sourceMappingURL=manifest.d.ts.map