/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Fetch an OpenAddresses country collection from batch.openaddresses.io. * * Source: https://batch.openaddresses.io * License: MIXED — OpenAddresses aggregates hundreds of upstream sources with per-source licenses * (CC-BY, CC0, PDDL, ODbL, CC-BY-SA, and proprietary attribution-only). The per-row LICENSE filter * in the openaddresses adapter is essential for proprietary-weights training: Tier-C rows (ODbL, * CC-BY-SA, CC-SA) are dropped at ingest by default. This module downloads the raw collection; the * adapter does the license gating. * * Native `fetch` streams the download to disk (no curl + Python subprocess tax); * `node:child_process` keeps the genuine shell ops it still needs (`file` magic detection + * `gunzip` decompression, both nice/ionice-deprioritized). * * ## Authentication note (2026-05-18) * * The batch.openaddresses.io download endpoint now requires a registered account. Downloads are * still free at the "basic" tier (GeoJSON+LD output). * * 1. Register at https://batch.openaddresses.io/register * 2. Log in and go to Profile → "Create Token" * 3. Export the token: `export OA_BATCH_TOKEN=` * 4. Re-run the command. * * The collection URL pattern (verified 2026-05-18): * * - `POST /api/login {username, password}` → `{token}` * - `GET /api/job/{job_id}/output/source.geojson.gz?token={token}` * * Collections are downloaded as a combined GeoJSON.gz via: * * - `GET /api/collections/{collection_id}/download` (returns a redirect to S3) * * Collection IDs discovered from `/api/collections`: * * - `id=6 name="ca" size=2044467556` (~1.9 GiB uncompressed, verified 2026-05-18) * * ## Usage * * ```sh * # With token (preferred). Default country: ca. Supports any OA country code (us-west, fr, …) * OA_BATCH_TOKEN= mailwoman corpus fetch openaddresses --country ca \ * --out-root $MAILWOMAN_DATA_ROOT/corpus/sources * * # Without token (will detect + print instructions, then report the failure): * mailwoman corpus fetch openaddresses --country ca * ``` */ import type { BaseFetchOptions, FetchSummary } from "./download.ts"; export interface FetchOpenAddressesOptions extends BaseFetchOptions { /** * OA country collection code. Default `ca`. */ country?: string; } export declare function fetchOpenAddresses(options: FetchOpenAddressesOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=openaddresses.d.ts.map