/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Downloads the State Address Register's open data (`Valsts adrešu reģistra atvērtie dati`) for the * `lv-varis` adapter. * * Valsts zemes dienests republishes every table of the dataset `varis-atvertie-dati` on data.gov.lv, * and a republish can move a resource's URL. The fetcher therefore asks the portal's CKAN API for the * dataset's resources and picks each table by the file name its URL ends in, rather than holding URLs * that the next republish may retire. The manifest records, per file, the resource URL, the CKAN * `last_modified`, the byte count and the SHA-256, and once for the dataset the license id the portal * states, so a corpus row traces to one publication. */ import { APIClient } from "@mailwoman/core/api"; import { type PathBuilderLike } from "path-ts"; import { type VarisTable } from "#lv/adapters/varis/adapter"; import type { CKANResource } from "#ro/tools/fetch/retea-scolara"; import type { BaseFetchOptions, FetchSummary, SourceManifest } from "#tools/fetch/download"; /** * The data.gov.lv dataset that holds the register's tables. */ export declare const LV_VARIS_DATASET_ID = "varis-atvertie-dati"; /** * The CKAN call that lists the dataset's resources and its license. */ export declare const LV_VARIS_PACKAGE_URL = "https://data.gov.lv/dati/api/3/action/package_show?id=varis-atvertie-dati"; /** * One downloaded table, as the manifest records it. */ export interface VarisFileManifest extends SourceManifest { resource_name: string | null; last_modified: string | null; } /** * The manifest written beside the tables. */ export interface VarisManifest { source: string; dataset_url: string; publisher: string | null; license_id: string | null; license_title: string | null; files: VarisFileManifest[]; } /** * The resource whose URL path ends in `/`. * * The dataset also lists each table's `_his` history file and a `_metadata.json` beside it, * so the match is on the whole final path segment rather than on a prefix. * * @throws When the dataset lists no resource for `filename`. */ export declare function resourceForFile(resources: readonly CKANResource[], filename: string): CKANResource; export interface DownloadVarisOptions { outputDir: PathBuilderLike; /** * The tables to download. * Defaults to every table the adapter reads. */ tables?: readonly VarisTable[]; force?: boolean; retries?: number; retryDelayMs?: number; signal?: AbortSignal; report?: (line: string) => void; } export declare function downloadVaris(client: Pick, options: DownloadVarisOptions): Promise; /** * The directory the adapter reads under a fetch root. */ export declare function varisInputPath(outRoot: BaseFetchOptions["outRoot"]): PathBuilderLike; export interface FetchVarisOptions extends BaseFetchOptions { force?: boolean; retries?: number; signal?: AbortSignal; } export declare function fetchVaris(options: FetchVarisOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=varis.d.ts.map