hyperdb-wasm 0.0.26268-dev.remotes-origin-wasm.gcf8d815a
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.
- package/dist/api.d.ts +61 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +12323 -0
- package/dist/browser_worker.d.ts +1 -0
- package/dist/browser_worker.js +271 -0
- package/dist/client.d.ts +26 -0
- package/dist/hyperdb-wasm.cjs +3 -0
- package/dist/hyperdb-wasm.js +3 -0
- package/dist/hyperdb-wasm.wasm.br +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.node.d.ts +7 -0
- package/dist/node.d.ts +26 -0
- package/dist/node.js +532 -0
- package/dist/node_worker.d.ts +1 -0
- package/dist/node_worker.js +277 -0
- package/dist/protocol.d.ts +84 -0
- package/dist/raw.browser.d.ts +3 -0
- package/dist/raw.browser.js +279 -0
- package/dist/raw.d.ts +3 -0
- package/dist/raw.node.d.ts +3 -0
- package/dist/raw.node.js +281 -0
- package/dist/wasm_bindings.d.ts +37 -0
- package/dist/worker_setup.d.ts +25 -0
- package/examples/browser.html +84 -0
- package/examples/node.mjs +68 -0
- package/examples/serve.mjs +35 -0
- package/package.json +41 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DataType, Table } from 'apache-arrow';
|
|
2
|
+
import type { AsyncRecordBatchStreamReader, TypeMap } from 'apache-arrow';
|
|
3
|
+
import type { HyperDBEngineClient } from './client.js';
|
|
4
|
+
import type { BrowserClientOptions } from './browser.js';
|
|
5
|
+
import type { WasmResult } from './protocol.js';
|
|
6
|
+
export interface HyperDBClient {
|
|
7
|
+
ready(): Promise<void>;
|
|
8
|
+
connect(): Promise<WasmResult>;
|
|
9
|
+
disconnect(connection: number): Promise<WasmResult>;
|
|
10
|
+
startQuery(connection: number, sql: string): Promise<WasmResult>;
|
|
11
|
+
insertArrowIPCFromPath(connection: number, path: string, name: string, schema: string | null, create: boolean, internal?: boolean): Promise<WasmResult>;
|
|
12
|
+
createTemporaryFile(bytes: Uint8Array): Promise<WasmResult>;
|
|
13
|
+
removeFile(path: string): Promise<WasmResult>;
|
|
14
|
+
pollQuery(query: number): Promise<WasmResult>;
|
|
15
|
+
cancelQuery(query: number): Promise<WasmResult>;
|
|
16
|
+
releaseQuery(query: number): Promise<WasmResult>;
|
|
17
|
+
terminate(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface ArrowInsertOptions {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly schema?: string;
|
|
22
|
+
readonly create?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class HyperDB {
|
|
25
|
+
private readonly client;
|
|
26
|
+
private terminated;
|
|
27
|
+
private termination;
|
|
28
|
+
private readonly connections;
|
|
29
|
+
constructor(client: HyperDBClient);
|
|
30
|
+
static create(options?: BrowserClientOptions): Promise<HyperDB>;
|
|
31
|
+
ready(): Promise<void>;
|
|
32
|
+
connect(): Promise<HyperDBConnection>;
|
|
33
|
+
terminate(): Promise<void>;
|
|
34
|
+
private ensureRunning;
|
|
35
|
+
}
|
|
36
|
+
export declare class HyperDBConnection {
|
|
37
|
+
private readonly client;
|
|
38
|
+
private readonly connection;
|
|
39
|
+
private readonly onClose;
|
|
40
|
+
private closed;
|
|
41
|
+
private active;
|
|
42
|
+
private closing;
|
|
43
|
+
constructor(client: HyperDBClient, connection: number, onClose?: () => void);
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
sendIPC(sql: string): AsyncIterable<Uint8Array>;
|
|
46
|
+
queryIPC(sql: string): Promise<Uint8Array>;
|
|
47
|
+
send<T extends TypeMap = {
|
|
48
|
+
[key: string]: DataType;
|
|
49
|
+
}>(sql: string): Promise<AsyncRecordBatchStreamReader<T>>;
|
|
50
|
+
query<T extends TypeMap = {
|
|
51
|
+
[key: string]: DataType;
|
|
52
|
+
}>(sql: string): Promise<Table<T>>;
|
|
53
|
+
insertArrowTable(table: Table, options: ArrowInsertOptions): Promise<void>;
|
|
54
|
+
insertArrowIPCFromPath(path: string, options: ArrowInsertOptions): Promise<void>;
|
|
55
|
+
private insertArrowIPCFromPathInternal;
|
|
56
|
+
private ensureAvailable;
|
|
57
|
+
private release;
|
|
58
|
+
closeForTermination(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export type { HyperDBEngineClient };
|
|
61
|
+
export type { BrowserClientOptions as BrowserCreateOptions };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HyperDBEngineClient } from './client.js';
|
|
2
|
+
import type { EngineRequest, WorkerTransport } from './protocol.js';
|
|
3
|
+
type BrowserListener = (event: unknown) => void;
|
|
4
|
+
export interface BrowserWorkerLike {
|
|
5
|
+
postMessage(message: unknown, transfer: ArrayBuffer[]): void;
|
|
6
|
+
addEventListener(type: string, listener: BrowserListener): void;
|
|
7
|
+
removeEventListener(type: string, listener: BrowserListener): void;
|
|
8
|
+
terminate(): void;
|
|
9
|
+
}
|
|
10
|
+
export interface BrowserClientOptions {
|
|
11
|
+
readonly workerUrl?: string | URL;
|
|
12
|
+
readonly engineUrl?: string | URL;
|
|
13
|
+
}
|
|
14
|
+
export declare class BrowserWorker implements WorkerTransport {
|
|
15
|
+
private readonly worker;
|
|
16
|
+
constructor(worker: BrowserWorkerLike);
|
|
17
|
+
postMessage(message: EngineRequest, transfer?: readonly ArrayBuffer[]): void;
|
|
18
|
+
onMessage(listener: (message: unknown) => void): () => void;
|
|
19
|
+
onError(listener: (error: Error) => void): () => void;
|
|
20
|
+
onClose(): () => void;
|
|
21
|
+
terminate(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveBrowserWorkerUrl(workerUrl: string | URL, engineUrl: string | URL): URL;
|
|
24
|
+
export declare function createBrowserClient(options?: BrowserClientOptions): HyperDBEngineClient;
|
|
25
|
+
export {};
|