@moltendb-web/core 1.4.1 โ†’ 1.5.0

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/README.md CHANGED
@@ -23,7 +23,7 @@ MoltenDb is a JSON document database written in Rust that runs directly in your
23
23
 
24
24
  Beyond being a full-featured embedded database, MoltenDb can also serve as a **persistent state manager** for your application. Because all data is written to OPFS, your app's state survives page reloads, browser crashes, and unexpected connection loss โ€” your users will never lose their work.
25
25
 
26
- > **๐Ÿš€ Release Candidate** โ€” The core engine, multi-tab sync, and storage layer are feature-complete and stabilised for v1. Server sync, encryption and analytics are planned for a future release.
26
+ > **๐Ÿš€ Release Candidate 2** โ€” The core engine, multi-tab sync, storage layer, and **transparent at-rest encryption** are feature-complete and stabilised. Server sync and analytics are planned for a future release.
27
27
 
28
28
  ### ๐ŸŽฎ Explore the Full Functionality
29
29
 
@@ -34,7 +34,8 @@ Prefer to run it in your own environment? You can **[clone the demo repository](
34
34
  **โš ๏ธ Note for Online IDEs:** If you are viewing this on StackBlitz or CodeSandbox, the WASM engine may be blocked by iframe security restrictions. Please click the "Open in New Window/Tab" button in the preview pane to enable the full OPFS storage engine.
35
35
 
36
36
  ### Core Features
37
- - **Pure Rust Engine:** The same query logic used in our server binary, compiled to WebAssembly.
37
+ - **Hybrid Bitcask Storage:** The same query logic used in our server binary, compiled to WebAssembly. Data is paged between RAM and OPFS to handle datasets larger than memory.
38
+ - **At-Rest Encryption:** Transparently secure your data in the browser using XChaCha20-Poly1305 (Argon2id key derivation).
38
39
  - **OPFS Persistence:** Data persists across page reloads in a dedicated, high-speed sandbox.
39
40
  - **Worker-Threaded:** The database runs entirely inside a Web Workerโ€”zero impact on your UI thread.
40
41
  - **Multi-Tab Sync (stabilised):** Leader election via the Web Locks API ensures only one tab owns the OPFS handle. All other tabs proxy reads and writes through a `BroadcastChannel`. Seamless leader promotion when the active tab closes.
@@ -93,7 +94,11 @@ TypeScript
93
94
  import { MoltenDb } from '@moltendb-web/core';
94
95
  import { MoltenDbClient, WorkerTransport } from '@moltendb-web/query';
95
96
 
96
- const db = new MoltenDb('moltendb_demo');
97
+ const db = new MoltenDb('moltendb_demo', {
98
+ hotThreshold: 25000, // Keep 25k docs in RAM per collection
99
+ encryptionKey: 'my-secret', // Enable transparent at-rest encryption
100
+ writeMode: 'sync' // Ensure every write is flushed to OPFS
101
+ });
97
102
  await db.init();
98
103
 
99
104
  // Connect the query builder to the WASM worker
@@ -245,6 +250,32 @@ await client.collection('laptops')
245
250
  | Read cost | O(1) โ€” data already embedded | O(1) per join per document |
246
251
  | Use when | Data rarely changes, fast reads matter | Data changes frequently, freshness matters |
247
252
 
253
+ ---
254
+ ## Configuration
255
+
256
+ You can customise the database behavior by passing an options object to the `MoltenDb` constructor.
257
+
258
+ ```ts
259
+ const db = new MoltenDb('my-app', {
260
+ hotThreshold: 25000, // Page to disk after 25k docs
261
+ encryptionKey: 'user-secret', // Secure at-rest storage in OPFS
262
+ writeMode: 'sync' // Ensure durability on every write
263
+ });
264
+ await db.init();
265
+ ```
266
+
267
+ ### Options Reference
268
+
269
+ | Property | Type | Default | Description |
270
+ | :--- | :--- | :--- | :--- |
271
+ | `hotThreshold` | `number` | `50000` | **Hybrid Bitcask Limit:** Maximum documents per collection to keep in RAM. When exceeded, the oldest documents are paged out to OPFS to save memory. |
272
+ | `encryptionKey` | `string` | `undefined` | **At-Rest Encryption:** If provided, all data written to OPFS is encrypted using XChaCha20-Poly1305. If omitted, data is stored as plain JSON. |
273
+ | `writeMode` | `'async' \| 'sync'` | `'async'` | **Durability vs Speed:** `'async'` is blazing fast (high throughput), while `'sync'` ensures every write is flushed to disk before returning (safer but slower). **Note:** `async` is recommended for most web apps to avoid blocking during heavy write bursts. |
274
+ | `workerUrl` | `string \| URL` | `undefined` | Custom path to the Web Worker script. |
275
+ | `maxBodySize` | `number` | `10485760` | **Payload Limit:** Max body size in bytes. Prevents memory spikes from large messages. |
276
+ | `rateLimitRequests`| `number` | `100` | (Server Parity/Safety) Max requests allowed per rate-limit window. |
277
+ | `rateLimitWindow` | `number` | `60` | (Server Parity/Safety) Size of the rate-limit window in seconds. |
278
+
248
279
  ---
249
280
  ## Storage Architecture
250
281
 
@@ -369,8 +400,10 @@ This monorepo contains the following packages:
369
400
  - [ ] **React Adapter:** Official `@moltendb-web/react` package with `useQuery` hooks and real-time context providers.
370
401
  - [x] **Angular Adapter:** Official `@moltendb-web/angular` package featuring Signal-based data fetching.
371
402
  - [ ] **Delta Sync:** Automatic two-way sync with the MoltenDb Rust server.
372
- - [ ] **Data Encryption:** Transparent encryption-at-rest using hardware-backed keys (Web Crypto API).
403
+ - [x] **Data Encryption:** Transparent encryption-at-rest using hardware-backed keys (Argon2id + XChaCha20) โ€” **stabilised in RC2**.
404
+ - [x] **Hybrid Bitcask:** Seamlessly handle datasets larger than RAM by paging docs to OPFS โ€” **stabilised in RC2**.
373
405
  - [ ] **Analytics Functionality:** Run complex analytics queries straight in the browser without blocking the UI.
406
+ - [x] **Configurable Limits:** User-defined RAM thresholds and request body sizes for edge and browser environments โ€” **stabilised in RC2**.
374
407
 
375
408
 
376
409
  ## Contributing & Feedback
package/dist/index.d.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  export interface MoltenDbOptions {
2
2
  /** URL or path to moltendb-worker.js. */
3
3
  workerUrl?: string | URL;
4
+ /** Maximum documents per collection to keep in RAM. Default: 50,000. */
5
+ hotThreshold?: number;
6
+ /** Password for at-rest encryption. If not provided, data is stored as plain JSON. */
7
+ encryptionKey?: string;
8
+ /** Storage write mode: 'async' (default, high throughput) or 'sync' (durable). */
9
+ writeMode?: 'async' | 'sync';
10
+ /** (Server only) Max requests per IP per rate-limit window. */
11
+ rateLimitRequests?: number;
12
+ /** (Server only) Rate-limit window size in seconds. */
13
+ rateLimitWindow?: number;
14
+ /** (Server only) Maximum request body size in bytes. */
15
+ maxBodySize?: number;
4
16
  }
5
17
  export interface DbEvent {
6
18
  type: 'event';
@@ -12,6 +24,7 @@ export interface DbEvent {
12
24
  export declare class MoltenDb {
13
25
  readonly dbName: string;
14
26
  readonly workerUrl?: string | URL;
27
+ readonly options: MoltenDbOptions;
15
28
  worker: Worker | null;
16
29
  private initPromise;
17
30
  private pendingRequests;
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { mapToObj } from "./helpers";
2
2
  export class MoltenDb {
3
3
  dbName;
4
4
  workerUrl;
5
+ options;
5
6
  worker = null;
6
7
  initPromise = null;
7
8
  pendingRequests = new Map();
@@ -15,6 +16,7 @@ export class MoltenDb {
15
16
  constructor(dbName = 'moltendb', options = {}) {
16
17
  this.dbName = dbName;
17
18
  this.workerUrl = options.workerUrl;
19
+ this.options = options;
18
20
  }
19
21
  /**
20
22
  * โšก Subscribe to real-time DB mutations.
@@ -103,7 +105,15 @@ export class MoltenDb {
103
105
  }
104
106
  };
105
107
  // Wait for worker to boot
106
- await this.sendMessage('init', { dbName: this.dbName });
108
+ await this.sendMessage('init', {
109
+ dbName: this.dbName,
110
+ hotThreshold: this.options.hotThreshold,
111
+ encryptionKey: this.options.encryptionKey,
112
+ writeMode: this.options.writeMode,
113
+ rateLimitRequests: this.options.rateLimitRequests,
114
+ rateLimitWindow: this.options.rateLimitWindow,
115
+ maxBodySize: this.options.maxBodySize,
116
+ });
107
117
  this.bc.onmessage = async (e) => {
108
118
  const msg = e.data;
109
119
  if (msg.type === 'query' && msg.action) {
@@ -8,8 +8,8 @@ self.onmessage = async (e) => {
8
8
  if (!initPromise) {
9
9
  initPromise = (async () => {
10
10
  await init();
11
- // FIX: You must await the async constructor
12
- const instance = await new WorkerDb(payload.dbName);
11
+ // Pass all config flags to Rust
12
+ const instance = await WorkerDb.create(payload.dbName, payload.hotThreshold, payload.encryptionKey, payload.writeMode, payload.rateLimitRequests, payload.rateLimitWindow, payload.maxBodySize);
13
13
  // Listen to Rust and broadcast events
14
14
  instance.subscribe((eventStr) => {
15
15
  try {
@@ -14,6 +14,7 @@
14
14
  * 3. Convert the result back to JsValue for JavaScript.
15
15
  */
16
16
  export class WorkerDb {
17
+ private constructor();
17
18
  free(): void;
18
19
  [Symbol.dispose](): void;
19
20
  /**
@@ -38,6 +39,31 @@ export class WorkerDb {
38
39
  * "analytics" (matching the call in analytics-worker.js).
39
40
  */
40
41
  analytics(query_json: string): string;
42
+ /**
43
+ * Initialize the database and open (or create) the OPFS storage file.
44
+ *
45
+ * Called from JavaScript as:
46
+ * `const db = await WorkerDb.create("click_analytics_db", 50000, "my-secret-key")`
47
+ *
48
+ * A named static factory function is used instead of an async constructor
49
+ * because `#[wasm_bindgen(constructor)]` with `async fn` produces invalid
50
+ * TypeScript bindings and is deprecated in wasm-bindgen.
51
+ *
52
+ * `async` because opening the OPFS file handle is an async browser API.
53
+ * Returns `Result<WorkerDb, JsValue>` โ€” on error, the JsValue becomes a
54
+ * JavaScript exception that the worker's try/catch can handle.
55
+ *
56
+ * # Arguments
57
+ * * `db_name` โ€” The name of the OPFS file to open (e.g. "click_analytics_db").
58
+ * Each unique name is a separate database file in the browser's OPFS storage.
59
+ * * `hot_threshold` โ€” Optional maximum documents per collection to keep in RAM (default: 50,000).
60
+ * * `encryption_key` โ€” Optional password for at-rest encryption.
61
+ * * `write_mode` โ€” Optional write mode: "async" (default) or "sync".
62
+ * * `rate_limit_requests` โ€” Optional max requests per window (default: 100).
63
+ * * `rate_limit_window` โ€” Optional window size in seconds (default: 60).
64
+ * * `max_body_size` โ€” Optional maximum request body size in bytes (default: 10MB).
65
+ */
66
+ static create(db_name: string, hot_threshold?: number | null, encryption_key?: string | null, write_mode?: string | null, rate_limit_requests?: number | null, rate_limit_window?: bigint | null, max_body_size?: number | null): Promise<WorkerDb>;
41
67
  /**
42
68
  * Route an incoming message from the JavaScript worker to the correct handler.
43
69
  *
@@ -58,24 +84,6 @@ export class WorkerDb {
58
84
  * Returns a JsValue result on success, or a JsValue error string on failure.
59
85
  */
60
86
  handle_message(data: any): any;
61
- /**
62
- * Initialize the database and open (or create) the OPFS storage file.
63
- *
64
- * This is the constructor โ€” called from JavaScript as:
65
- * `const db = await new WorkerDb("click_analytics_db")`
66
- *
67
- * `#[wasm_bindgen(constructor)]` tells wasm-bindgen that this function
68
- * is the JavaScript `new WorkerDb(...)` constructor.
69
- *
70
- * `async` because opening the OPFS file handle is an async browser API.
71
- * Returns `Result<WorkerDb, JsValue>` โ€” on error, the JsValue becomes a
72
- * JavaScript exception that the worker's try/catch can handle.
73
- *
74
- * # Arguments
75
- * * `db_name` โ€” The name of the OPFS file to open (e.g. "click_analytics_db").
76
- * Each unique name is a separate database file in the browser's OPFS storage.
77
- */
78
- constructor(db_name: string);
79
87
  /**
80
88
  * Subscribe to real-time database changes.
81
89
  * The provided JavaScript function will be called with a JSON string
@@ -89,21 +97,18 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
89
97
  export interface InitOutput {
90
98
  readonly memory: WebAssembly.Memory;
91
99
  readonly __wbg_workerdb_free: (a: number, b: number) => void;
92
- readonly workerdb_analytics: (a: number, b: number, c: number) => [number, number];
93
- readonly workerdb_handle_message: (a: number, b: any) => [number, number, number];
94
- readonly workerdb_new: (a: number, b: number) => any;
95
- readonly workerdb_subscribe: (a: number, b: any) => void;
96
- readonly wasm_bindgen__closure__destroy__hd467cd5df2070873: (a: number, b: number) => void;
97
- readonly wasm_bindgen__convert__closures_____invoke__hfcbb4037b8cae583: (a: number, b: number, c: any) => [number, number];
98
- readonly wasm_bindgen__convert__closures_____invoke__h23a1582ccafe3e3c: (a: number, b: number, c: any, d: any) => void;
99
- readonly __wbindgen_malloc: (a: number, b: number) => number;
100
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
101
- readonly __wbindgen_exn_store: (a: number) => void;
102
- readonly __externref_table_alloc: () => number;
103
- readonly __wbindgen_externrefs: WebAssembly.Table;
104
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
105
- readonly __externref_table_dealloc: (a: number) => void;
106
- readonly __wbindgen_start: () => void;
100
+ readonly workerdb_analytics: (a: number, b: number, c: number, d: number) => void;
101
+ readonly workerdb_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint, k: number) => number;
102
+ readonly workerdb_handle_message: (a: number, b: number, c: number) => void;
103
+ readonly workerdb_subscribe: (a: number, b: number) => void;
104
+ readonly __wasm_bindgen_func_elem_4053: (a: number, b: number, c: number, d: number) => void;
105
+ readonly __wasm_bindgen_func_elem_4065: (a: number, b: number, c: number, d: number) => void;
106
+ readonly __wbindgen_export: (a: number, b: number) => number;
107
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
108
+ readonly __wbindgen_export3: (a: number) => void;
109
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
110
+ readonly __wbindgen_export5: (a: number, b: number) => void;
111
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
107
112
  }
108
113
 
109
114
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -57,16 +57,62 @@ export class WorkerDb {
57
57
  let deferred2_0;
58
58
  let deferred2_1;
59
59
  try {
60
- const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
60
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
61
+ const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
61
62
  const len0 = WASM_VECTOR_LEN;
62
- const ret = wasm.workerdb_analytics(this.__wbg_ptr, ptr0, len0);
63
- deferred2_0 = ret[0];
64
- deferred2_1 = ret[1];
65
- return getStringFromWasm0(ret[0], ret[1]);
63
+ wasm.workerdb_analytics(retptr, this.__wbg_ptr, ptr0, len0);
64
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
65
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
66
+ deferred2_0 = r0;
67
+ deferred2_1 = r1;
68
+ return getStringFromWasm0(r0, r1);
66
69
  } finally {
67
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
70
+ wasm.__wbindgen_add_to_stack_pointer(16);
71
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
68
72
  }
69
73
  }
74
+ /**
75
+ * Initialize the database and open (or create) the OPFS storage file.
76
+ *
77
+ * Called from JavaScript as:
78
+ * `const db = await WorkerDb.create("click_analytics_db", 50000, "my-secret-key")`
79
+ *
80
+ * A named static factory function is used instead of an async constructor
81
+ * because `#[wasm_bindgen(constructor)]` with `async fn` produces invalid
82
+ * TypeScript bindings and is deprecated in wasm-bindgen.
83
+ *
84
+ * `async` because opening the OPFS file handle is an async browser API.
85
+ * Returns `Result<WorkerDb, JsValue>` โ€” on error, the JsValue becomes a
86
+ * JavaScript exception that the worker's try/catch can handle.
87
+ *
88
+ * # Arguments
89
+ * * `db_name` โ€” The name of the OPFS file to open (e.g. "click_analytics_db").
90
+ * Each unique name is a separate database file in the browser's OPFS storage.
91
+ * * `hot_threshold` โ€” Optional maximum documents per collection to keep in RAM (default: 50,000).
92
+ * * `encryption_key` โ€” Optional password for at-rest encryption.
93
+ * * `write_mode` โ€” Optional write mode: "async" (default) or "sync".
94
+ * * `rate_limit_requests` โ€” Optional max requests per window (default: 100).
95
+ * * `rate_limit_window` โ€” Optional window size in seconds (default: 60).
96
+ * * `max_body_size` โ€” Optional maximum request body size in bytes (default: 10MB).
97
+ * @param {string} db_name
98
+ * @param {number | null} [hot_threshold]
99
+ * @param {string | null} [encryption_key]
100
+ * @param {string | null} [write_mode]
101
+ * @param {number | null} [rate_limit_requests]
102
+ * @param {bigint | null} [rate_limit_window]
103
+ * @param {number | null} [max_body_size]
104
+ * @returns {Promise<WorkerDb>}
105
+ */
106
+ static create(db_name, hot_threshold, encryption_key, write_mode, rate_limit_requests, rate_limit_window, max_body_size) {
107
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
108
+ const len0 = WASM_VECTOR_LEN;
109
+ var ptr1 = isLikeNone(encryption_key) ? 0 : passStringToWasm0(encryption_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
110
+ var len1 = WASM_VECTOR_LEN;
111
+ var ptr2 = isLikeNone(write_mode) ? 0 : passStringToWasm0(write_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
112
+ var len2 = WASM_VECTOR_LEN;
113
+ const ret = wasm.workerdb_create(ptr0, len0, isLikeNone(hot_threshold) ? 0x100000001 : (hot_threshold) >>> 0, ptr1, len1, ptr2, len2, isLikeNone(rate_limit_requests) ? 0x100000001 : (rate_limit_requests) >>> 0, !isLikeNone(rate_limit_window), isLikeNone(rate_limit_window) ? BigInt(0) : rate_limit_window, isLikeNone(max_body_size) ? 0x100000001 : (max_body_size) >>> 0);
114
+ return takeObject(ret);
115
+ }
70
116
  /**
71
117
  * Route an incoming message from the JavaScript worker to the correct handler.
72
118
  *
@@ -89,35 +135,19 @@ export class WorkerDb {
89
135
  * @returns {any}
90
136
  */
91
137
  handle_message(data) {
92
- const ret = wasm.workerdb_handle_message(this.__wbg_ptr, data);
93
- if (ret[2]) {
94
- throw takeFromExternrefTable0(ret[1]);
138
+ try {
139
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
140
+ wasm.workerdb_handle_message(retptr, this.__wbg_ptr, addHeapObject(data));
141
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
142
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
143
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
144
+ if (r2) {
145
+ throw takeObject(r1);
146
+ }
147
+ return takeObject(r0);
148
+ } finally {
149
+ wasm.__wbindgen_add_to_stack_pointer(16);
95
150
  }
96
- return takeFromExternrefTable0(ret[0]);
97
- }
98
- /**
99
- * Initialize the database and open (or create) the OPFS storage file.
100
- *
101
- * This is the constructor โ€” called from JavaScript as:
102
- * `const db = await new WorkerDb("click_analytics_db")`
103
- *
104
- * `#[wasm_bindgen(constructor)]` tells wasm-bindgen that this function
105
- * is the JavaScript `new WorkerDb(...)` constructor.
106
- *
107
- * `async` because opening the OPFS file handle is an async browser API.
108
- * Returns `Result<WorkerDb, JsValue>` โ€” on error, the JsValue becomes a
109
- * JavaScript exception that the worker's try/catch can handle.
110
- *
111
- * # Arguments
112
- * * `db_name` โ€” The name of the OPFS file to open (e.g. "click_analytics_db").
113
- * Each unique name is a separate database file in the browser's OPFS storage.
114
- * @param {string} db_name
115
- */
116
- constructor(db_name) {
117
- const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
- const len0 = WASM_VECTOR_LEN;
119
- const ret = wasm.workerdb_new(ptr0, len0);
120
- return ret;
121
151
  }
122
152
  /**
123
153
  * Subscribe to real-time database changes.
@@ -126,121 +156,124 @@ export class WorkerDb {
126
156
  * @param {Function} callback
127
157
  */
128
158
  subscribe(callback) {
129
- wasm.workerdb_subscribe(this.__wbg_ptr, callback);
159
+ wasm.workerdb_subscribe(this.__wbg_ptr, addHeapObject(callback));
130
160
  }
131
161
  }
132
162
  if (Symbol.dispose) WorkerDb.prototype[Symbol.dispose] = WorkerDb.prototype.free;
133
-
134
163
  function __wbg_get_imports() {
135
164
  const import0 = {
136
165
  __proto__: null,
137
- __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
166
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
138
167
  const ret = Error(getStringFromWasm0(arg0, arg1));
139
- return ret;
168
+ return addHeapObject(ret);
140
169
  },
141
170
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
142
- const ret = String(arg1);
143
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
+ const ret = String(getObject(arg1));
172
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
144
173
  const len1 = WASM_VECTOR_LEN;
145
174
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
146
175
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
147
176
  },
148
- __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
149
- const v = arg1;
177
+ __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
178
+ const v = getObject(arg1);
150
179
  const ret = typeof(v) === 'bigint' ? v : undefined;
151
180
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
152
181
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
153
182
  },
154
- __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
155
- const v = arg0;
183
+ __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
184
+ const v = getObject(arg0);
156
185
  const ret = typeof(v) === 'boolean' ? v : undefined;
157
186
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
158
187
  },
159
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
160
- const ret = debugString(arg1);
161
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
188
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
189
+ const ret = debugString(getObject(arg1));
190
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
191
  const len1 = WASM_VECTOR_LEN;
163
192
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
164
193
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
165
194
  },
166
- __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
167
- const ret = arg0 in arg1;
195
+ __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
196
+ const ret = getObject(arg0) in getObject(arg1);
168
197
  return ret;
169
198
  },
170
- __wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
171
- const ret = typeof(arg0) === 'bigint';
199
+ __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
200
+ const ret = typeof(getObject(arg0)) === 'bigint';
172
201
  return ret;
173
202
  },
174
- __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
175
- const ret = typeof(arg0) === 'function';
203
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
204
+ const ret = typeof(getObject(arg0)) === 'function';
176
205
  return ret;
177
206
  },
178
- __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
179
- const val = arg0;
207
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
208
+ const val = getObject(arg0);
180
209
  const ret = typeof(val) === 'object' && val !== null;
181
210
  return ret;
182
211
  },
183
- __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
184
- const ret = typeof(arg0) === 'string';
212
+ __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
213
+ const ret = typeof(getObject(arg0)) === 'string';
185
214
  return ret;
186
215
  },
187
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
188
- const ret = arg0 === undefined;
216
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
217
+ const ret = getObject(arg0) === undefined;
189
218
  return ret;
190
219
  },
191
- __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
192
- const ret = arg0 === arg1;
220
+ __wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
221
+ const ret = getObject(arg0) === getObject(arg1);
193
222
  return ret;
194
223
  },
195
- __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
196
- const ret = arg0 == arg1;
224
+ __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
225
+ const ret = getObject(arg0) == getObject(arg1);
197
226
  return ret;
198
227
  },
199
- __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
200
- const obj = arg1;
228
+ __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
229
+ const obj = getObject(arg1);
201
230
  const ret = typeof(obj) === 'number' ? obj : undefined;
202
231
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
203
232
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
204
233
  },
205
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
206
- const obj = arg1;
234
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
235
+ const obj = getObject(arg1);
207
236
  const ret = typeof(obj) === 'string' ? obj : undefined;
208
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
237
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
209
238
  var len1 = WASM_VECTOR_LEN;
210
239
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
211
240
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
212
241
  },
213
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
242
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
214
243
  throw new Error(getStringFromWasm0(arg0, arg1));
215
244
  },
216
- __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
217
- arg0._wbg_cb_unref();
245
+ __wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
246
+ getObject(arg0)._wbg_cb_unref();
218
247
  },
219
- __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
220
- const ret = arg0.call(arg1, arg2);
221
- return ret;
248
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
249
+ const ret = getObject(arg0).call(getObject(arg1));
250
+ return addHeapObject(ret);
222
251
  }, arguments); },
223
- __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
224
- const ret = arg0.call(arg1);
225
- return ret;
252
+ __wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
253
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
254
+ return addHeapObject(ret);
226
255
  }, arguments); },
227
- __wbg_close_bea86eef0f71dd9b: function(arg0) {
228
- arg0.close();
256
+ __wbg_close_89514f591ad64f3a: function(arg0) {
257
+ getObject(arg0).close();
229
258
  },
230
- __wbg_createSyncAccessHandle_b7143219a305a2ce: function(arg0) {
231
- const ret = arg0.createSyncAccessHandle();
232
- return ret;
259
+ __wbg_createSyncAccessHandle_211f4b5a229b77e0: function(arg0) {
260
+ const ret = getObject(arg0).createSyncAccessHandle();
261
+ return addHeapObject(ret);
233
262
  },
234
- __wbg_done_08ce71ee07e3bd17: function(arg0) {
235
- const ret = arg0.done;
236
- return ret;
263
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
264
+ const ret = getObject(arg0).crypto;
265
+ return addHeapObject(ret);
237
266
  },
238
- __wbg_entries_e8a20ff8c9757101: function(arg0) {
239
- const ret = Object.entries(arg0);
267
+ __wbg_done_9158f7cc8751ba32: function(arg0) {
268
+ const ret = getObject(arg0).done;
240
269
  return ret;
241
270
  },
242
- __wbg_error_8d9a8e04cd1d3588: function(arg0) {
243
- console.error(arg0);
271
+ __wbg_entries_e0b73aa8571ddb56: function(arg0) {
272
+ const ret = Object.entries(getObject(arg0));
273
+ return addHeapObject(ret);
274
+ },
275
+ __wbg_error_2001591ad2463697: function(arg0) {
276
+ console.error(getObject(arg0));
244
277
  },
245
278
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
246
279
  let deferred0_0;
@@ -250,285 +283,322 @@ function __wbg_get_imports() {
250
283
  deferred0_1 = arg1;
251
284
  console.error(getStringFromWasm0(arg0, arg1));
252
285
  } finally {
253
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
286
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
254
287
  }
255
288
  },
256
- __wbg_flush_1eca046e0ff7c399: function() { return handleError(function (arg0) {
257
- arg0.flush();
289
+ __wbg_flush_1e50544011308045: function() { return handleError(function (arg0) {
290
+ getObject(arg0).flush();
258
291
  }, arguments); },
259
- __wbg_getDirectory_2406d369de179ff0: function(arg0) {
260
- const ret = arg0.getDirectory();
261
- return ret;
292
+ __wbg_getDirectory_3b3e1fae9108e816: function(arg0) {
293
+ const ret = getObject(arg0).getDirectory();
294
+ return addHeapObject(ret);
262
295
  },
263
- __wbg_getFileHandle_b85805519dc63efa: function(arg0, arg1, arg2, arg3) {
264
- const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
265
- return ret;
296
+ __wbg_getFileHandle_c70a158776f61068: function(arg0, arg1, arg2, arg3) {
297
+ const ret = getObject(arg0).getFileHandle(getStringFromWasm0(arg1, arg2), getObject(arg3));
298
+ return addHeapObject(ret);
266
299
  },
267
- __wbg_getRandomValues_a1cf2e70b003a59d: function() { return handleError(function (arg0, arg1) {
300
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
301
+ getObject(arg0).getRandomValues(getObject(arg1));
302
+ }, arguments); },
303
+ __wbg_getRandomValues_ef12552bf5acd2fe: function() { return handleError(function (arg0, arg1) {
268
304
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
269
305
  }, arguments); },
270
- __wbg_getSize_0a16c5e2524d34aa: function() { return handleError(function (arg0) {
271
- const ret = arg0.getSize();
306
+ __wbg_getSize_9f496dd0386d6839: function() { return handleError(function (arg0) {
307
+ const ret = getObject(arg0).getSize();
272
308
  return ret;
273
309
  }, arguments); },
274
- __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
275
- const ret = Reflect.get(arg0, arg1);
276
- return ret;
310
+ __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
311
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
312
+ return addHeapObject(ret);
277
313
  }, arguments); },
278
- __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
279
- const ret = arg0[arg1 >>> 0];
280
- return ret;
314
+ __wbg_get_8360291721e2339f: function(arg0, arg1) {
315
+ const ret = getObject(arg0)[arg1 >>> 0];
316
+ return addHeapObject(ret);
281
317
  },
282
- __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
283
- const ret = arg0[arg1 >>> 0];
284
- return ret;
318
+ __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
319
+ const ret = getObject(arg0)[arg1 >>> 0];
320
+ return addHeapObject(ret);
285
321
  },
286
- __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
322
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
287
323
  let result;
288
324
  try {
289
- result = arg0 instanceof ArrayBuffer;
325
+ result = getObject(arg0) instanceof ArrayBuffer;
290
326
  } catch (_) {
291
327
  result = false;
292
328
  }
293
329
  const ret = result;
294
330
  return ret;
295
331
  },
296
- __wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
332
+ __wbg_instanceof_Map_1b76fd4635be43eb: function(arg0) {
297
333
  let result;
298
334
  try {
299
- result = arg0 instanceof Map;
335
+ result = getObject(arg0) instanceof Map;
300
336
  } catch (_) {
301
337
  result = false;
302
338
  }
303
339
  const ret = result;
304
340
  return ret;
305
341
  },
306
- __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
342
+ __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
307
343
  let result;
308
344
  try {
309
- result = arg0 instanceof Uint8Array;
345
+ result = getObject(arg0) instanceof Uint8Array;
310
346
  } catch (_) {
311
347
  result = false;
312
348
  }
313
349
  const ret = result;
314
350
  return ret;
315
351
  },
316
- __wbg_instanceof_WorkerGlobalScope_de6976d00cb213c6: function(arg0) {
352
+ __wbg_instanceof_WorkerGlobalScope_47026c798529a771: function(arg0) {
317
353
  let result;
318
354
  try {
319
- result = arg0 instanceof WorkerGlobalScope;
355
+ result = getObject(arg0) instanceof WorkerGlobalScope;
320
356
  } catch (_) {
321
357
  result = false;
322
358
  }
323
359
  const ret = result;
324
360
  return ret;
325
361
  },
326
- __wbg_isArray_33b91feb269ff46e: function(arg0) {
327
- const ret = Array.isArray(arg0);
362
+ __wbg_isArray_c3109d14ffc06469: function(arg0) {
363
+ const ret = Array.isArray(getObject(arg0));
328
364
  return ret;
329
365
  },
330
- __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
331
- const ret = Number.isSafeInteger(arg0);
366
+ __wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
367
+ const ret = Number.isSafeInteger(getObject(arg0));
332
368
  return ret;
333
369
  },
334
- __wbg_iterator_d8f549ec8fb061b1: function() {
370
+ __wbg_iterator_013bc09ec998c2a7: function() {
335
371
  const ret = Symbol.iterator;
336
- return ret;
372
+ return addHeapObject(ret);
337
373
  },
338
- __wbg_length_b3416cf66a5452c8: function(arg0) {
339
- const ret = arg0.length;
374
+ __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
375
+ const ret = getObject(arg0).length;
340
376
  return ret;
341
377
  },
342
- __wbg_length_ea16607d7b61445b: function(arg0) {
343
- const ret = arg0.length;
378
+ __wbg_length_9f1775224cf1d815: function(arg0) {
379
+ const ret = getObject(arg0).length;
344
380
  return ret;
345
381
  },
346
- __wbg_log_524eedafa26daa59: function(arg0) {
347
- console.log(arg0);
382
+ __wbg_log_7e1aa9064a1dbdbd: function(arg0) {
383
+ console.log(getObject(arg0));
348
384
  },
349
- __wbg_navigator_583ffd4fc14c0f7a: function(arg0) {
350
- const ret = arg0.navigator;
351
- return ret;
385
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
386
+ const ret = getObject(arg0).msCrypto;
387
+ return addHeapObject(ret);
388
+ },
389
+ __wbg_navigator_353318de944ca7f6: function(arg0) {
390
+ const ret = getObject(arg0).navigator;
391
+ return addHeapObject(ret);
392
+ },
393
+ __wbg_new_0c7403db6e782f19: function(arg0) {
394
+ const ret = new Uint8Array(getObject(arg0));
395
+ return addHeapObject(ret);
352
396
  },
353
397
  __wbg_new_227d7c05414eb861: function() {
354
398
  const ret = new Error();
355
- return ret;
399
+ return addHeapObject(ret);
356
400
  },
357
- __wbg_new_49d5571bd3f0c4d4: function() {
401
+ __wbg_new_34d45cc8e36aaead: function() {
358
402
  const ret = new Map();
359
- return ret;
403
+ return addHeapObject(ret);
360
404
  },
361
- __wbg_new_5f486cdf45a04d78: function(arg0) {
362
- const ret = new Uint8Array(arg0);
363
- return ret;
364
- },
365
- __wbg_new_a70fbab9066b301f: function() {
405
+ __wbg_new_682678e2f47e32bc: function() {
366
406
  const ret = new Array();
367
- return ret;
407
+ return addHeapObject(ret);
368
408
  },
369
- __wbg_new_ab79df5bd7c26067: function() {
409
+ __wbg_new_aa8d0fa9762c29bd: function() {
370
410
  const ret = new Object();
371
- return ret;
411
+ return addHeapObject(ret);
372
412
  },
373
- __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
413
+ __wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
374
414
  try {
375
415
  var state0 = {a: arg0, b: arg1};
376
416
  var cb0 = (arg0, arg1) => {
377
417
  const a = state0.a;
378
418
  state0.a = 0;
379
419
  try {
380
- return wasm_bindgen__convert__closures_____invoke__h23a1582ccafe3e3c(a, state0.b, arg0, arg1);
420
+ return __wasm_bindgen_func_elem_4065(a, state0.b, arg0, arg1);
381
421
  } finally {
382
422
  state0.a = a;
383
423
  }
384
424
  };
385
425
  const ret = new Promise(cb0);
386
- return ret;
426
+ return addHeapObject(ret);
387
427
  } finally {
388
- state0.a = state0.b = 0;
428
+ state0.a = 0;
389
429
  }
390
430
  },
391
- __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
392
- const ret = arg0.next();
393
- return ret;
431
+ __wbg_new_with_length_8c854e41ea4dae9b: function(arg0) {
432
+ const ret = new Uint8Array(arg0 >>> 0);
433
+ return addHeapObject(ret);
434
+ },
435
+ __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
436
+ const ret = getObject(arg0).next();
437
+ return addHeapObject(ret);
394
438
  }, arguments); },
395
- __wbg_next_e01a967809d1aa68: function(arg0) {
396
- const ret = arg0.next;
397
- return ret;
439
+ __wbg_next_7646edaa39458ef7: function(arg0) {
440
+ const ret = getObject(arg0).next;
441
+ return addHeapObject(ret);
398
442
  },
399
- __wbg_now_16f0c993d5dd6c27: function() {
400
- const ret = Date.now();
401
- return ret;
443
+ __wbg_node_84ea875411254db1: function(arg0) {
444
+ const ret = getObject(arg0).node;
445
+ return addHeapObject(ret);
402
446
  },
403
- __wbg_now_ad1121946ba97ea0: function() { return handleError(function () {
447
+ __wbg_now_0cce8c6798af1870: function() { return handleError(function () {
404
448
  const ret = Date.now();
405
449
  return ret;
406
450
  }, arguments); },
451
+ __wbg_now_a9b7df1cbee90986: function() {
452
+ const ret = Date.now();
453
+ return ret;
454
+ },
407
455
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
408
- const ret = arg0.now();
456
+ const ret = getObject(arg0).now();
409
457
  return ret;
410
458
  },
411
459
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
412
- const ret = arg0.performance;
413
- return ret;
460
+ const ret = getObject(arg0).performance;
461
+ return addHeapObject(ret);
414
462
  },
415
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
416
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
463
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
464
+ const ret = getObject(arg0).process;
465
+ return addHeapObject(ret);
417
466
  },
418
- __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
419
- const ret = arg0.queueMicrotask;
420
- return ret;
467
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
468
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
421
469
  },
422
- __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
423
- queueMicrotask(arg0);
470
+ __wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
471
+ queueMicrotask(getObject(arg0));
424
472
  },
425
- __wbg_read_0285869b4fd131af: function() { return handleError(function (arg0, arg1, arg2, arg3) {
426
- const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
427
- return ret;
473
+ __wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
474
+ const ret = getObject(arg0).queueMicrotask;
475
+ return addHeapObject(ret);
476
+ },
477
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
478
+ getObject(arg0).randomFillSync(takeObject(arg1));
428
479
  }, arguments); },
429
- __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
430
- const ret = Promise.resolve(arg0);
480
+ __wbg_read_55aa7bd0271fb8d7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
481
+ const ret = getObject(arg0).read(getArrayU8FromWasm0(arg1, arg2), getObject(arg3));
431
482
  return ret;
483
+ }, arguments); },
484
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
485
+ const ret = module.require;
486
+ return addHeapObject(ret);
487
+ }, arguments); },
488
+ __wbg_resolve_e6c466bc1052f16c: function(arg0) {
489
+ const ret = Promise.resolve(getObject(arg0));
490
+ return addHeapObject(ret);
432
491
  },
433
- __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
434
- arg0[arg1 >>> 0] = arg2;
492
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
493
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
435
494
  },
436
495
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
437
- arg0[arg1] = arg2;
496
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
438
497
  },
439
- __wbg_set_at_e227be75df7f9abf: function(arg0, arg1) {
440
- arg0.at = arg1;
498
+ __wbg_set_at_741e1ca8118d2e76: function(arg0, arg1) {
499
+ getObject(arg0).at = arg1;
441
500
  },
442
- __wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
443
- const ret = arg0.set(arg1, arg2);
444
- return ret;
501
+ __wbg_set_create_6b7aba35286e014a: function(arg0, arg1) {
502
+ getObject(arg0).create = arg1 !== 0;
445
503
  },
446
- __wbg_set_create_ef897736206a6f05: function(arg0, arg1) {
447
- arg0.create = arg1 !== 0;
504
+ __wbg_set_fde2cec06c23692b: function(arg0, arg1, arg2) {
505
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
506
+ return addHeapObject(ret);
448
507
  },
449
508
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
450
- const ret = arg1.stack;
451
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
509
+ const ret = getObject(arg1).stack;
510
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
452
511
  const len1 = WASM_VECTOR_LEN;
453
512
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
454
513
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
455
514
  },
456
- __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
515
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
457
516
  const ret = typeof global === 'undefined' ? null : global;
458
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
517
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
459
518
  },
460
- __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
519
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
461
520
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
462
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
521
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
463
522
  },
464
- __wbg_static_accessor_SELF_f207c857566db248: function() {
523
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
465
524
  const ret = typeof self === 'undefined' ? null : self;
466
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
525
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
467
526
  },
468
- __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
527
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
469
528
  const ret = typeof window === 'undefined' ? null : window;
470
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
529
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
471
530
  },
472
- __wbg_storage_8d917976d6753ee0: function(arg0) {
473
- const ret = arg0.storage;
474
- return ret;
531
+ __wbg_storage_eecab26eeb654cf9: function(arg0) {
532
+ const ret = getObject(arg0).storage;
533
+ return addHeapObject(ret);
475
534
  },
476
- __wbg_then_098abe61755d12f6: function(arg0, arg1) {
477
- const ret = arg0.then(arg1);
478
- return ret;
535
+ __wbg_subarray_f8ca46a25b1f5e0d: function(arg0, arg1, arg2) {
536
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
537
+ return addHeapObject(ret);
479
538
  },
480
- __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
481
- const ret = arg0.then(arg1, arg2);
482
- return ret;
539
+ __wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
540
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
541
+ return addHeapObject(ret);
542
+ },
543
+ __wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
544
+ const ret = getObject(arg0).then(getObject(arg1));
545
+ return addHeapObject(ret);
483
546
  },
484
- __wbg_truncate_af8ac1613ab66393: function() { return handleError(function (arg0, arg1) {
485
- arg0.truncate(arg1);
547
+ __wbg_truncate_9ce7bc1afc8c7cbe: function() { return handleError(function (arg0, arg1) {
548
+ getObject(arg0).truncate(arg1);
486
549
  }, arguments); },
487
- __wbg_value_21fc78aab0322612: function(arg0) {
488
- const ret = arg0.value;
489
- return ret;
550
+ __wbg_value_ee3a06f4579184fa: function(arg0) {
551
+ const ret = getObject(arg0).value;
552
+ return addHeapObject(ret);
553
+ },
554
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
555
+ const ret = getObject(arg0).versions;
556
+ return addHeapObject(ret);
490
557
  },
491
558
  __wbg_workerdb_new: function(arg0) {
492
559
  const ret = WorkerDb.__wrap(arg0);
493
- return ret;
560
+ return addHeapObject(ret);
494
561
  },
495
- __wbg_write_57c477a82b886339: function() { return handleError(function (arg0, arg1, arg2, arg3) {
496
- const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
562
+ __wbg_write_bf048d2298276d16: function() { return handleError(function (arg0, arg1, arg2, arg3) {
563
+ const ret = getObject(arg0).write(getArrayU8FromWasm0(arg1, arg2), getObject(arg3));
497
564
  return ret;
498
565
  }, arguments); },
499
566
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
500
- // Cast intrinsic for `Closure(Closure { dtor_idx: 779, function: Function { arguments: [Externref], shim_idx: 780, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
501
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hd467cd5df2070873, wasm_bindgen__convert__closures_____invoke__hfcbb4037b8cae583);
502
- return ret;
567
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 733, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
568
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4053);
569
+ return addHeapObject(ret);
503
570
  },
504
571
  __wbindgen_cast_0000000000000002: function(arg0) {
505
572
  // Cast intrinsic for `F64 -> Externref`.
506
573
  const ret = arg0;
507
- return ret;
574
+ return addHeapObject(ret);
508
575
  },
509
576
  __wbindgen_cast_0000000000000003: function(arg0) {
510
577
  // Cast intrinsic for `I64 -> Externref`.
511
578
  const ret = arg0;
512
- return ret;
579
+ return addHeapObject(ret);
513
580
  },
514
581
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
582
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
583
+ const ret = getArrayU8FromWasm0(arg0, arg1);
584
+ return addHeapObject(ret);
585
+ },
586
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
515
587
  // Cast intrinsic for `Ref(String) -> Externref`.
516
588
  const ret = getStringFromWasm0(arg0, arg1);
517
- return ret;
589
+ return addHeapObject(ret);
518
590
  },
519
- __wbindgen_cast_0000000000000005: function(arg0) {
591
+ __wbindgen_cast_0000000000000006: function(arg0) {
520
592
  // Cast intrinsic for `U64 -> Externref`.
521
593
  const ret = BigInt.asUintN(64, arg0);
522
- return ret;
594
+ return addHeapObject(ret);
595
+ },
596
+ __wbindgen_object_clone_ref: function(arg0) {
597
+ const ret = getObject(arg0);
598
+ return addHeapObject(ret);
523
599
  },
524
- __wbindgen_init_externref_table: function() {
525
- const table = wasm.__wbindgen_externrefs;
526
- const offset = table.grow(4);
527
- table.set(0, undefined);
528
- table.set(offset + 0, undefined);
529
- table.set(offset + 1, null);
530
- table.set(offset + 2, true);
531
- table.set(offset + 3, false);
600
+ __wbindgen_object_drop_ref: function(arg0) {
601
+ takeObject(arg0);
532
602
  },
533
603
  };
534
604
  return {
@@ -537,30 +607,40 @@ function __wbg_get_imports() {
537
607
  };
538
608
  }
539
609
 
540
- function wasm_bindgen__convert__closures_____invoke__hfcbb4037b8cae583(arg0, arg1, arg2) {
541
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfcbb4037b8cae583(arg0, arg1, arg2);
542
- if (ret[1]) {
543
- throw takeFromExternrefTable0(ret[0]);
610
+ function __wasm_bindgen_func_elem_4053(arg0, arg1, arg2) {
611
+ try {
612
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
613
+ wasm.__wasm_bindgen_func_elem_4053(retptr, arg0, arg1, addHeapObject(arg2));
614
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
615
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
616
+ if (r1) {
617
+ throw takeObject(r0);
618
+ }
619
+ } finally {
620
+ wasm.__wbindgen_add_to_stack_pointer(16);
544
621
  }
545
622
  }
546
623
 
547
- function wasm_bindgen__convert__closures_____invoke__h23a1582ccafe3e3c(arg0, arg1, arg2, arg3) {
548
- wasm.wasm_bindgen__convert__closures_____invoke__h23a1582ccafe3e3c(arg0, arg1, arg2, arg3);
624
+ function __wasm_bindgen_func_elem_4065(arg0, arg1, arg2, arg3) {
625
+ wasm.__wasm_bindgen_func_elem_4065(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
549
626
  }
550
627
 
551
628
  const WorkerDbFinalization = (typeof FinalizationRegistry === 'undefined')
552
629
  ? { register: () => {}, unregister: () => {} }
553
630
  : new FinalizationRegistry(ptr => wasm.__wbg_workerdb_free(ptr >>> 0, 1));
554
631
 
555
- function addToExternrefTable0(obj) {
556
- const idx = wasm.__externref_table_alloc();
557
- wasm.__wbindgen_externrefs.set(idx, obj);
632
+ function addHeapObject(obj) {
633
+ if (heap_next === heap.length) heap.push(heap.length + 1);
634
+ const idx = heap_next;
635
+ heap_next = heap[idx];
636
+
637
+ heap[idx] = obj;
558
638
  return idx;
559
639
  }
560
640
 
561
641
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
562
642
  ? { register: () => {}, unregister: () => {} }
563
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
643
+ : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
564
644
 
565
645
  function debugString(val) {
566
646
  // primitive types
@@ -627,6 +707,12 @@ function debugString(val) {
627
707
  return className;
628
708
  }
629
709
 
710
+ function dropObject(idx) {
711
+ if (idx < 1028) return;
712
+ heap[idx] = heap_next;
713
+ heap_next = idx;
714
+ }
715
+
630
716
  function getArrayU8FromWasm0(ptr, len) {
631
717
  ptr = ptr >>> 0;
632
718
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -653,21 +739,27 @@ function getUint8ArrayMemory0() {
653
739
  return cachedUint8ArrayMemory0;
654
740
  }
655
741
 
742
+ function getObject(idx) { return heap[idx]; }
743
+
656
744
  function handleError(f, args) {
657
745
  try {
658
746
  return f.apply(this, args);
659
747
  } catch (e) {
660
- const idx = addToExternrefTable0(e);
661
- wasm.__wbindgen_exn_store(idx);
748
+ wasm.__wbindgen_export3(addHeapObject(e));
662
749
  }
663
750
  }
664
751
 
752
+ let heap = new Array(1024).fill(undefined);
753
+ heap.push(undefined, null, true, false);
754
+
755
+ let heap_next = heap.length;
756
+
665
757
  function isLikeNone(x) {
666
758
  return x === undefined || x === null;
667
759
  }
668
760
 
669
- function makeMutClosure(arg0, arg1, dtor, f) {
670
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
761
+ function makeMutClosure(arg0, arg1, f) {
762
+ const state = { a: arg0, b: arg1, cnt: 1 };
671
763
  const real = (...args) => {
672
764
 
673
765
  // First up with a closure we increment the internal reference
@@ -685,7 +777,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
685
777
  };
686
778
  real._wbg_cb_unref = () => {
687
779
  if (--state.cnt === 0) {
688
- state.dtor(state.a, state.b);
780
+ wasm.__wbindgen_export5(state.a, state.b);
689
781
  state.a = 0;
690
782
  CLOSURE_DTORS.unregister(state);
691
783
  }
@@ -731,10 +823,10 @@ function passStringToWasm0(arg, malloc, realloc) {
731
823
  return ptr;
732
824
  }
733
825
 
734
- function takeFromExternrefTable0(idx) {
735
- const value = wasm.__wbindgen_externrefs.get(idx);
736
- wasm.__externref_table_dealloc(idx);
737
- return value;
826
+ function takeObject(idx) {
827
+ const ret = getObject(idx);
828
+ dropObject(idx);
829
+ return ret;
738
830
  }
739
831
 
740
832
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -772,7 +864,6 @@ function __wbg_finalize_init(instance, module) {
772
864
  wasmModule = module;
773
865
  cachedDataViewMemory0 = null;
774
866
  cachedUint8ArrayMemory0 = null;
775
- wasm.__wbindgen_start();
776
867
  return wasm;
777
868
  }
778
869
 
Binary file
@@ -2,18 +2,15 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_workerdb_free: (a: number, b: number) => void;
5
- export const workerdb_analytics: (a: number, b: number, c: number) => [number, number];
6
- export const workerdb_handle_message: (a: number, b: any) => [number, number, number];
7
- export const workerdb_new: (a: number, b: number) => any;
8
- export const workerdb_subscribe: (a: number, b: any) => void;
9
- export const wasm_bindgen__closure__destroy__hd467cd5df2070873: (a: number, b: number) => void;
10
- export const wasm_bindgen__convert__closures_____invoke__hfcbb4037b8cae583: (a: number, b: number, c: any) => [number, number];
11
- export const wasm_bindgen__convert__closures_____invoke__h23a1582ccafe3e3c: (a: number, b: number, c: any, d: any) => void;
12
- export const __wbindgen_malloc: (a: number, b: number) => number;
13
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
14
- export const __wbindgen_exn_store: (a: number) => void;
15
- export const __externref_table_alloc: () => number;
16
- export const __wbindgen_externrefs: WebAssembly.Table;
17
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
18
- export const __externref_table_dealloc: (a: number) => void;
19
- export const __wbindgen_start: () => void;
5
+ export const workerdb_analytics: (a: number, b: number, c: number, d: number) => void;
6
+ export const workerdb_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint, k: number) => number;
7
+ export const workerdb_handle_message: (a: number, b: number, c: number) => void;
8
+ export const workerdb_subscribe: (a: number, b: number) => void;
9
+ export const __wasm_bindgen_func_elem_4053: (a: number, b: number, c: number, d: number) => void;
10
+ export const __wasm_bindgen_func_elem_4065: (a: number, b: number, c: number, d: number) => void;
11
+ export const __wbindgen_export: (a: number, b: number) => number;
12
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
13
+ export const __wbindgen_export3: (a: number) => void;
14
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
15
+ export const __wbindgen_export5: (a: number, b: number) => void;
16
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltendb-web/core",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "MoltenDb WASM runtime โ€” the database engine, Web Worker, and main-thread client in one package.",
5
5
  "type": "module",
6
6
  "author": "Maximilian Both <maximilian.both27@outlook.com>",