@query-farm/vgi-rpc-iroh-browser 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import { type CreateIrohOptions } from "./transport.js";
2
+ export * from "./transport.js";
3
+ /** Initialize the packaged WebAssembly module. Calling this more than once is safe. */
4
+ export declare function initializeIrohWasm(): Promise<unknown>;
5
+ /** Create a browser Iroh endpoint backed by the packaged WebAssembly module. */
6
+ export declare function createIrohNode(options?: CreateIrohOptions): Promise<import("./transport.js").IrohNode>;
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import initWasm, { createIrohNode as createWasmIrohNode, } from "./wasm/vgi_rpc_iroh_browser.js";
2
+ import { createIrohNode as createWrappedIrohNode, } from "./transport.js";
3
+ export * from "./transport.js";
4
+ let initialization;
5
+ /** Initialize the packaged WebAssembly module. Calling this more than once is safe. */
6
+ export function initializeIrohWasm() {
7
+ if (!initialization)
8
+ initialization = initWasm();
9
+ return initialization;
10
+ }
11
+ /** Create a browser Iroh endpoint backed by the packaged WebAssembly module. */
12
+ export async function createIrohNode(options = {}) {
13
+ await initializeIrohWasm();
14
+ return createWrappedIrohNode((transportOptions) => createWasmIrohNode(transportOptions), options);
15
+ }
@@ -0,0 +1,88 @@
1
+ /** Browser-facing WHATWG stream wrapper for the wasm-bindgen transport. */
2
+ export type HeaderPair = readonly [name: string, value: string];
3
+ export type IrohProtocol = "vgi-rpc/arrow-mux/1" | "iroh-http/2";
4
+ export interface WasmVgiStream {
5
+ write(chunk: Uint8Array): Promise<void>;
6
+ read(maxBytes: number): Promise<Uint8Array | undefined>;
7
+ closeWrite(): Promise<void>;
8
+ abort(): void;
9
+ }
10
+ export interface WasmHttpResponse {
11
+ readonly status: number;
12
+ readonly headers: HeaderPair[];
13
+ read(): Promise<Uint8Array | undefined>;
14
+ cancel(): void;
15
+ }
16
+ export interface WasmIrohNode {
17
+ readonly endpointId: string;
18
+ openVgiStream(endpointId: string): Promise<WasmVgiStream>;
19
+ fetchHttpi(endpointId: string, method: string, path: string, headers: HeaderPair[], body: Uint8Array): Promise<WasmHttpResponse>;
20
+ close(): Promise<void>;
21
+ }
22
+ export type TargetResolver = (target: string, protocol: IrohProtocol) => string | Promise<string>;
23
+ export interface VgiDuplexStream {
24
+ readonly readable: ReadableStream<Uint8Array>;
25
+ readonly writable: WritableStream<Uint8Array>;
26
+ abort(reason?: unknown): void;
27
+ }
28
+ export interface HttpiResponse {
29
+ readonly status: number;
30
+ /** Ordered fields; duplicate names, including Set-Cookie, are retained. */
31
+ readonly headers: HeaderPair[];
32
+ /** Raw HTTP representation bytes. Content decoding is the VGI client's job. */
33
+ readonly body: ReadableStream<Uint8Array>;
34
+ readonly bodyEncoding: "raw";
35
+ }
36
+ export type HttpiTransportStage = "parse" | "resolve" | "connect" | "request" | "response_head" | "response_body";
37
+ export type HttpiTerminalCategory = "invalid_request" | "unauthorized_target" | "unavailable" | "timeout" | "cancelled" | "protocol" | "transport" | "internal";
38
+ export type HttpiDispatchCertainty = "not_dispatched" | "dispatched" | "ambiguous";
39
+ /** Stable transport evidence consumed by the SAB adapter; details stay sanitized. */
40
+ export declare class HttpiTransportError extends Error {
41
+ readonly stage: HttpiTransportStage;
42
+ readonly category: HttpiTerminalCategory;
43
+ readonly dispatchCertainty: HttpiDispatchCertainty;
44
+ constructor(stage: HttpiTransportStage, category: HttpiTerminalCategory, dispatchCertainty: HttpiDispatchCertainty, cause: unknown);
45
+ }
46
+ export interface OpenOptions {
47
+ signal?: AbortSignal;
48
+ readChunkBytes?: number;
49
+ }
50
+ export interface CreateIrohOptions {
51
+ /** Iroh 64-hex or z-base-32 secret key; omit for an ephemeral identity. */
52
+ secretKey?: string;
53
+ /** Replace the default n0 relay set. The array must not be empty. */
54
+ relayUrls?: string[];
55
+ /** Disable relays. Mutually exclusive with relayUrls. */
56
+ noRelay?: boolean;
57
+ /** Optional application-owned alias resolver and authorization boundary. */
58
+ resolveTarget?: TargetResolver;
59
+ /** Hard cap on wasm connect/request futures, including abandoned late settlers. Default: 16. */
60
+ maxPendingOperations?: number;
61
+ }
62
+ export interface IrohNodeOptions {
63
+ maxPendingOperations?: number;
64
+ }
65
+ export type WasmIrohNodeFactory = (options?: Omit<CreateIrohOptions, "resolveTarget" | "maxPendingOperations">) => Promise<WasmIrohNode>;
66
+ export declare function createIrohNode(wasmFactory: WasmIrohNodeFactory, options?: CreateIrohOptions): Promise<IrohNode>;
67
+ /**
68
+ * One application-owned Iroh identity.
69
+ *
70
+ * Share one instance per DuckDB engine. `resolveTarget` is optional: literal
71
+ * 64-hex EndpointIds work by default, while applications that need aliases or
72
+ * authorization can resolve/reject them without teaching VGI a policy system.
73
+ */
74
+ export declare class IrohNode {
75
+ private readonly wasm;
76
+ private readonly resolveTarget?;
77
+ private pendingOperations;
78
+ private readonly maxPendingOperations;
79
+ constructor(wasm: WasmIrohNode, resolveTarget?: TargetResolver | undefined, options?: IrohNodeOptions);
80
+ private admitted;
81
+ get endpointId(): string;
82
+ private resolve;
83
+ openVgiStream(target: string, options?: OpenOptions): Promise<VgiDuplexStream>;
84
+ fetchHttpi(target: string, method: string, path: string, headers: HeaderPair[], body: Uint8Array, signal?: AbortSignal,
85
+ /** Internal adapter hook: settles with the actual wasm request, not caller abort. */
86
+ onUnderlyingSettled?: (settled: Promise<void>) => void): Promise<HttpiResponse>;
87
+ close(): Promise<void>;
88
+ }
@@ -0,0 +1,261 @@
1
+ /** Browser-facing WHATWG stream wrapper for the wasm-bindgen transport. */
2
+ /** Stable transport evidence consumed by the SAB adapter; details stay sanitized. */
3
+ export class HttpiTransportError extends Error {
4
+ stage;
5
+ category;
6
+ dispatchCertainty;
7
+ constructor(stage, category, dispatchCertainty, cause) {
8
+ super(cause instanceof Error ? cause.message : String(cause));
9
+ this.name = "HttpiTransportError";
10
+ this.stage = stage;
11
+ this.category = category;
12
+ this.dispatchCertainty = dispatchCertainty;
13
+ }
14
+ }
15
+ export async function createIrohNode(wasmFactory, options = {}) {
16
+ const { resolveTarget, maxPendingOperations, ...transportOptions } = options;
17
+ return new IrohNode(await wasmFactory(transportOptions), resolveTarget, {
18
+ maxPendingOperations,
19
+ });
20
+ }
21
+ /**
22
+ * One application-owned Iroh identity.
23
+ *
24
+ * Share one instance per DuckDB engine. `resolveTarget` is optional: literal
25
+ * 64-hex EndpointIds work by default, while applications that need aliases or
26
+ * authorization can resolve/reject them without teaching VGI a policy system.
27
+ */
28
+ export class IrohNode {
29
+ wasm;
30
+ resolveTarget;
31
+ pendingOperations = 0;
32
+ maxPendingOperations;
33
+ constructor(wasm, resolveTarget, options = {}) {
34
+ this.wasm = wasm;
35
+ this.resolveTarget = resolveTarget;
36
+ this.maxPendingOperations = options.maxPendingOperations ?? 16;
37
+ if (!Number.isSafeInteger(this.maxPendingOperations) ||
38
+ this.maxPendingOperations <= 0) {
39
+ throw new RangeError("maxPendingOperations must be a positive safe integer");
40
+ }
41
+ }
42
+ admitted(start, signal, disposeLate, onUnderlyingSettled) {
43
+ if (this.pendingOperations >= this.maxPendingOperations) {
44
+ return Promise.reject(new HttpiTransportError("connect", "unavailable", "not_dispatched", new Error("browser Iroh pending-operation admission limit reached")));
45
+ }
46
+ this.pendingOperations++;
47
+ let underlying;
48
+ try {
49
+ underlying = start();
50
+ }
51
+ catch (error) {
52
+ this.pendingOperations--;
53
+ return Promise.reject(error);
54
+ }
55
+ // Admission remains charged after the caller aborts. Only the actual wasm
56
+ // future settling releases it, which hard-bounds abandoned connects.
57
+ const settled = underlying.then(() => {
58
+ this.pendingOperations--;
59
+ }, () => {
60
+ this.pendingOperations--;
61
+ });
62
+ onUnderlyingSettled?.(settled);
63
+ return abortable(underlying, signal, disposeLate);
64
+ }
65
+ get endpointId() {
66
+ return this.wasm.endpointId;
67
+ }
68
+ async resolve(target, protocol) {
69
+ return this.resolveTarget ? this.resolveTarget(target, protocol) : target;
70
+ }
71
+ async openVgiStream(target, options = {}) {
72
+ throwIfAborted(options.signal);
73
+ const endpointId = await abortable(Promise.resolve(this.resolve(target, "vgi-rpc/arrow-mux/1")), options.signal);
74
+ throwIfAborted(options.signal);
75
+ const stream = await this.admitted(() => this.wasm.openVgiStream(endpointId), options.signal, (lateStream) => lateStream.abort());
76
+ const chunkBytes = options.readChunkBytes ?? 64 * 1024;
77
+ if (!Number.isSafeInteger(chunkBytes) || chunkBytes <= 0) {
78
+ stream.abort();
79
+ throw new RangeError("readChunkBytes must be a positive safe integer");
80
+ }
81
+ let aborted = false;
82
+ const abortStream = () => {
83
+ if (!aborted) {
84
+ aborted = true;
85
+ stream.abort();
86
+ }
87
+ };
88
+ const onSignalAbort = () => abortStream();
89
+ options.signal?.addEventListener("abort", onSignalAbort, { once: true });
90
+ const readable = new ReadableStream({
91
+ async pull(controller) {
92
+ try {
93
+ throwIfAborted(options.signal);
94
+ const chunk = await stream.read(chunkBytes);
95
+ if (chunk === undefined) {
96
+ options.signal?.removeEventListener("abort", onSignalAbort);
97
+ controller.close();
98
+ }
99
+ else {
100
+ controller.enqueue(chunk);
101
+ }
102
+ }
103
+ catch (error) {
104
+ abortStream();
105
+ controller.error(error);
106
+ }
107
+ },
108
+ cancel() {
109
+ abortStream();
110
+ },
111
+ });
112
+ const writable = new WritableStream({
113
+ async write(chunk) {
114
+ throwIfAborted(options.signal);
115
+ await stream.write(chunk);
116
+ },
117
+ async close() {
118
+ await stream.closeWrite();
119
+ },
120
+ abort() {
121
+ abortStream();
122
+ },
123
+ });
124
+ return { readable, writable, abort: abortStream };
125
+ }
126
+ async fetchHttpi(target, method, path, headers, body, signal,
127
+ /** Internal adapter hook: settles with the actual wasm request, not caller abort. */
128
+ onUnderlyingSettled) {
129
+ try {
130
+ throwIfAborted(signal);
131
+ }
132
+ catch (error) {
133
+ throw new HttpiTransportError("resolve", "cancelled", "not_dispatched", error);
134
+ }
135
+ let endpointId;
136
+ try {
137
+ endpointId = await abortable(Promise.resolve(this.resolve(target, "iroh-http/2")), signal);
138
+ throwIfAborted(signal);
139
+ }
140
+ catch (error) {
141
+ throw new HttpiTransportError("resolve", signal?.aborted ? "cancelled" : "unauthorized_target", "not_dispatched", error);
142
+ }
143
+ let response;
144
+ try {
145
+ response = await this.admitted(() => this.wasm.fetchHttpi(endpointId, method, path, headers, body), signal, (lateResponse) => lateResponse.cancel(), onUnderlyingSettled);
146
+ }
147
+ catch (error) {
148
+ if (signal?.aborted) {
149
+ throw new HttpiTransportError("request", "cancelled", "ambiguous", error);
150
+ }
151
+ if (error instanceof HttpiTransportError)
152
+ throw error;
153
+ const evidence = readHttpiEvidence(error);
154
+ throw new HttpiTransportError(evidence?.stage ?? "request", evidence?.category ?? "transport", evidence?.dispatchCertainty ?? "ambiguous", error);
155
+ }
156
+ const cancel = () => response.cancel();
157
+ signal?.addEventListener("abort", cancel, { once: true });
158
+ return {
159
+ status: response.status,
160
+ headers: response.headers,
161
+ bodyEncoding: "raw",
162
+ body: new ReadableStream({
163
+ async pull(controller) {
164
+ try {
165
+ throwIfAborted(signal);
166
+ const chunk = await response.read();
167
+ if (chunk === undefined) {
168
+ signal?.removeEventListener("abort", cancel);
169
+ controller.close();
170
+ }
171
+ else {
172
+ controller.enqueue(chunk);
173
+ }
174
+ }
175
+ catch (error) {
176
+ response.cancel();
177
+ controller.error(error);
178
+ }
179
+ },
180
+ cancel,
181
+ }),
182
+ };
183
+ }
184
+ close() {
185
+ return this.wasm.close();
186
+ }
187
+ }
188
+ function throwIfAborted(signal) {
189
+ if (signal?.aborted) {
190
+ throw (signal.reason ??
191
+ new DOMException("The operation was aborted", "AbortError"));
192
+ }
193
+ }
194
+ async function abortable(promise, signal, disposeLate) {
195
+ throwIfAborted(signal);
196
+ if (!signal)
197
+ return promise;
198
+ let settled = false;
199
+ return new Promise((resolve, reject) => {
200
+ const onAbort = () => {
201
+ if (settled)
202
+ return;
203
+ settled = true;
204
+ reject(signal.reason ??
205
+ new DOMException("The operation was aborted", "AbortError"));
206
+ };
207
+ signal.addEventListener("abort", onAbort, { once: true });
208
+ promise.then((value) => {
209
+ signal.removeEventListener("abort", onAbort);
210
+ if (settled) {
211
+ disposeLate?.(value);
212
+ return;
213
+ }
214
+ settled = true;
215
+ resolve(value);
216
+ }, (error) => {
217
+ signal.removeEventListener("abort", onAbort);
218
+ if (settled)
219
+ return;
220
+ settled = true;
221
+ reject(error);
222
+ });
223
+ });
224
+ }
225
+ function readHttpiEvidence(error) {
226
+ if (!error || typeof error !== "object")
227
+ return undefined;
228
+ const value = error;
229
+ const stages = [
230
+ "parse",
231
+ "resolve",
232
+ "connect",
233
+ "request",
234
+ "response_head",
235
+ "response_body",
236
+ ];
237
+ const categories = [
238
+ "invalid_request",
239
+ "unauthorized_target",
240
+ "unavailable",
241
+ "timeout",
242
+ "cancelled",
243
+ "protocol",
244
+ "transport",
245
+ "internal",
246
+ ];
247
+ const certainties = [
248
+ "not_dispatched",
249
+ "dispatched",
250
+ "ambiguous",
251
+ ];
252
+ if (!stages.includes(value.vgiStage) ||
253
+ !categories.includes(value.vgiCategory) ||
254
+ !certainties.includes(value.vgiDispatchCertainty))
255
+ return undefined;
256
+ return {
257
+ stage: value.vgiStage,
258
+ category: value.vgiCategory,
259
+ dispatchCertainty: value.vgiDispatchCertainty,
260
+ };
261
+ }
@@ -0,0 +1,201 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * The `ReadableStreamType` enum.
5
+ *
6
+ * *This API requires the following crate features to be activated: `ReadableStreamType`*
7
+ */
8
+
9
+ export type ReadableStreamType = "bytes";
10
+
11
+ /**
12
+ * Streaming HTTP response preserving ordered duplicate headers.
13
+ */
14
+ export class BrowserHttpResponse {
15
+ private constructor();
16
+ free(): void;
17
+ [Symbol.dispose](): void;
18
+ cancel(): void;
19
+ /**
20
+ * Read the next raw HTTP body data frame; trailers are currently skipped.
21
+ * No browser content decoding is performed.
22
+ */
23
+ read(): Promise<Uint8Array | undefined>;
24
+ readonly headers: Array<any>;
25
+ readonly status: number;
26
+ }
27
+
28
+ /**
29
+ * One browser Iroh identity and its protocol-specific connection pools.
30
+ *
31
+ * Construct this with [`create_iroh_node`]. One instance should be shared by
32
+ * an entire DuckDB engine so HTTP and raw VGI calls present the same endpoint
33
+ * identity to workers.
34
+ */
35
+ export class BrowserIrohNode {
36
+ private constructor();
37
+ free(): void;
38
+ [Symbol.dispose](): void;
39
+ /**
40
+ * Close all pooled connections and release the browser endpoint.
41
+ */
42
+ close(): Promise<void>;
43
+ /**
44
+ * Send one HTTP/1.1 request over a pooled `iroh-http/2` connection.
45
+ *
46
+ * `headers` is an array of `[name, value]` pairs so ordering and duplicate
47
+ * fields are preserved. The response body remains streaming through
48
+ * [`BrowserHttpResponse::read`].
49
+ */
50
+ fetchHttpi(remote: string, method: string, path: string, headers: Array<any>, body: Uint8Array): Promise<BrowserHttpResponse>;
51
+ /**
52
+ * Open one independent VGI byte stream on the pooled mux connection.
53
+ */
54
+ openVgiStream(remote: string): Promise<BrowserVgiStream>;
55
+ /**
56
+ * Lowercase 64-hex public endpoint key used by VGI's identity contract.
57
+ */
58
+ readonly endpointId: string;
59
+ }
60
+
61
+ /**
62
+ * Raw bidirectional VGI stream. The accompanying TypeScript wrapper exposes
63
+ * these methods as WHATWG `ReadableStream` and `WritableStream` objects.
64
+ */
65
+ export class BrowserVgiStream {
66
+ private constructor();
67
+ free(): void;
68
+ [Symbol.dispose](): void;
69
+ /**
70
+ * Reset both stream directions. This never closes sibling mux streams.
71
+ */
72
+ abort(): void;
73
+ /**
74
+ * Finish the request direction while retaining the response direction.
75
+ */
76
+ closeWrite(): Promise<void>;
77
+ /**
78
+ * Read up to `max_bytes`; returns `undefined` after a clean peer FIN.
79
+ */
80
+ read(max_bytes: number): Promise<Uint8Array | undefined>;
81
+ /**
82
+ * Write the complete chunk, respecting QUIC backpressure.
83
+ */
84
+ write(chunk: Uint8Array): Promise<void>;
85
+ }
86
+
87
+ export class IntoUnderlyingByteSource {
88
+ private constructor();
89
+ free(): void;
90
+ [Symbol.dispose](): void;
91
+ cancel(): void;
92
+ pull(controller: ReadableByteStreamController): Promise<any>;
93
+ start(controller: ReadableByteStreamController): void;
94
+ readonly autoAllocateChunkSize: number;
95
+ readonly type: ReadableStreamType;
96
+ }
97
+
98
+ export class IntoUnderlyingSink {
99
+ private constructor();
100
+ free(): void;
101
+ [Symbol.dispose](): void;
102
+ abort(reason: any): Promise<any>;
103
+ close(): Promise<any>;
104
+ write(chunk: any): Promise<any>;
105
+ }
106
+
107
+ export class IntoUnderlyingSource {
108
+ private constructor();
109
+ free(): void;
110
+ [Symbol.dispose](): void;
111
+ cancel(): void;
112
+ pull(controller: ReadableStreamDefaultController): Promise<any>;
113
+ }
114
+
115
+ /**
116
+ * Create a relay-capable browser endpoint.
117
+ *
118
+ * `options.secretKey` accepts Iroh's 64-hex or z-base-32 secret-key encoding.
119
+ * When omitted, a fresh ephemeral identity is generated. Persist the secret
120
+ * only when stable browser identity is an explicit application requirement.
121
+ * `options.relayUrls`, when supplied, replaces the n0 relay set.
122
+ * `options.noRelay=true` disables relays entirely. It is mutually exclusive
123
+ * with `relayUrls` and is mainly useful for controlled direct-address tests.
124
+ */
125
+ export function createIrohNode(options?: any | null): Promise<BrowserIrohNode>;
126
+
127
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
128
+
129
+ export interface InitOutput {
130
+ readonly memory: WebAssembly.Memory;
131
+ readonly __wbg_browserhttpresponse_free: (a: number, b: number) => void;
132
+ readonly __wbg_browserirohnode_free: (a: number, b: number) => void;
133
+ readonly __wbg_browservgistream_free: (a: number, b: number) => void;
134
+ readonly browserhttpresponse_cancel: (a: number) => void;
135
+ readonly browserhttpresponse_headers: (a: number) => any;
136
+ readonly browserhttpresponse_read: (a: number) => any;
137
+ readonly browserhttpresponse_status: (a: number) => number;
138
+ readonly browserirohnode_close: (a: number) => any;
139
+ readonly browserirohnode_endpointId: (a: number) => [number, number];
140
+ readonly browserirohnode_fetchHttpi: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: any) => any;
141
+ readonly browserirohnode_openVgiStream: (a: number, b: number, c: number) => any;
142
+ readonly browservgistream_abort: (a: number) => void;
143
+ readonly browservgistream_closeWrite: (a: number) => any;
144
+ readonly browservgistream_read: (a: number, b: number) => any;
145
+ readonly browservgistream_write: (a: number, b: any) => any;
146
+ readonly createIrohNode: (a: number) => any;
147
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
148
+ readonly intounderlyingsink_abort: (a: number, b: any) => any;
149
+ readonly intounderlyingsink_close: (a: number) => any;
150
+ readonly intounderlyingsink_write: (a: number, b: any) => any;
151
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
152
+ readonly intounderlyingsource_cancel: (a: number) => void;
153
+ readonly intounderlyingsource_pull: (a: number, b: any) => any;
154
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
155
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
156
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
157
+ readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
158
+ readonly intounderlyingbytesource_start: (a: number, b: any) => void;
159
+ readonly intounderlyingbytesource_type: (a: number) => number;
160
+ readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
161
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke___wasm_bindgen_91244e9a1334c25a___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_91244e9a1334c25a___JsError___true_: (a: number, b: number, c: any) => [number, number];
162
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke___js_sys_a199f889b0d5f53b___Function_fn_wasm_bindgen_91244e9a1334c25a___JsValue_____wasm_bindgen_91244e9a1334c25a___sys__Undefined___js_sys_a199f889b0d5f53b___Function_fn_wasm_bindgen_91244e9a1334c25a___JsValue_____wasm_bindgen_91244e9a1334c25a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
163
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke___wasm_bindgen_91244e9a1334c25a___JsValue______true_: (a: number, b: number, c: any) => void;
164
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke___web_sys_65b30f6c5de6bd9e___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
165
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke___web_sys_65b30f6c5de6bd9e___features__gen_MessageEvent__MessageEvent______true_: (a: number, b: number, c: any) => void;
166
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke_______true_: (a: number, b: number) => void;
167
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
168
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke_______true__2_: (a: number, b: number) => void;
169
+ readonly wasm_bindgen_91244e9a1334c25a___convert__closures_____invoke_______true__3_: (a: number, b: number) => void;
170
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
171
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
172
+ readonly __wbindgen_exn_store: (a: number) => void;
173
+ readonly __externref_table_alloc: () => number;
174
+ readonly __wbindgen_externrefs: WebAssembly.Table;
175
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
176
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
177
+ readonly __externref_table_dealloc: (a: number) => void;
178
+ readonly __wbindgen_start: () => void;
179
+ }
180
+
181
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
182
+
183
+ /**
184
+ * Instantiates the given `module`, which can either be bytes or
185
+ * a precompiled `WebAssembly.Module`.
186
+ *
187
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
188
+ *
189
+ * @returns {InitOutput}
190
+ */
191
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
192
+
193
+ /**
194
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
195
+ * for everything else, calls `WebAssembly.instantiate` directly.
196
+ *
197
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
198
+ *
199
+ * @returns {Promise<InitOutput>}
200
+ */
201
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;