import { type SnapshotWriteOptions } from "@mailwoman/core/fs/snapshot"; import { PathBuilder } from "path-ts"; import type { FetchSourceID } from "#tools/fetch"; import type { BaseFetchOptions, FetchSummary } from "#tools/fetch/download"; /** * The two storage classes a downloaded source can take. */ export declare const StorageClass: { /** * Mutable, and brought up to date by fetching again. */ readonly current: "current"; /** * A dated vintage, read-only once written. */ readonly snapshot: "snapshot"; }; export type StorageClass = (typeof StorageClass)[keyof typeof StorageClass]; /** * A source directory whose fetch writes both classes: a current download and the snapshot made from it. * Each field describes the files of that class. */ export interface MixedStorage { readonly current: string; readonly snapshot: string; } /** * The storage class of each corpus source directory, keyed by the directory's slug. * * Every directory a fetch source writes appears here, along with the snapshot sources that have no fetcher. * `cn-units` is absent: it holds recipe splits, a built artifact that stays under the data root. * * Geofabrik extracts are absent too: they're a snapshot source, but `corpus fetch` doesn't reach them. * `packages/osm/tools/fetch/extract.ts` writes them, one series of vintages per region, under * `snapshots/geofabrik//`, so they have no single source directory for this table to key. */ export declare const SOURCE_STORAGE_CLASSES: { readonly "acra-sg": "current"; readonly ads: "current"; readonly ban: "current"; readonly "bd-adresses": "current"; readonly brussels: "current"; readonly cordis: "current"; readonly "cz-cuzk": "current"; readonly "dk-inspire": "current"; readonly emuia: "current"; readonly "es-bizkaia": "current"; readonly "es-catastro": "current"; readonly "es-gipuzkoa": "current"; readonly "es-navarra": "current"; readonly "fr-annuaire-education-overseas": "current"; readonly "fr-finess-overseas": "snapshot"; readonly "fr-laposte-poincont": "current"; readonly "gb-os-open": "current"; readonly "gcis-tw": "current"; readonly "geonames-dump": "current"; readonly "geonames-hierarchy": "current"; readonly "geonames-postal": "current"; readonly gleif: "current"; readonly "houjin-jp": "snapshot"; readonly "it-anac": "current"; readonly "juso-kr": "snapshot"; readonly "localdata-kr": "current"; readonly "lv-varis": "current"; readonly matrikkelen: "current"; readonly "nc-opt-agences": "current"; readonly "nl-kadaster": "current"; readonly "nga-wpi": "current"; readonly openaddresses: "current"; readonly ourairports: "current"; readonly "overture-places-in": "snapshot"; readonly "ro-retea-scolara": "current"; readonly ryhti: "current"; readonly "sk-inspire": "current"; readonly "state-de-notaries": "current"; readonly "state-hi-lobbyists": "current"; readonly "state-hi-schools": "current"; readonly "state-ia-contractors": "current"; readonly "state-ny-notaries": "current"; readonly "state-or-notaries": "current"; readonly "state-tx-notaries": "current"; readonly "state-wa-health-providers": "current"; readonly tiger: "snapshot"; readonly "tw-chunghwa-post-offices": "current"; readonly "usgov-hrsa-fqhc": "current"; readonly "usgov-usgs-gnis": "current"; readonly "usgov-usgs-structures": "current"; readonly "usgov-imls-pls": "snapshot"; readonly "usgov-nad": { readonly current: "bulk/nad.zip, the release archive DOT serves at an undated link"; readonly snapshot: "/TXT_NAD_.parquet, converted from the archive's text member"; }; readonly "usgov-nppes": "snapshot"; readonly vlaanderen: "current"; readonly wallonie: "current"; readonly "wikidata-subvenue": "current"; readonly "wikidata-vital-places": "current"; readonly "adressur-fo": "snapshot"; readonly "bsp-gu": "snapshot"; readonly "gb-companies-house": "snapshot"; readonly "gbpa-bs": "snapshot"; readonly "ide-uy": "snapshot"; readonly "landregistry-im": "snapshot"; readonly "llv-li": "snapshot"; readonly "opendata-az": "snapshot"; }; /** * A source directory slug in {@link SOURCE_STORAGE_CLASSES}. */ export type SourceSlug = keyof typeof SOURCE_STORAGE_CLASSES; /** * The vintage of each snapshot source that has no fetcher: the retrieval date * that `data/corpus-source-inputs.json` records in its `reads` text, or, * where it records none, the date in the file's name. */ export declare const UNFETCHED_SNAPSHOT_VINTAGES: { readonly "adressur-fo": "2026-10-18"; readonly "bsp-gu": "2026-10-18"; readonly "gb-companies-house": "2026-10-01"; readonly "gbpa-bs": "2026-10-18"; readonly "ide-uy": "2026-10-17"; readonly "landregistry-im": "2025-02-23"; readonly "llv-li": "2026-10-18"; readonly "opendata-az": "2026-10-18"; }; /** * The source directories each `mailwoman corpus fetch` source writes. * * The mapped type makes the compiler refuse a fetch source with no entry here. */ export declare const FETCH_SOURCE_DIRECTORIES: { readonly "acra-sg": readonly ["acra-sg"]; readonly "ads-ee": readonly ["ads"]; readonly ban: readonly ["ban"]; readonly "bd-adresses": readonly ["bd-adresses"]; readonly brussels: readonly ["brussels"]; readonly cordis: readonly ["cordis"]; readonly "cz-cuzk": readonly ["cz-cuzk"]; readonly "dk-inspire": readonly ["dk-inspire"]; readonly "emuia-pl": readonly ["emuia"]; readonly "es-bizkaia": readonly ["es-bizkaia"]; readonly "es-catastro": readonly ["es-catastro"]; readonly "es-gipuzkoa": readonly ["es-gipuzkoa"]; readonly "es-navarra": readonly ["es-navarra"]; readonly "fr-annuaire-education-overseas": readonly ["fr-annuaire-education-overseas"]; readonly "fr-finess-overseas": readonly ["fr-finess-overseas"]; readonly "fr-laposte-poincont": readonly ["fr-laposte-poincont"]; readonly "gb-os-open": readonly ["gb-os-open"]; readonly "gcis-tw": readonly ["gcis-tw"]; readonly "geonames-dump": readonly ["geonames-dump"]; readonly "geonames-hierarchy": readonly ["geonames-hierarchy"]; readonly "geonames-postal": readonly ["geonames-postal"]; readonly gleif: readonly ["gleif"]; readonly hrsa: readonly ["usgov-hrsa-fqhc"]; readonly "houjin-jp": readonly ["houjin-jp"]; readonly "imls-pls": readonly ["usgov-imls-pls"]; readonly "it-anac": readonly ["it-anac"]; readonly "juso-kr": readonly ["juso-kr"]; readonly "localdata-kr": readonly ["localdata-kr"]; readonly "lv-varis": readonly ["lv-varis"]; readonly matrikkelen: readonly ["matrikkelen"]; readonly nad: readonly ["usgov-nad"]; readonly "nc-opt-agences": readonly ["nc-opt-agences"]; readonly "nl-kadaster": readonly ["nl-kadaster"]; readonly "nga-wpi": readonly ["nga-wpi"]; readonly nppes: readonly ["usgov-nppes"]; readonly openaddresses: readonly ["openaddresses"]; readonly ourairports: readonly ["ourairports"]; readonly "overture-places-in": readonly ["overture-places-in"]; readonly "ro-retea-scolara": readonly ["ro-retea-scolara"]; readonly ryhti: readonly ["ryhti"]; readonly "sk-inspire": readonly ["sk-inspire"]; readonly "state-hi-schools": readonly ["state-hi-schools"]; readonly "state-sources": readonly ["state-de-notaries", "state-hi-lobbyists", "state-ia-contractors", "state-ny-notaries", "state-or-notaries", "state-tx-notaries", "state-wa-health-providers"]; readonly "tiger-full": readonly ["tiger"]; readonly "tw-chunghwa-post-offices": readonly ["tw-chunghwa-post-offices"]; readonly "usgs-gnis": readonly ["usgov-usgs-gnis"]; readonly "usgs-structures": readonly ["usgov-usgs-structures"]; readonly vlaanderen: readonly ["vlaanderen"]; readonly wallonie: readonly ["wallonie"]; readonly "wikidata-subvenue": readonly ["wikidata-subvenue"]; readonly "wikidata-vital-places": readonly ["wikidata-vital-places"]; }; /** * Whether any directory `source` writes holds a snapshot, as a snapshot source * or beside a current download. */ export declare function writesSnapshot(source: FetchSourceID): boolean; /** * Where a snapshot fetch writes, and how it may treat a vintage already on disk. */ export interface SnapshotDestination { /** * The root every snapshot source sits under, so one vintage is `root(, )`. * * @defaultValue `snapshotSourcesRoot()`, `$MAILWOMAN_DATA_ROOT/snapshots/` */ root: PathBuilder; /** * The vintage the caller stated with `--vintage`, or `null` when the fetcher resolves it. */ vintage: string | null; /** * Whether the caller passed `--force`. * It replaces a vintage only together with a stated one. */ force: boolean; } /** * The option base of a fetcher whose source is a snapshot. */ export interface SnapshotFetchOptions extends Omit { snapshots: SnapshotDestination; } /** * The roots one `mailwoman corpus fetch` run writes under. */ export interface FetchDestinations { /** * The root each current source writes `//` under. */ outRoot: PathBuilder; snapshots: SnapshotDestination; } /** * The `mailwoman corpus fetch` options that decide where a source is written. */ export interface FetchDestinationOptions { /** * `--out-root`: one root for both classes, so a current source writes `//` * and a snapshot writes `///`. */ outRoot?: string | null; /** * `--vintage` */ vintage?: string | null; /** * `--force` */ force?: boolean; } /** * Resolve the command's options for `source` into the roots its fetcher writes under. * * @throws When `--vintage` or `--force` is given for a source that writes no snapshot, * or when `--vintage` isn't one path segment a vintage can take. */ export declare function resolveFetchDestinations(source: FetchSourceID, options: FetchDestinationOptions): FetchDestinations; /** * The directory of one vintage of `slug` under `destination`. * * @param resolved The vintage the fetcher found at the publisher, such as the date in a file's name. * @throws When the caller stated another vintage than the one the publisher serves, * because writing one month's file under another month's name would misdate it. */ export declare function snapshotVintagePath(destination: SnapshotDestination, slug: SourceSlug, resolved: string): PathBuilder; /** * The options `writeSnapshot` takes for a write to `destination`. */ export declare function snapshotWriteOptions(destination: SnapshotDestination): SnapshotWriteOptions; /** * Write vintage `vintage` of `slug` through `fill`, which fetches into the directory it is given. * * The fetched directory moves into the vintage only once `fill` finishes with no failure. * A fetch that reports a failure leaves any existing vintage as it was, writes no partial * vintage, and its summary is returned so the command exits non-zero. * * @throws {SnapshotExistsError} When the vintage exists and the caller didn't * both state it and pass `--force`. */ export declare function fetchSnapshot(destination: SnapshotDestination, slug: SourceSlug, vintage: string, fill: (directory: PathBuilder) => Promise, report?: (line: string) => void): Promise; //# sourceMappingURL=storage.d.ts.map