/* tslint:disable */ /* eslint-disable */ /** * The `ReadableStreamType` enum. * * *This API requires the following crate features to be activated: `ReadableStreamType`* */ export type ReadableStreamType = "bytes"; export class IntoUnderlyingByteSource { private constructor(); free(): void; [Symbol.dispose](): void; cancel(): void; pull(controller: ReadableByteStreamController): Promise; start(controller: ReadableByteStreamController): void; readonly autoAllocateChunkSize: number; readonly type: ReadableStreamType; } export class IntoUnderlyingSink { private constructor(); free(): void; [Symbol.dispose](): void; abort(reason: any): Promise; close(): Promise; write(chunk: any): Promise; } export class IntoUnderlyingSource { private constructor(); free(): void; [Symbol.dispose](): void; cancel(): void; pull(controller: ReadableStreamDefaultController): Promise; } /** * One remote DuckDB, as this page knows it. * * The same `quackhole_core::Peer` the extension mints tickets with, bound a * second time here rather than reimplemented -- exactly as the HTTP framing * above is. Two decoders of the `qh1_` format would drift on the parts that * are not obvious: which fields are optional, what a missing relay means, and * how generous to be about what a person actually pasted. */ export class Peer { private constructor(); free(): void; [Symbol.dispose](): void; /** * The endpoint id in an `.iroh` address, or undefined if it is not one. * * This is what the bridge resolves a request's peer with. It used to be a * `hostname.slice(0, -'.iroh'.length)` there, which is the same convention * spelled a third way. */ static parseAddress(address: string): string | undefined; /** * Read a ticket. Throws with a message written for the person holding it. */ static parseTicket(input: string): Peer; /** * The address to ATTACH, which is also the secret's SCOPE. They have to be * the same string or the token is filed under a path nothing attaches to. */ readonly address: string; readonly endpointId: string; readonly relayUrl: string; /** * The DuckDB identifier naming this peer's secret. */ readonly secretName: string; readonly token: string; } export class QuackholeClient { private constructor(); free(): void; [Symbol.dispose](): void; endpointId(): string; /** * Perform one HTTP request over iroh and resolve with `{status, headers, body}`. * * Framing is `quackhole_core::build_request`/`parse_response` -- the same * code the native extension uses -- so the bytes on the wire are identical * and an unmodified `quackhole_serve` cannot tell the two clients apart. * * `relay` is optional but strongly preferred here. Without it iroh must * resolve the peer through pkarr over HTTPS, a round trip to a third party * that must also have seen the peer publish; a server that started seconds * ago routinely has not. The relay URL travels with the endpoint id in the * connection string a user pastes, so the browser already has it. * * `timeout_ms` is not optional in practice. The caller is a thread blocked * in `Atomics.wait`, so a request that never resolves does not fail slowly * -- it wedges the DuckDB worker permanently, with nothing logged anywhere. * * Returns a Promise rather than being an `async fn` method because the * future has to own everything it touches: it outlives this call. */ request(peer: string, relay: string | null | undefined, method: string, path: string, host: string, port: string, headers: any, body: Uint8Array | null | undefined, content_type: string, timeout_ms: number): Promise; } /** * Bind an endpoint. Resolves once the browser has one, which does not require * a relay connection yet -- that happens on the first `request`. * * `relays` is the relay list this endpoint homes on: relay URLs separated by * commas or whitespace, empty for n0's public relays. It is the same string * the `quackhole_relays` DuckDB setting takes, read by the same parser in the * core -- one format, however it reached us. * * It does not decide which relay a *peer* is reached through. That is the * relay in the ticket, registered per peer and passed to `request` below; * iroh dials it whether or not it appears here. Setting this matters when a * deployment wants no traffic of its own going to n0's relays at all. */ export function connect(relays?: string | null): Promise; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_peer_free: (a: number, b: number) => void; readonly __wbg_quackholeclient_free: (a: number, b: number) => void; readonly connect: (a: number, b: number) => any; readonly peer_address: (a: number) => [number, number]; readonly peer_endpointId: (a: number) => [number, number]; readonly peer_parseAddress: (a: number, b: number) => [number, number]; readonly peer_parseTicket: (a: number, b: number) => [number, number, number]; readonly peer_relayUrl: (a: number) => [number, number]; readonly peer_secretName: (a: number) => [number, number]; readonly peer_token: (a: number) => [number, number]; readonly quackholeclient_endpointId: (a: number) => [number, number]; readonly quackholeclient_request: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: any, o: number, p: number, q: number, r: number, s: number) => any; readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void; readonly intounderlyingsource_cancel: (a: number) => void; readonly intounderlyingsource_pull: (a: number, b: any) => any; readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void; readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void; readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number; readonly intounderlyingbytesource_cancel: (a: number) => void; readonly intounderlyingbytesource_pull: (a: number, b: any) => any; readonly intounderlyingbytesource_start: (a: number, b: any) => void; readonly intounderlyingbytesource_type: (a: number) => number; readonly intounderlyingsink_abort: (a: number, b: any) => any; readonly intounderlyingsink_close: (a: number) => any; readonly intounderlyingsink_write: (a: number, b: any) => any; readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke___wasm_bindgen_59d8f7836d3f79e4___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_59d8f7836d3f79e4___JsError___true_: (a: number, b: number, c: any) => [number, number]; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke___js_sys_a1b5e4c0c67de5dc___Function_fn_wasm_bindgen_59d8f7836d3f79e4___JsValue_____wasm_bindgen_59d8f7836d3f79e4___sys__Undefined___js_sys_a1b5e4c0c67de5dc___Function_fn_wasm_bindgen_59d8f7836d3f79e4___JsValue_____wasm_bindgen_59d8f7836d3f79e4___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke___wasm_bindgen_59d8f7836d3f79e4___JsValue______true_: (a: number, b: number, c: any) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke___web_sys_be67aeaa93a5dfa4___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke___web_sys_be67aeaa93a5dfa4___features__gen_MessageEvent__MessageEvent______true_: (a: number, b: number, c: any) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke_______true_: (a: number, b: number) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke_______true__1_: (a: number, b: number) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke_______true__2_: (a: number, b: number) => void; readonly wasm_bindgen_59d8f7836d3f79e4___convert__closures_____invoke_______true__3_: (a: number, b: number) => void; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_exn_store: (a: number) => void; readonly __externref_table_alloc: () => number; readonly __wbindgen_externrefs: WebAssembly.Table; readonly __wbindgen_free: (a: number, b: number, c: number) => void; readonly __wbindgen_destroy_closure: (a: number, b: number) => void; readonly __externref_table_dealloc: (a: number) => void; readonly __wbindgen_start: () => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;