hyperdb-wasm 0.0.26862-dev.wasm.g8c0876f6 → 0.0.26978-dev.wasm.g29b852db
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 +17 -40
- package/dist/browser.d.ts +6 -3
- package/dist/browser.js +4340 -3080
- package/dist/browser_external_directory.d.ts +13 -0
- package/dist/browser_worker.js +317 -176
- package/dist/client.d.ts +8 -13
- package/dist/hyperdb-wasm.cjs +1 -1
- package/dist/hyperdb-wasm.js +1 -1
- package/dist/hyperdb-wasm.wasm.br +0 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.node.d.ts +5 -4
- package/dist/node.d.ts +4 -2
- package/dist/node.js +4373 -3128
- package/dist/node_external_directory.d.ts +11 -0
- package/dist/node_worker.js +335 -179
- package/dist/protocol.d.ts +71 -50
- package/dist/raw.browser.js +246 -140
- package/dist/raw.d.ts +2 -1
- package/dist/raw.node.js +239 -135
- package/dist/wasm_bindings.d.ts +22 -8
- package/dist/worker_setup.d.ts +8 -2
- package/examples/node-attached-databases.mjs +10 -9
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -2,28 +2,20 @@ import { DataType, Table } from 'apache-arrow';
|
|
|
2
2
|
import type { AsyncRecordBatchStreamReader, TypeMap } from 'apache-arrow';
|
|
3
3
|
import type { HyperDBEngineClient } from './client.js';
|
|
4
4
|
import type { BrowserClientOptions } from './browser.js';
|
|
5
|
-
import type { WasmResult } from './protocol.js';
|
|
5
|
+
import type { MountSource, WasmResult } from './protocol.js';
|
|
6
6
|
import type { HyperDBErrorSource } from './protocol.js';
|
|
7
|
+
import type { UnaryRpcHandler } from './protocol.js';
|
|
7
8
|
export interface HyperDBClient {
|
|
8
9
|
ready(): Promise<void>;
|
|
9
10
|
initialize(settings: string): Promise<WasmResult>;
|
|
10
11
|
connect(): Promise<WasmResult>;
|
|
11
12
|
disconnect(connection: number): Promise<WasmResult>;
|
|
12
|
-
createDatabase(databaseName: string, persistent: boolean): Promise<WasmResult>;
|
|
13
|
-
openDatabase(databaseName: string): Promise<WasmResult>;
|
|
14
|
-
listDatabases(): Promise<WasmResult>;
|
|
15
|
-
checkpointDatabase(databaseName: string): Promise<WasmResult>;
|
|
16
|
-
dropDatabase(databaseName: string): Promise<WasmResult>;
|
|
17
|
-
attachDatabase(connection: number, databaseName: string, alias: string): Promise<WasmResult>;
|
|
18
|
-
detachDatabase(connection: number, alias: string): Promise<WasmResult>;
|
|
19
13
|
startQuery(connection: number, sql: string): Promise<WasmResult>;
|
|
20
14
|
insertArrowIPCFromPath(connection: number, path: string, name: string, schema: string | null, create: boolean, internal?: boolean): Promise<WasmResult>;
|
|
21
15
|
createTemporaryFile(bytes: Uint8Array): Promise<WasmResult>;
|
|
22
16
|
removeFile(path: string): Promise<WasmResult>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
registerExternalDirectory(handle: unknown, mode: 'read' | 'readwrite'): Promise<WasmResult>;
|
|
26
|
-
removeExternalRegistration(path: string): Promise<WasmResult>;
|
|
17
|
+
mount(source: MountSource, path: string, mode: MountAccessMode): Promise<WasmResult>;
|
|
18
|
+
unmount(path: string): Promise<WasmResult>;
|
|
27
19
|
pollQuery(query: number): Promise<WasmResult>;
|
|
28
20
|
cancelQuery(query: number): Promise<WasmResult>;
|
|
29
21
|
finishQuery(query: number): Promise<WasmResult>;
|
|
@@ -35,33 +27,25 @@ export interface ArrowInsertOptions {
|
|
|
35
27
|
readonly schema?: string;
|
|
36
28
|
readonly create?: boolean;
|
|
37
29
|
}
|
|
38
|
-
export
|
|
39
|
-
|
|
30
|
+
export type MountAccessMode = 'read' | 'readwrite';
|
|
31
|
+
export interface MountOptions {
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly mode?: MountAccessMode;
|
|
40
34
|
}
|
|
41
|
-
export interface
|
|
42
|
-
readonly
|
|
43
|
-
|
|
44
|
-
readonly size: number;
|
|
45
|
-
}
|
|
46
|
-
export type ExternalDirectoryMode = 'read' | 'readwrite';
|
|
47
|
-
export interface ExternalDirectoryRegistrationOptions {
|
|
48
|
-
readonly mode?: ExternalDirectoryMode;
|
|
35
|
+
export interface MountedResource {
|
|
36
|
+
readonly path: string;
|
|
37
|
+
close(): Promise<void>;
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
type NodeExternalFileArguments = readonly [path: string];
|
|
52
|
-
export type ExternalFileArguments = BrowserExternalFileArguments | NodeExternalFileArguments;
|
|
39
|
+
export declare function validateMountPath(path: unknown): asserts path is string;
|
|
53
40
|
export type HyperDBSettingValue = string | number | boolean | null | readonly HyperDBSettingValue[] | {
|
|
54
41
|
readonly [key: string]: HyperDBSettingValue;
|
|
55
42
|
};
|
|
56
43
|
export type HyperDBSettings = Readonly<Record<string, HyperDBSettingValue>>;
|
|
57
44
|
export interface HyperDBCreateOptions {
|
|
58
45
|
readonly settings?: HyperDBSettings;
|
|
46
|
+
readonly unaryRpc?: UnaryRpcHandler;
|
|
59
47
|
}
|
|
60
48
|
export type BrowserCreateOptions = BrowserClientOptions & HyperDBCreateOptions;
|
|
61
|
-
export interface DatabaseMetadata {
|
|
62
|
-
readonly name: string;
|
|
63
|
-
readonly storage: 'transient' | 'persistent';
|
|
64
|
-
}
|
|
65
49
|
export type QueryMetricValue = null | boolean | number | string | readonly QueryMetricValue[] | {
|
|
66
50
|
readonly [key: string]: QueryMetricValue;
|
|
67
51
|
};
|
|
@@ -102,27 +86,22 @@ export declare class HyperDBError extends Error {
|
|
|
102
86
|
constructor(message: string, sqlState: string, errorSource: HyperDBErrorSource, detail?: string, hint?: string);
|
|
103
87
|
}
|
|
104
88
|
declare function initializeHyperDB(client: HyperDBClient, settings: HyperDBSettings | undefined): Promise<void>;
|
|
105
|
-
export declare class HyperDB
|
|
89
|
+
export declare class HyperDB {
|
|
106
90
|
protected readonly client: HyperDBClient;
|
|
107
91
|
private terminated;
|
|
108
92
|
private termination;
|
|
109
93
|
private activeDatabaseOperations;
|
|
110
94
|
private readonly connections;
|
|
95
|
+
private readonly mountedResources;
|
|
111
96
|
constructor(client: HyperDBClient);
|
|
112
97
|
static create(options?: BrowserCreateOptions): Promise<HyperDB>;
|
|
113
98
|
ready(): Promise<void>;
|
|
114
99
|
connect(): Promise<HyperDBConnection>;
|
|
115
|
-
|
|
116
|
-
openDatabase(databaseName: string): Promise<void>;
|
|
117
|
-
listDatabases(): Promise<DatabaseMetadata[]>;
|
|
118
|
-
registerExternalFile(...args: ExternalFileArgs): Promise<string>;
|
|
119
|
-
removeExternalRegistration(path: string): Promise<void>;
|
|
120
|
-
protected registerExternalDirectorySource(source: unknown, mode: ExternalDirectoryMode): Promise<string>;
|
|
121
|
-
checkpointDatabase(databaseName: string): Promise<void>;
|
|
122
|
-
dropDatabase(databaseName: string): Promise<void>;
|
|
100
|
+
protected mountSource(source: MountSource, path: string, mode: MountAccessMode, cleanup?: () => void): Promise<MountedResource>;
|
|
123
101
|
terminate(): Promise<void>;
|
|
124
102
|
private ensureRunning;
|
|
125
103
|
protected runDatabaseOperation<Result>(operation: () => Promise<Result>): Promise<Result>;
|
|
104
|
+
private unmount;
|
|
126
105
|
}
|
|
127
106
|
export declare class HyperDBConnection {
|
|
128
107
|
private readonly client;
|
|
@@ -133,8 +112,6 @@ export declare class HyperDBConnection {
|
|
|
133
112
|
private closing;
|
|
134
113
|
constructor(client: HyperDBClient, connection: number, onClose?: () => void);
|
|
135
114
|
close(): Promise<void>;
|
|
136
|
-
attachDatabase(databaseName: string, alias?: string): Promise<void>;
|
|
137
|
-
detachDatabase(alias: string): Promise<void>;
|
|
138
115
|
sendIPC(sql: string): QueryResult<AsyncIterable<Uint8Array>>;
|
|
139
116
|
queryIPC(sql: string): QueryResult<Promise<Uint8Array>>;
|
|
140
117
|
send<T extends TypeMap = {
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HyperDBEngineClient } from './client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SetupProgress, UnaryRpcHandler, WorkerRequest, WorkerTransport } from './protocol.js';
|
|
3
3
|
type BrowserListener = (event: unknown) => void;
|
|
4
4
|
export interface BrowserWorkerLike {
|
|
5
5
|
postMessage(message: unknown, transfer: ArrayBuffer[]): void;
|
|
@@ -11,7 +11,10 @@ export interface BrowserClientOptions {
|
|
|
11
11
|
readonly workerUrl?: string | URL;
|
|
12
12
|
readonly engineUrl?: string | URL;
|
|
13
13
|
readonly wasmUrl?: string | URL;
|
|
14
|
+
/** OPFS-relative directory mounted as the durable filesystem root. */
|
|
15
|
+
readonly storagePath?: string;
|
|
14
16
|
readonly onSetupProgress?: (progress: SetupProgress) => void;
|
|
17
|
+
readonly unaryRpc?: UnaryRpcHandler;
|
|
15
18
|
}
|
|
16
19
|
type BrowserEnvironment = {
|
|
17
20
|
readonly WebAssembly?: typeof WebAssembly;
|
|
@@ -30,12 +33,12 @@ export declare function assertBrowserSupport(environment?: BrowserEnvironment):
|
|
|
30
33
|
export declare class BrowserWorker implements WorkerTransport {
|
|
31
34
|
private readonly worker;
|
|
32
35
|
constructor(worker: BrowserWorkerLike);
|
|
33
|
-
postMessage(message:
|
|
36
|
+
postMessage(message: WorkerRequest, transfer?: readonly ArrayBuffer[]): void;
|
|
34
37
|
onMessage(listener: (message: unknown) => void): () => void;
|
|
35
38
|
onError(listener: (error: Error) => void): () => void;
|
|
36
39
|
onClose(): () => void;
|
|
37
40
|
terminate(): void;
|
|
38
41
|
}
|
|
39
|
-
export declare function resolveBrowserWorkerUrl(workerUrl: string | URL, engineUrl: string | URL, wasmUrl?: string | URL): URL;
|
|
42
|
+
export declare function resolveBrowserWorkerUrl(workerUrl: string | URL, engineUrl: string | URL, wasmUrl?: string | URL, storagePath?: string, baseUrl?: string | URL): URL;
|
|
40
43
|
export declare function createBrowserClient(options?: BrowserClientOptions): HyperDBEngineClient;
|
|
41
44
|
export {};
|