/** * Downloads the three OS OpenData products the `gb-os-open` adapter joins, from the OS Downloads API. * * The API serves OpenData without a key. * `GET /products//downloads` lists one archive per format and area with its * OS-published MD5, and each archive is checked against that MD5 after transfer. * * A present archive whose MD5 already matches is kept rather than downloaded again. * * Each archive is unpacked into the subdirectory the adapter reads, `code-point-open/`, * `open-names/` or `open-roads/`, so the fetch root is the adapter's `inputPath`. * The archive stays beside its members, because its digest is the value the * address-source register records. */ import { APIClient } from "@mailwoman/core/api"; import { type OSDownload } from "@mailwoman/spatial/gb/os-downloads"; import { type PathBuilderLike } from "path-ts"; import type { BaseFetchOptions, FetchSummary, SourceManifest } from "#tools/fetch/download"; /** * The license all three products are published under. */ export declare const GB_OS_OPEN_LICENSE_NAME = "Open Government Licence v3.0"; /** * The attribution OGL v3 requires, in the wording OS asks for on Code-Point Open. * That product also includes Royal Mail and ONS data. */ export declare const GB_OS_OPEN_ATTRIBUTION = "Contains OS data \u00A9 Crown copyright and database right. Contains Royal Mail data \u00A9 Royal Mail copyright and database right. Contains National Statistics data \u00A9 Crown copyright and database right."; /** * One product the adapter reads: its OS Downloads API id, the archive format, * and the subdirectory it unpacks into. */ export interface OSOpenProduct { productID: string; format: string; directory: string; } /** * The three products, in the order they're fetched. */ export declare const GB_OS_OPEN_PRODUCTS: readonly OSOpenProduct[]; /** * The manifest entry for one product's archive. */ export interface OSOpenFileManifest extends SourceManifest { product_id: string; format: string; md5: string; members: number; } /** * The archive of `product` among the listed downloads, the Great Britain one where an area is stated. * * @throws Naming the formats offered, when none matches. */ export declare function selectOSDownload(product: OSOpenProduct, downloads: readonly OSDownload[]): OSDownload; /** * The archives the OS Downloads API lists for one product. */ export declare function readOSDownloads(client: Pick, product: OSOpenProduct, options?: { signal?: AbortSignal; }): Promise; /** * Downloads and unpacks one product. */ export declare function downloadOSOpenProduct(client: Pick, product: OSOpenProduct, options: { outputDir: PathBuilderLike; force?: boolean; retries?: number; retryDelayMs?: number; signal?: AbortSignal; report?: (line: string) => void; }): Promise<{ entry: OSOpenFileManifest; downloaded: boolean; }>; /** * Per-invocation options for the registry entry. */ export interface FetchGBOSOpenOptions extends BaseFetchOptions { force?: boolean; retries?: number; signal?: AbortSignal; } /** * The registry entry: fetches all three products and writes `MANIFEST.json` at the adapter's input root. * * A product that fails is counted and the others are still taken. */ export declare function fetchGBOSOpen(options: FetchGBOSOpenOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=os-open.d.ts.map