import { ExecFileOptions } from "node:child_process"; //#region src/operations.d.ts interface RuntimeOptions { cwd?: string; env?: Record; timeout?: number; maxBuffer?: number; wasmer?: string; } interface OperationLogs { stdout: string; stderr: string; } interface FileOperationResult extends OperationLogs { path: string; } interface ExpandOptions extends RuntimeOptions { verbose?: boolean; } type BoundingBox = [minLatitude: number, minLongitude: number, maxLatitude: number, maxLongitude: number]; type Disc = [centerLatitude: number, centerLongitude: number, radiusDegrees: number]; interface ExtractOptions extends RuntimeOptions { bbox?: BoundingBox | string; disc?: Disc | string; geojson?: string | Record; poly?: string; region?: string; expandLevel?: number; verbose?: boolean; noUserData?: boolean; jsonOutput?: boolean; } interface UpdateOptions extends RuntimeOptions { /** Commit by default. Set false to validate and roll back the update. */ commit?: boolean; verbose?: boolean; } interface UpdateResult extends FileOperationResult { committed: boolean; } type QuerySelection = "timestamp" | "seqnum" | { type: "node" | "way" | "relation"; id: number | string; }; type NodeQueryData = NodeData & { location: Location | null; }; type QueryResult = S extends undefined ? DatabaseInfo : S extends "timestamp" | "seqnum" ? string | null : S extends { type: "node"; } ? NodeQueryData | null : S extends { type: "way"; } ? WayData | null : S extends { type: "relation"; } ? RelationData | null : never; /** Convert an OSM XML/PBF file into an OSMX database. */ declare function expand(input: string, output: string, options?: ExpandOptions): Promise; /** Extract a geographic region from an OSMX database as OSM XML/PBF. */ declare function extract(database: string, output: string, options: ExtractOptions): Promise; /** Apply an OSM change file and replication metadata to an OSMX database. */ declare function update(database: string, changes: string, sequenceNumber: number | string, timestamp: string, options?: UpdateOptions): Promise; /** * Read structured database statistics, replication metadata, or an OSM object. * Querying is handled directly by the library reader and does not start Wasmer. */ declare function query(database: string, selection?: S): Promise>; //#endregion //#region src/lmdb.d.ts interface LmdbDatabase { flags: number; depth: number; entries: bigint; root: bigint; } //#endregion //#region src/index.d.ts /** * Compatibility path for the bundled OSMX executable module. * * This now points to the WASIX WebAssembly engine rather than a native binary. */ declare const binaryPath: string; /** * Compatibility wrapper for the former raw OSMX command API. * Commands now run through Wasmer with sandboxed host-directory mounts. */ declare function exec(args: string[], options?: ExecFileOptions & { wasmer?: string; }): Promise<{ stdout: string; stderr: string; }>; interface Location { lon: number; lat: number; version: number; } interface Metadata { version: number; timestamp: number | string; changeset: number; uid: number; user?: string; } interface NodeData { tags: Record; metadata?: Metadata; } interface NodeIterData extends NodeData { id: string; } interface WayData { nodes: string[]; tags: Record; metadata?: Metadata; } interface WayIterData extends WayData { id: string; } interface RelationMember { ref: string; type: "node" | "way" | "relation"; role?: string; } interface RelationData { tags: Record; members: RelationMember[]; metadata?: Metadata; } interface RelationIterData extends RelationData { id: string; } type Id = number | string | bigint; type IterationCallback = (value: T) => boolean | void; declare class Environment { readonly path: string; constructor(path: string); close(): void; } declare class Transaction { constructor(env: Environment); abort(): void; } declare class Table { readonly _txn: Transaction; readonly _decode: (value: Buffer) => T; readonly _db: LmdbDatabase; constructor(txn: Transaction, name: string, decode: (value: Buffer) => T); get(id: Id): T | null; exists(id: Id): boolean; iterate(callback: IterationCallback): number; } declare class Locations extends Table { constructor(txn: Transaction); } declare class Nodes extends Table { constructor(txn: Transaction); } declare class Ways extends Table { constructor(txn: Transaction); } declare class Relations extends Table { constructor(txn: Transaction); } declare function tagDict(tagObject: Record): Record; declare const INFO_TABLES: readonly ["locations", "nodes", "ways", "relations", "cell_node", "node_way", "node_relation", "way_relation", "relation_relation"]; type InfoTable = typeof INFO_TABLES[number]; interface DatabaseInfo { path: string; entries: Record; timestamp: string | null; sequenceNumber: string | null; } declare class Database { readonly environment: Environment; readonly transaction: Transaction; readonly locations: Locations; readonly nodes: Nodes; readonly ways: Ways; readonly relations: Relations; closed: boolean; constructor(path: string); metadata(key: string): string | null; info(): DatabaseInfo; close(): void; [Symbol.dispose](): void; } declare function open(path: string): Database; //#endregion export { BoundingBox, Database, DatabaseInfo, Disc, Environment, ExpandOptions, ExtractOptions, FileOperationResult, Id, IterationCallback, Location, Locations, Metadata, NodeData, NodeIterData, NodeQueryData, Nodes, OperationLogs, QueryResult, QuerySelection, RelationData, RelationIterData, RelationMember, Relations, RuntimeOptions, Transaction, UpdateOptions, UpdateResult, WayData, WayIterData, Ways, binaryPath, exec, expand, extract, open, query, tagDict, update };