hyperdb-wasm 0.0.26312-dev.wasm.g57edd738 → 0.0.26312-dev.wasm.g913ac019
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/browser.d.ts +2 -2
- package/dist/browser.js +5 -5
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/node.js +5 -5
- package/dist/protocol.d.ts +2 -2
- package/dist/raw.browser.js +5 -5
- package/dist/raw.d.ts +1 -1
- package/dist/raw.node.js +4 -4
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HyperDBEngineClient } from './client.js';
|
|
2
|
-
import type { EngineRequest,
|
|
2
|
+
import type { EngineRequest, SetupProgress, 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,7 @@ export interface BrowserClientOptions {
|
|
|
11
11
|
readonly workerUrl?: string | URL;
|
|
12
12
|
readonly engineUrl?: string | URL;
|
|
13
13
|
readonly wasmUrl?: string | URL;
|
|
14
|
-
readonly
|
|
14
|
+
readonly onSetupProgress?: (progress: SetupProgress) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare class BrowserWorker implements WorkerTransport {
|
|
17
17
|
private readonly worker;
|
package/dist/browser.js
CHANGED
|
@@ -68,8 +68,8 @@ var init_client = __esm({
|
|
|
68
68
|
"use strict";
|
|
69
69
|
init_protocol();
|
|
70
70
|
HyperDBEngineClient = class {
|
|
71
|
-
constructor(transport,
|
|
72
|
-
this.
|
|
71
|
+
constructor(transport, onSetupProgress) {
|
|
72
|
+
this.onSetupProgress = onSetupProgress;
|
|
73
73
|
this.transport = transport;
|
|
74
74
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
75
75
|
this.resolveReady = resolve;
|
|
@@ -81,7 +81,7 @@ var init_client = __esm({
|
|
|
81
81
|
transport.onClose((error) => this.fail(error))
|
|
82
82
|
];
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
onSetupProgress;
|
|
85
85
|
transport;
|
|
86
86
|
pending = /* @__PURE__ */ new Map();
|
|
87
87
|
readyPromise;
|
|
@@ -171,7 +171,7 @@ var init_client = __esm({
|
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
if (message.type === "progress") {
|
|
174
|
-
this.
|
|
174
|
+
this.onSetupProgress?.({ bytesLoaded: message.bytesLoaded, bytesTotal: message.bytesTotal });
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
if (message.type === "fatal") {
|
|
@@ -214,7 +214,7 @@ function createBrowserClient(options = {}) {
|
|
|
214
214
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
215
215
|
return new HyperDBEngineClient(
|
|
216
216
|
new BrowserWorker(new Worker(resolveBrowserWorkerUrl(workerUrl, engineUrl, options.wasmUrl), { type: "classic" })),
|
|
217
|
-
options.
|
|
217
|
+
options.onSetupProgress
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
var BrowserWorker;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SetupProgress, WasmResult, WorkerTransport } from './protocol.js';
|
|
2
2
|
export declare class HyperDBEngineClient {
|
|
3
|
-
private readonly
|
|
3
|
+
private readonly onSetupProgress?;
|
|
4
4
|
private readonly transport;
|
|
5
5
|
private readonly pending;
|
|
6
6
|
private readonly readyPromise;
|
|
@@ -9,7 +9,7 @@ export declare class HyperDBEngineClient {
|
|
|
9
9
|
private nextId;
|
|
10
10
|
private failed;
|
|
11
11
|
private readonly unsubscribe;
|
|
12
|
-
constructor(transport: WorkerTransport,
|
|
12
|
+
constructor(transport: WorkerTransport, onSetupProgress?: ((progress: SetupProgress) => void) | undefined);
|
|
13
13
|
ready(): Promise<void>;
|
|
14
14
|
initialize(settings: string): Promise<WasmResult>;
|
|
15
15
|
connect(): Promise<WasmResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { HyperDB, HyperDBConnection } from './api.js';
|
|
2
2
|
export type { ArrowInsertOptions, BrowserCreateOptions, DatabaseCreateOptions, DatabaseMetadata, HyperDBSettingValue, HyperDBSettings } from './api.js';
|
|
3
|
-
export type {
|
|
3
|
+
export type { SetupProgress } from './protocol.js';
|
package/dist/node.js
CHANGED
|
@@ -68,8 +68,8 @@ var init_client = __esm({
|
|
|
68
68
|
"use strict";
|
|
69
69
|
init_protocol();
|
|
70
70
|
HyperDBEngineClient = class {
|
|
71
|
-
constructor(transport,
|
|
72
|
-
this.
|
|
71
|
+
constructor(transport, onSetupProgress) {
|
|
72
|
+
this.onSetupProgress = onSetupProgress;
|
|
73
73
|
this.transport = transport;
|
|
74
74
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
75
75
|
this.resolveReady = resolve;
|
|
@@ -81,7 +81,7 @@ var init_client = __esm({
|
|
|
81
81
|
transport.onClose((error) => this.fail(error))
|
|
82
82
|
];
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
onSetupProgress;
|
|
85
85
|
transport;
|
|
86
86
|
pending = /* @__PURE__ */ new Map();
|
|
87
87
|
readyPromise;
|
|
@@ -171,7 +171,7 @@ var init_client = __esm({
|
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
if (message.type === "progress") {
|
|
174
|
-
this.
|
|
174
|
+
this.onSetupProgress?.({ bytesLoaded: message.bytesLoaded, bytesTotal: message.bytesTotal });
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
if (message.type === "fatal") {
|
|
@@ -214,7 +214,7 @@ function createBrowserClient(options = {}) {
|
|
|
214
214
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
215
215
|
return new HyperDBEngineClient(
|
|
216
216
|
new BrowserWorker(new Worker(resolveBrowserWorkerUrl(workerUrl, engineUrl, options.wasmUrl), { type: "classic" })),
|
|
217
|
-
options.
|
|
217
|
+
options.onSetupProgress
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
var BrowserWorker;
|
package/dist/protocol.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export type WasmResponse = {
|
|
|
101
101
|
type: 'response';
|
|
102
102
|
result: WasmResult;
|
|
103
103
|
};
|
|
104
|
-
export interface
|
|
104
|
+
export interface SetupProgress {
|
|
105
105
|
readonly bytesLoaded: number;
|
|
106
106
|
readonly bytesTotal: number;
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ export type WorkerEvent = {
|
|
|
109
109
|
type: 'ready';
|
|
110
110
|
} | ({
|
|
111
111
|
type: 'progress';
|
|
112
|
-
} &
|
|
112
|
+
} & SetupProgress) | {
|
|
113
113
|
type: 'fatal';
|
|
114
114
|
error: string;
|
|
115
115
|
} | {
|
package/dist/raw.browser.js
CHANGED
|
@@ -43,8 +43,8 @@ function isWorkerEvent(message) {
|
|
|
43
43
|
|
|
44
44
|
// src/client.ts
|
|
45
45
|
var HyperDBEngineClient = class {
|
|
46
|
-
constructor(transport,
|
|
47
|
-
this.
|
|
46
|
+
constructor(transport, onSetupProgress) {
|
|
47
|
+
this.onSetupProgress = onSetupProgress;
|
|
48
48
|
this.transport = transport;
|
|
49
49
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
50
50
|
this.resolveReady = resolve;
|
|
@@ -56,7 +56,7 @@ var HyperDBEngineClient = class {
|
|
|
56
56
|
transport.onClose((error) => this.fail(error))
|
|
57
57
|
];
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
onSetupProgress;
|
|
60
60
|
transport;
|
|
61
61
|
pending = /* @__PURE__ */ new Map();
|
|
62
62
|
readyPromise;
|
|
@@ -146,7 +146,7 @@ var HyperDBEngineClient = class {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
if (message.type === "progress") {
|
|
149
|
-
this.
|
|
149
|
+
this.onSetupProgress?.({ bytesLoaded: message.bytesLoaded, bytesTotal: message.bytesTotal });
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
if (message.type === "fatal") {
|
|
@@ -355,7 +355,7 @@ function createBrowserClient(options = {}) {
|
|
|
355
355
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
356
356
|
return new HyperDBEngineClient(
|
|
357
357
|
new BrowserWorker(new Worker(resolveBrowserWorkerUrl(workerUrl, engineUrl, options.wasmUrl), { type: "classic" })),
|
|
358
|
-
options.
|
|
358
|
+
options.onSetupProgress
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
361
|
export {
|
package/dist/raw.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { HyperDBEngineClient } from './client.js';
|
|
2
2
|
export { HyperDBBindings } from './wasm_bindings.js';
|
|
3
|
-
export type { EngineRequest,
|
|
3
|
+
export type { EngineRequest, SetupProgress, WasmResponse, WasmResult, WorkerEvent, WorkerTransport } from './protocol.js';
|
package/dist/raw.node.js
CHANGED
|
@@ -43,8 +43,8 @@ function isWorkerEvent(message) {
|
|
|
43
43
|
|
|
44
44
|
// src/client.ts
|
|
45
45
|
var HyperDBEngineClient = class {
|
|
46
|
-
constructor(transport,
|
|
47
|
-
this.
|
|
46
|
+
constructor(transport, onSetupProgress) {
|
|
47
|
+
this.onSetupProgress = onSetupProgress;
|
|
48
48
|
this.transport = transport;
|
|
49
49
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
50
50
|
this.resolveReady = resolve;
|
|
@@ -56,7 +56,7 @@ var HyperDBEngineClient = class {
|
|
|
56
56
|
transport.onClose((error) => this.fail(error))
|
|
57
57
|
];
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
onSetupProgress;
|
|
60
60
|
transport;
|
|
61
61
|
pending = /* @__PURE__ */ new Map();
|
|
62
62
|
readyPromise;
|
|
@@ -146,7 +146,7 @@ var HyperDBEngineClient = class {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
if (message.type === "progress") {
|
|
149
|
-
this.
|
|
149
|
+
this.onSetupProgress?.({ bytesLoaded: message.bytesLoaded, bytesTotal: message.bytesTotal });
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
if (message.type === "fatal") {
|