import { type PackedCatalogue } from "../catalogue/pack.ts"; import type { ElementRecordSource } from "./elements.ts"; import type { SourceInfo } from "../data-door.ts"; /** * What `packedElementsFrom` can be told. Every one has a safe default. * * @example * ```ts * import type { PackedElementsOptions } from "@johnmorrisdotca/chikyu-earth/door"; * * const options: PackedElementsOptions = { maxBytes: 30_000_000 }; * console.log(options.maxBytes); * ``` */ export interface PackedElementsOptions { /** The most bytes of answer read (64 MB by default, the most a packed file may unpack to). */ maxBytes?: number; /** The fetch function (the browser's by default). */ fetch?: typeof fetch; } /** * A source of element sets read from a packed catalogue file (`packCatalogue`, gzipped or not) at an address you choose: up to 200,000 objects, six-digit catalogue numbers included. The file is asked for once, when the source is added, * and nowhere else: no cookies and no referrer are sent, only `https` (or `http` on `localhost`) is used, a redirect or any answer but 200 is a failed read, and an answer over `maxBytes` is refused. Nothing is kept between page loads and * nothing is asked on a timer. The package has no address of its own; a site that hosts these files says whose data they are in `info`. * * @param url - The address of a packed file. * @param info - Who the data is: its id, credit, licence and page. * @param options - See `PackedElementsOptions`. * @returns The source, for `addSource` or `sources`. * * @example * ```ts no-run * import { packedElementsFrom } from "@johnmorrisdotca/chikyu-earth/door"; * * const debris = packedElementsFrom("https://example.org/catalogue/debris.pack.gz", { * id: "catalogue-debris", * name: { en: "Debris in Earth orbit", ja: "地球周回軌道のデブリ" }, * credit: { en: "Data from Space-Track.org (USSPACECOM)", ja: "データ:Space-Track.org(USSPACECOM)" }, * licence: { name: "Space-Track basic SSA data, with citation", url: "https://www.space-track.org/documentation" }, * url: "https://www.space-track.org", * retrieved: "2026-11-11", * }); * console.log(debris.info.id); * ``` */ export declare function packedElementsFrom(url: string, info: SourceInfo, options?: PackedElementsOptions): ElementRecordSource; /** * Ask an address for a packed catalogue file once and read it. This is what `packedElementsFrom` does; use it when a page wants the whole record (kind, owner, launch) and not just the element sets. * * @param url - The address of a packed file. * @param options - See `PackedElementsOptions`, and a signal that stops the read. * @returns The file, by column. * * @example * ```ts no-run * import { readPackedFrom } from "@johnmorrisdotca/chikyu-earth/door"; * * const file = await readPackedFrom("https://example.org/catalogue/rocket-bodies.pack.gz"); * console.log(file.count, file.meta["retrieved"], file.kindAt(0)); * ``` */ export declare function readPackedFrom(url: string, options?: PackedElementsOptions & { signal?: AbortSignal; }): Promise;