rvlite 0.2.3 → 0.2.5

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.
@@ -1,318 +1,160 @@
1
- let wasm;
1
+ /* @ts-self-types="./rvlite.d.ts" */
2
2
 
3
- function addHeapObject(obj) {
4
- if (heap_next === heap.length) heap.push(heap.length + 1);
5
- const idx = heap_next;
6
- heap_next = heap[idx];
7
-
8
- heap[idx] = obj;
9
- return idx;
10
- }
11
-
12
- function _assertClass(instance, klass) {
13
- if (!(instance instanceof klass)) {
14
- throw new Error(`expected instance of ${klass.name}`);
15
- }
16
- }
17
-
18
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
19
- ? { register: () => {}, unregister: () => {} }
20
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
21
-
22
- function debugString(val) {
23
- // primitive types
24
- const type = typeof val;
25
- if (type == 'number' || type == 'boolean' || val == null) {
26
- return `${val}`;
27
- }
28
- if (type == 'string') {
29
- return `"${val}"`;
3
+ /**
4
+ * WASM-compatible Cypher engine
5
+ */
6
+ export class CypherEngine {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ CypherEngineFinalization.unregister(this);
11
+ return ptr;
30
12
  }
31
- if (type == 'symbol') {
32
- const description = val.description;
33
- if (description == null) {
34
- return 'Symbol';
35
- } else {
36
- return `Symbol(${description})`;
37
- }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_cypherengine_free(ptr, 0);
38
16
  }
39
- if (type == 'function') {
40
- const name = val.name;
41
- if (typeof name == 'string' && name.length > 0) {
42
- return `Function(${name})`;
43
- } else {
44
- return 'Function';
45
- }
17
+ /**
18
+ * Clear the graph
19
+ */
20
+ clear() {
21
+ wasm.cypherengine_clear(this.__wbg_ptr);
46
22
  }
47
- // objects
48
- if (Array.isArray(val)) {
49
- const length = val.length;
50
- let debug = '[';
51
- if (length > 0) {
52
- debug += debugString(val[0]);
53
- }
54
- for(let i = 1; i < length; i++) {
55
- debug += ', ' + debugString(val[i]);
23
+ /**
24
+ * Execute a Cypher query and return JSON results
25
+ * @param {string} query
26
+ * @returns {any}
27
+ */
28
+ execute(query) {
29
+ try {
30
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
31
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
32
+ const len0 = WASM_VECTOR_LEN;
33
+ wasm.cypherengine_execute(retptr, this.__wbg_ptr, ptr0, len0);
34
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
35
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
36
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
37
+ if (r2) {
38
+ throw takeObject(r1);
39
+ }
40
+ return takeObject(r0);
41
+ } finally {
42
+ wasm.__wbindgen_add_to_stack_pointer(16);
56
43
  }
57
- debug += ']';
58
- return debug;
59
44
  }
60
- // Test for built-in
61
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
62
- let className;
63
- if (builtInMatches && builtInMatches.length > 1) {
64
- className = builtInMatches[1];
65
- } else {
66
- // Failed to match the standard '[object ClassName]'
67
- return toString.call(val);
45
+ /**
46
+ * Create a new Cypher engine with empty graph
47
+ */
48
+ constructor() {
49
+ const ret = wasm.cypherengine_new();
50
+ this.__wbg_ptr = ret >>> 0;
51
+ CypherEngineFinalization.register(this, this.__wbg_ptr, this);
52
+ return this;
68
53
  }
69
- if (className == 'Object') {
70
- // we're a user defined class or Object
71
- // JSON.stringify avoids problems with cycles, and is generally much
72
- // easier than looping through ownProperties of `val`.
54
+ /**
55
+ * Get graph statistics
56
+ * @returns {any}
57
+ */
58
+ stats() {
73
59
  try {
74
- return 'Object(' + JSON.stringify(val) + ')';
75
- } catch (_) {
76
- return 'Object';
60
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
61
+ wasm.cypherengine_stats(retptr, this.__wbg_ptr);
62
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
63
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
64
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
65
+ if (r2) {
66
+ throw takeObject(r1);
67
+ }
68
+ return takeObject(r0);
69
+ } finally {
70
+ wasm.__wbindgen_add_to_stack_pointer(16);
77
71
  }
78
72
  }
79
- // errors
80
- if (val instanceof Error) {
81
- return `${val.name}: ${val.message}\n${val.stack}`;
82
- }
83
- // TODO we could test for more things here, like `Set`s and `Map`s.
84
- return className;
85
- }
86
-
87
- function dropObject(idx) {
88
- if (idx < 132) return;
89
- heap[idx] = heap_next;
90
- heap_next = idx;
91
- }
92
-
93
- function getArrayU8FromWasm0(ptr, len) {
94
- ptr = ptr >>> 0;
95
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
96
- }
97
-
98
- let cachedDataViewMemory0 = null;
99
- function getDataViewMemory0() {
100
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
101
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
102
- }
103
- return cachedDataViewMemory0;
104
73
  }
74
+ if (Symbol.dispose) CypherEngine.prototype[Symbol.dispose] = CypherEngine.prototype.free;
105
75
 
106
- let cachedFloat32ArrayMemory0 = null;
107
- function getFloat32ArrayMemory0() {
108
- if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
109
- cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
76
+ /**
77
+ * Main RvLite database
78
+ */
79
+ export class RvLite {
80
+ static __wrap(ptr) {
81
+ ptr = ptr >>> 0;
82
+ const obj = Object.create(RvLite.prototype);
83
+ obj.__wbg_ptr = ptr;
84
+ RvLiteFinalization.register(obj, obj.__wbg_ptr, obj);
85
+ return obj;
110
86
  }
111
- return cachedFloat32ArrayMemory0;
112
- }
113
-
114
- function getStringFromWasm0(ptr, len) {
115
- ptr = ptr >>> 0;
116
- return decodeText(ptr, len);
117
- }
118
-
119
- let cachedUint8ArrayMemory0 = null;
120
- function getUint8ArrayMemory0() {
121
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
122
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
87
+ __destroy_into_raw() {
88
+ const ptr = this.__wbg_ptr;
89
+ this.__wbg_ptr = 0;
90
+ RvLiteFinalization.unregister(this);
91
+ return ptr;
123
92
  }
124
- return cachedUint8ArrayMemory0;
125
- }
126
-
127
- function getObject(idx) { return heap[idx]; }
128
-
129
- function handleError(f, args) {
130
- try {
131
- return f.apply(this, args);
132
- } catch (e) {
133
- wasm.__wbindgen_export3(addHeapObject(e));
93
+ free() {
94
+ const ptr = this.__destroy_into_raw();
95
+ wasm.__wbg_rvlite_free(ptr, 0);
134
96
  }
135
- }
136
-
137
- let heap = new Array(128).fill(undefined);
138
- heap.push(undefined, null, true, false);
139
-
140
- let heap_next = heap.length;
141
-
142
- function isLikeNone(x) {
143
- return x === undefined || x === null;
144
- }
145
-
146
- function makeMutClosure(arg0, arg1, dtor, f) {
147
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
148
- const real = (...args) => {
149
-
150
- // First up with a closure we increment the internal reference
151
- // count. This ensures that the Rust closure environment won't
152
- // be deallocated while we're invoking it.
153
- state.cnt++;
154
- const a = state.a;
155
- state.a = 0;
97
+ /**
98
+ * Add an RDF triple
99
+ *
100
+ * # Arguments
101
+ * * `subject` - Subject IRI or blank node (e.g., "<http://example.org/s>" or "_:b1")
102
+ * * `predicate` - Predicate IRI (e.g., "<http://example.org/p>")
103
+ * * `object` - Object IRI, blank node, or literal (e.g., "<http://example.org/o>" or '"value"')
104
+ * @param {string} subject
105
+ * @param {string} predicate
106
+ * @param {string} object
107
+ */
108
+ add_triple(subject, predicate, object) {
156
109
  try {
157
- return f(a, state.b, ...args);
110
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
111
+ const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
112
+ const len0 = WASM_VECTOR_LEN;
113
+ const ptr1 = passStringToWasm0(predicate, wasm.__wbindgen_export, wasm.__wbindgen_export2);
114
+ const len1 = WASM_VECTOR_LEN;
115
+ const ptr2 = passStringToWasm0(object, wasm.__wbindgen_export, wasm.__wbindgen_export2);
116
+ const len2 = WASM_VECTOR_LEN;
117
+ wasm.rvlite_add_triple(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
118
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
119
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
120
+ if (r1) {
121
+ throw takeObject(r0);
122
+ }
158
123
  } finally {
159
- state.a = a;
160
- real._wbg_cb_unref();
161
- }
162
- };
163
- real._wbg_cb_unref = () => {
164
- if (--state.cnt === 0) {
165
- state.dtor(state.a, state.b);
166
- state.a = 0;
167
- CLOSURE_DTORS.unregister(state);
124
+ wasm.__wbindgen_add_to_stack_pointer(16);
168
125
  }
169
- };
170
- CLOSURE_DTORS.register(real, state, state);
171
- return real;
172
- }
173
-
174
- function passArrayF32ToWasm0(arg, malloc) {
175
- const ptr = malloc(arg.length * 4, 4) >>> 0;
176
- getFloat32ArrayMemory0().set(arg, ptr / 4);
177
- WASM_VECTOR_LEN = arg.length;
178
- return ptr;
179
- }
180
-
181
- function passStringToWasm0(arg, malloc, realloc) {
182
- if (realloc === undefined) {
183
- const buf = cachedTextEncoder.encode(arg);
184
- const ptr = malloc(buf.length, 1) >>> 0;
185
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
186
- WASM_VECTOR_LEN = buf.length;
187
- return ptr;
188
- }
189
-
190
- let len = arg.length;
191
- let ptr = malloc(len, 1) >>> 0;
192
-
193
- const mem = getUint8ArrayMemory0();
194
-
195
- let offset = 0;
196
-
197
- for (; offset < len; offset++) {
198
- const code = arg.charCodeAt(offset);
199
- if (code > 0x7F) break;
200
- mem[ptr + offset] = code;
201
- }
202
- if (offset !== len) {
203
- if (offset !== 0) {
204
- arg = arg.slice(offset);
205
- }
206
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
207
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
208
- const ret = cachedTextEncoder.encodeInto(arg, view);
209
-
210
- offset += ret.written;
211
- ptr = realloc(ptr, len, offset, 1) >>> 0;
212
- }
213
-
214
- WASM_VECTOR_LEN = offset;
215
- return ptr;
216
- }
217
-
218
- function takeObject(idx) {
219
- const ret = getObject(idx);
220
- dropObject(idx);
221
- return ret;
222
- }
223
-
224
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
225
- cachedTextDecoder.decode();
226
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
227
- let numBytesDecoded = 0;
228
- function decodeText(ptr, len) {
229
- numBytesDecoded += len;
230
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
231
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
232
- cachedTextDecoder.decode();
233
- numBytesDecoded = len;
234
- }
235
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
236
- }
237
-
238
- const cachedTextEncoder = new TextEncoder();
239
-
240
- if (!('encodeInto' in cachedTextEncoder)) {
241
- cachedTextEncoder.encodeInto = function (arg, view) {
242
- const buf = cachedTextEncoder.encode(arg);
243
- view.set(buf);
244
- return {
245
- read: arg.length,
246
- written: buf.length
247
- };
248
- }
249
- }
250
-
251
- let WASM_VECTOR_LEN = 0;
252
-
253
- function __wasm_bindgen_func_elem_1339(arg0, arg1, arg2) {
254
- wasm.__wasm_bindgen_func_elem_1339(arg0, arg1, addHeapObject(arg2));
255
- }
256
-
257
- function __wasm_bindgen_func_elem_180(arg0, arg1, arg2) {
258
- wasm.__wasm_bindgen_func_elem_180(arg0, arg1, addHeapObject(arg2));
259
- }
260
-
261
- function __wasm_bindgen_func_elem_1385(arg0, arg1, arg2, arg3) {
262
- wasm.__wasm_bindgen_func_elem_1385(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
263
- }
264
-
265
- const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
266
-
267
- const CypherEngineFinalization = (typeof FinalizationRegistry === 'undefined')
268
- ? { register: () => {}, unregister: () => {} }
269
- : new FinalizationRegistry(ptr => wasm.__wbg_cypherengine_free(ptr >>> 0, 1));
270
-
271
- const RvLiteFinalization = (typeof FinalizationRegistry === 'undefined')
272
- ? { register: () => {}, unregister: () => {} }
273
- : new FinalizationRegistry(ptr => wasm.__wbg_rvlite_free(ptr >>> 0, 1));
274
-
275
- const RvLiteConfigFinalization = (typeof FinalizationRegistry === 'undefined')
276
- ? { register: () => {}, unregister: () => {} }
277
- : new FinalizationRegistry(ptr => wasm.__wbg_rvliteconfig_free(ptr >>> 0, 1));
278
-
279
- /**
280
- * WASM-compatible Cypher engine
281
- */
282
- export class CypherEngine {
283
- __destroy_into_raw() {
284
- const ptr = this.__wbg_ptr;
285
- this.__wbg_ptr = 0;
286
- CypherEngineFinalization.unregister(this);
287
- return ptr;
288
- }
289
- free() {
290
- const ptr = this.__destroy_into_raw();
291
- wasm.__wbg_cypherengine_free(ptr, 0);
292
126
  }
293
127
  /**
294
- * Create a new Cypher engine with empty graph
128
+ * Clear saved state from IndexedDB
129
+ * @returns {Promise<any>}
295
130
  */
296
- constructor() {
297
- const ret = wasm.cypherengine_new();
298
- this.__wbg_ptr = ret >>> 0;
299
- CypherEngineFinalization.register(this, this.__wbg_ptr, this);
300
- return this;
131
+ static clear_storage() {
132
+ const ret = wasm.rvlite_clear_storage();
133
+ return takeObject(ret);
301
134
  }
302
135
  /**
303
- * Clear the graph
136
+ * Clear all triples
304
137
  */
305
- clear() {
306
- wasm.cypherengine_clear(this.__wbg_ptr);
138
+ clear_triples() {
139
+ wasm.rvlite_clear_triples(this.__wbg_ptr);
307
140
  }
308
141
  /**
309
- * Get graph statistics
142
+ * Execute Cypher query
143
+ *
144
+ * Supported operations:
145
+ * - CREATE (n:Label {prop: value})
146
+ * - MATCH (n:Label) WHERE n.prop = value RETURN n
147
+ * - CREATE (a)-[r:REL]->(b)
148
+ * - DELETE n
149
+ * @param {string} query
310
150
  * @returns {any}
311
151
  */
312
- stats() {
152
+ cypher(query) {
313
153
  try {
314
154
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
315
- wasm.cypherengine_stats(retptr, this.__wbg_ptr);
155
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
156
+ const len0 = WASM_VECTOR_LEN;
157
+ wasm.rvlite_cypher(retptr, this.__wbg_ptr, ptr0, len0);
316
158
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
317
159
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
318
160
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -325,16 +167,19 @@ export class CypherEngine {
325
167
  }
326
168
  }
327
169
  /**
328
- * Execute a Cypher query and return JSON results
329
- * @param {string} query
170
+ * Clear the Cypher graph
171
+ */
172
+ cypher_clear() {
173
+ wasm.rvlite_cypher_clear(this.__wbg_ptr);
174
+ }
175
+ /**
176
+ * Get Cypher graph statistics
330
177
  * @returns {any}
331
178
  */
332
- execute(query) {
179
+ cypher_stats() {
333
180
  try {
334
181
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
336
- const len0 = WASM_VECTOR_LEN;
337
- wasm.cypherengine_execute(retptr, this.__wbg_ptr, ptr0, len0);
182
+ wasm.rvlite_cypher_stats(retptr, this.__wbg_ptr);
338
183
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
339
184
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
340
185
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -346,75 +191,43 @@ export class CypherEngine {
346
191
  wasm.__wbindgen_add_to_stack_pointer(16);
347
192
  }
348
193
  }
349
- }
350
- if (Symbol.dispose) CypherEngine.prototype[Symbol.dispose] = CypherEngine.prototype.free;
351
-
352
- /**
353
- * Main RvLite database
354
- */
355
- export class RvLite {
356
- static __wrap(ptr) {
357
- ptr = ptr >>> 0;
358
- const obj = Object.create(RvLite.prototype);
359
- obj.__wbg_ptr = ptr;
360
- RvLiteFinalization.register(obj, obj.__wbg_ptr, obj);
361
- return obj;
362
- }
363
- __destroy_into_raw() {
364
- const ptr = this.__wbg_ptr;
365
- this.__wbg_ptr = 0;
366
- RvLiteFinalization.unregister(this);
367
- return ptr;
368
- }
369
- free() {
370
- const ptr = this.__destroy_into_raw();
371
- wasm.__wbg_rvlite_free(ptr, 0);
372
- }
373
194
  /**
374
- * Add an RDF triple
375
- *
376
- * # Arguments
377
- * * `subject` - Subject IRI or blank node (e.g., "<http://example.org/s>" or "_:b1")
378
- * * `predicate` - Predicate IRI (e.g., "<http://example.org/p>")
379
- * * `object` - Object IRI, blank node, or literal (e.g., "<http://example.org/o>" or '"value"')
380
- * @param {string} subject
381
- * @param {string} predicate
382
- * @param {string} object
195
+ * Create with default configuration (384 dimensions, cosine similarity)
196
+ * @returns {RvLite}
383
197
  */
384
- add_triple(subject, predicate, object) {
198
+ static default() {
385
199
  try {
386
200
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
388
- const len0 = WASM_VECTOR_LEN;
389
- const ptr1 = passStringToWasm0(predicate, wasm.__wbindgen_export, wasm.__wbindgen_export2);
390
- const len1 = WASM_VECTOR_LEN;
391
- const ptr2 = passStringToWasm0(object, wasm.__wbindgen_export, wasm.__wbindgen_export2);
392
- const len2 = WASM_VECTOR_LEN;
393
- wasm.rvlite_add_triple(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
201
+ wasm.rvlite_default(retptr);
394
202
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
395
203
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
396
- if (r1) {
397
- throw takeObject(r0);
204
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
205
+ if (r2) {
206
+ throw takeObject(r1);
398
207
  }
208
+ return RvLite.__wrap(r0);
399
209
  } finally {
400
210
  wasm.__wbindgen_add_to_stack_pointer(16);
401
211
  }
402
212
  }
403
213
  /**
404
- * Get configuration
405
- * @returns {any}
214
+ * Delete a vector by ID
215
+ * @param {string} id
216
+ * @returns {boolean}
406
217
  */
407
- get_config() {
218
+ delete(id) {
408
219
  try {
409
220
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
410
- wasm.rvlite_get_config(retptr, this.__wbg_ptr);
221
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
222
+ const len0 = WASM_VECTOR_LEN;
223
+ wasm.rvlite_delete(retptr, this.__wbg_ptr, ptr0, len0);
411
224
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
412
225
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
413
226
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
414
227
  if (r2) {
415
228
  throw takeObject(r1);
416
229
  }
417
- return takeObject(r0);
230
+ return r0 !== 0;
418
231
  } finally {
419
232
  wasm.__wbindgen_add_to_stack_pointer(16);
420
233
  }
@@ -439,56 +252,54 @@ export class RvLite {
439
252
  }
440
253
  }
441
254
  /**
442
- * Get version string
443
- * @returns {string}
255
+ * Get a vector by ID
256
+ * @param {string} id
257
+ * @returns {any}
444
258
  */
445
- get_version() {
446
- let deferred1_0;
447
- let deferred1_1;
259
+ get(id) {
448
260
  try {
449
261
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
450
- wasm.rvlite_get_version(retptr, this.__wbg_ptr);
262
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
263
+ const len0 = WASM_VECTOR_LEN;
264
+ wasm.rvlite_get(retptr, this.__wbg_ptr, ptr0, len0);
451
265
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
452
266
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
453
- deferred1_0 = r0;
454
- deferred1_1 = r1;
455
- return getStringFromWasm0(r0, r1);
267
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
268
+ if (r2) {
269
+ throw takeObject(r1);
270
+ }
271
+ return takeObject(r0);
456
272
  } finally {
457
273
  wasm.__wbindgen_add_to_stack_pointer(16);
458
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
459
274
  }
460
275
  }
461
276
  /**
462
- * Import database state from JSON
463
- * @param {any} json
277
+ * Get configuration
278
+ * @returns {any}
464
279
  */
465
- import_json(json) {
280
+ get_config() {
466
281
  try {
467
282
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
468
- wasm.rvlite_import_json(retptr, this.__wbg_ptr, addHeapObject(json));
283
+ wasm.rvlite_get_config(retptr, this.__wbg_ptr);
469
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
470
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
471
- if (r1) {
472
- throw takeObject(r0);
286
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
287
+ if (r2) {
288
+ throw takeObject(r1);
473
289
  }
290
+ return takeObject(r0);
474
291
  } finally {
475
292
  wasm.__wbindgen_add_to_stack_pointer(16);
476
293
  }
477
294
  }
478
295
  /**
479
- * Clear the Cypher graph
480
- */
481
- cypher_clear() {
482
- wasm.rvlite_cypher_clear(this.__wbg_ptr);
483
- }
484
- /**
485
- * Get Cypher graph statistics
296
+ * Get enabled features
486
297
  * @returns {any}
487
298
  */
488
- cypher_stats() {
299
+ get_features() {
489
300
  try {
490
301
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
491
- wasm.rvlite_cypher_stats(retptr, this.__wbg_ptr);
302
+ wasm.rvlite_get_features(retptr, this.__wbg_ptr);
492
303
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
493
304
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
494
305
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -501,54 +312,91 @@ export class RvLite {
501
312
  }
502
313
  }
503
314
  /**
504
- * Get enabled features
505
- * @returns {any}
315
+ * Get version string
316
+ * @returns {string}
506
317
  */
507
- get_features() {
318
+ get_version() {
319
+ let deferred1_0;
320
+ let deferred1_1;
508
321
  try {
509
322
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
510
- wasm.rvlite_get_features(retptr, this.__wbg_ptr);
323
+ wasm.rvlite_get_version(retptr, this.__wbg_ptr);
511
324
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
512
325
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
513
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
514
- if (r2) {
515
- throw takeObject(r1);
516
- }
517
- return takeObject(r0);
326
+ deferred1_0 = r0;
327
+ deferred1_1 = r1;
328
+ return getStringFromWasm0(r0, r1);
518
329
  } finally {
519
330
  wasm.__wbindgen_add_to_stack_pointer(16);
331
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
520
332
  }
521
333
  }
522
334
  /**
523
- * Initialize IndexedDB storage for persistence
524
- * Must be called before save() or load()
335
+ * Check if saved state exists in IndexedDB
525
336
  * @returns {Promise<any>}
526
337
  */
527
- init_storage() {
528
- const ret = wasm.rvlite_init_storage(this.__wbg_ptr);
338
+ static has_saved_state() {
339
+ const ret = wasm.rvlite_has_saved_state();
529
340
  return takeObject(ret);
530
341
  }
531
342
  /**
532
- * Get the number of triples in the store
533
- * @returns {number}
343
+ * Import database state from JSON
344
+ * @param {any} json
534
345
  */
535
- triple_count() {
536
- const ret = wasm.rvlite_triple_count(this.__wbg_ptr);
537
- return ret >>> 0;
346
+ import_json(json) {
347
+ try {
348
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
349
+ wasm.rvlite_import_json(retptr, this.__wbg_ptr, addHeapObject(json));
350
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
351
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
352
+ if (r1) {
353
+ throw takeObject(r0);
354
+ }
355
+ } finally {
356
+ wasm.__wbindgen_add_to_stack_pointer(16);
357
+ }
538
358
  }
539
359
  /**
540
- * Clear saved state from IndexedDB
360
+ * Initialize IndexedDB storage for persistence
361
+ * Must be called before save() or load()
541
362
  * @returns {Promise<any>}
542
363
  */
543
- static clear_storage() {
544
- const ret = wasm.rvlite_clear_storage();
364
+ init_storage() {
365
+ const ret = wasm.rvlite_init_storage(this.__wbg_ptr);
545
366
  return takeObject(ret);
546
367
  }
547
368
  /**
548
- * Clear all triples
369
+ * Insert a vector with optional metadata
370
+ * Returns the vector ID
371
+ * @param {Float32Array} vector
372
+ * @param {any} metadata
373
+ * @returns {string}
549
374
  */
550
- clear_triples() {
551
- wasm.rvlite_clear_triples(this.__wbg_ptr);
375
+ insert(vector, metadata) {
376
+ let deferred3_0;
377
+ let deferred3_1;
378
+ try {
379
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
380
+ const ptr0 = passArrayF32ToWasm0(vector, wasm.__wbindgen_export);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ wasm.rvlite_insert(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(metadata));
383
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
384
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
385
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
386
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
387
+ var ptr2 = r0;
388
+ var len2 = r1;
389
+ if (r3) {
390
+ ptr2 = 0; len2 = 0;
391
+ throw takeObject(r2);
392
+ }
393
+ deferred3_0 = ptr2;
394
+ deferred3_1 = len2;
395
+ return getStringFromWasm0(ptr2, len2);
396
+ } finally {
397
+ wasm.__wbindgen_add_to_stack_pointer(16);
398
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
399
+ }
552
400
  }
553
401
  /**
554
402
  * Insert a vector with a specific ID
@@ -574,66 +422,39 @@ export class RvLite {
574
422
  }
575
423
  }
576
424
  /**
577
- * Check if saved state exists in IndexedDB
578
- * @returns {Promise<any>}
579
- */
580
- static has_saved_state() {
581
- const ret = wasm.rvlite_has_saved_state();
582
- return takeObject(ret);
583
- }
584
- /**
585
- * Search with metadata filter
586
- * @param {Float32Array} query_vector
587
- * @param {number} k
588
- * @param {any} filter
589
- * @returns {any}
425
+ * Check if database is empty
426
+ * @returns {boolean}
590
427
  */
591
- search_with_filter(query_vector, k, filter) {
428
+ is_empty() {
592
429
  try {
593
430
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
594
- const ptr0 = passArrayF32ToWasm0(query_vector, wasm.__wbindgen_export);
595
- const len0 = WASM_VECTOR_LEN;
596
- wasm.rvlite_search_with_filter(retptr, this.__wbg_ptr, ptr0, len0, k, addHeapObject(filter));
431
+ wasm.rvlite_is_empty(retptr, this.__wbg_ptr);
597
432
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
598
433
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
599
434
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
600
435
  if (r2) {
601
436
  throw takeObject(r1);
602
437
  }
603
- return takeObject(r0);
438
+ return r0 !== 0;
604
439
  } finally {
605
440
  wasm.__wbindgen_add_to_stack_pointer(16);
606
441
  }
607
442
  }
608
443
  /**
609
- * Check if IndexedDB is available in the browser
444
+ * Check if database is ready
610
445
  * @returns {boolean}
611
446
  */
612
- static is_storage_available() {
613
- const ret = wasm.rvlite_is_storage_available();
447
+ is_ready() {
448
+ const ret = wasm.rvlite_is_ready(this.__wbg_ptr);
614
449
  return ret !== 0;
615
450
  }
616
451
  /**
617
- * Get a vector by ID
618
- * @param {string} id
619
- * @returns {any}
452
+ * Check if IndexedDB is available in the browser
453
+ * @returns {boolean}
620
454
  */
621
- get(id) {
622
- try {
623
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
624
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
625
- const len0 = WASM_VECTOR_LEN;
626
- wasm.rvlite_get(retptr, this.__wbg_ptr, ptr0, len0);
627
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
628
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
629
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
630
- if (r2) {
631
- throw takeObject(r1);
632
- }
633
- return takeObject(r0);
634
- } finally {
635
- wasm.__wbindgen_add_to_stack_pointer(16);
636
- }
455
+ static is_storage_available() {
456
+ const ret = wasm.rvlite_is_storage_available();
457
+ return ret !== 0;
637
458
  }
638
459
  /**
639
460
  * Get the number of vectors in the database
@@ -654,6 +475,18 @@ export class RvLite {
654
475
  wasm.__wbindgen_add_to_stack_pointer(16);
655
476
  }
656
477
  }
478
+ /**
479
+ * Load database from IndexedDB
480
+ * Returns a Promise<RvLite> with the restored database
481
+ * @param {RvLiteConfig} config
482
+ * @returns {Promise<any>}
483
+ */
484
+ static load(config) {
485
+ _assertClass(config, RvLiteConfig);
486
+ var ptr0 = config.__destroy_into_raw();
487
+ const ret = wasm.rvlite_load(ptr0);
488
+ return takeObject(ret);
489
+ }
657
490
  /**
658
491
  * Create a new RvLite database
659
492
  * @param {RvLiteConfig} config
@@ -678,23 +511,26 @@ export class RvLite {
678
511
  }
679
512
  }
680
513
  /**
681
- * Execute SQL query
682
- *
683
- * Supported syntax:
684
- * - CREATE TABLE vectors (id TEXT PRIMARY KEY, vector VECTOR(384))
685
- * - SELECT * FROM vectors WHERE id = 'x'
686
- * - SELECT id, vector <-> '[...]' AS distance FROM vectors ORDER BY distance LIMIT 10
687
- * - INSERT INTO vectors (id, vector) VALUES ('x', '[...]')
688
- * - DELETE FROM vectors WHERE id = 'x'
689
- * @param {string} query
514
+ * Save database state to IndexedDB
515
+ * Returns a Promise that resolves when save is complete
516
+ * @returns {Promise<any>}
517
+ */
518
+ save() {
519
+ const ret = wasm.rvlite_save(this.__wbg_ptr);
520
+ return takeObject(ret);
521
+ }
522
+ /**
523
+ * Search for similar vectors
524
+ * @param {Float32Array} query_vector
525
+ * @param {number} k
690
526
  * @returns {any}
691
527
  */
692
- sql(query) {
528
+ search(query_vector, k) {
693
529
  try {
694
530
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
695
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
531
+ const ptr0 = passArrayF32ToWasm0(query_vector, wasm.__wbindgen_export);
696
532
  const len0 = WASM_VECTOR_LEN;
697
- wasm.rvlite_sql(retptr, this.__wbg_ptr, ptr0, len0);
533
+ wasm.rvlite_search(retptr, this.__wbg_ptr, ptr0, len0, k);
698
534
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
699
535
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
700
536
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -707,43 +543,18 @@ export class RvLite {
707
543
  }
708
544
  }
709
545
  /**
710
- * Load database from IndexedDB
711
- * Returns a Promise<RvLite> with the restored database
712
- * @param {RvLiteConfig} config
713
- * @returns {Promise<any>}
714
- */
715
- static load(config) {
716
- _assertClass(config, RvLiteConfig);
717
- var ptr0 = config.__destroy_into_raw();
718
- const ret = wasm.rvlite_load(ptr0);
719
- return takeObject(ret);
720
- }
721
- /**
722
- * Save database state to IndexedDB
723
- * Returns a Promise that resolves when save is complete
724
- * @returns {Promise<any>}
725
- */
726
- save() {
727
- const ret = wasm.rvlite_save(this.__wbg_ptr);
728
- return takeObject(ret);
729
- }
730
- /**
731
- * Execute Cypher query
732
- *
733
- * Supported operations:
734
- * - CREATE (n:Label {prop: value})
735
- * - MATCH (n:Label) WHERE n.prop = value RETURN n
736
- * - CREATE (a)-[r:REL]->(b)
737
- * - DELETE n
738
- * @param {string} query
546
+ * Search with metadata filter
547
+ * @param {Float32Array} query_vector
548
+ * @param {number} k
549
+ * @param {any} filter
739
550
  * @returns {any}
740
551
  */
741
- cypher(query) {
552
+ search_with_filter(query_vector, k, filter) {
742
553
  try {
743
554
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
744
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
555
+ const ptr0 = passArrayF32ToWasm0(query_vector, wasm.__wbindgen_export);
745
556
  const len0 = WASM_VECTOR_LEN;
746
- wasm.rvlite_cypher(retptr, this.__wbg_ptr, ptr0, len0);
557
+ wasm.rvlite_search_with_filter(retptr, this.__wbg_ptr, ptr0, len0, k, addHeapObject(filter));
747
558
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
748
559
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
749
560
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -756,99 +567,50 @@ export class RvLite {
756
567
  }
757
568
  }
758
569
  /**
759
- * Delete a vector by ID
760
- * @param {string} id
761
- * @returns {boolean}
570
+ * Execute SPARQL query
571
+ *
572
+ * Supported operations:
573
+ * - SELECT ?s ?p ?o WHERE { ?s ?p ?o }
574
+ * - SELECT ?s WHERE { ?s <predicate> ?o }
575
+ * - ASK { ?s ?p ?o }
576
+ * @param {string} query
577
+ * @returns {any}
762
578
  */
763
- delete(id) {
579
+ sparql(query) {
764
580
  try {
765
581
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
766
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
582
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
767
583
  const len0 = WASM_VECTOR_LEN;
768
- wasm.rvlite_delete(retptr, this.__wbg_ptr, ptr0, len0);
584
+ wasm.rvlite_sparql(retptr, this.__wbg_ptr, ptr0, len0);
769
585
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
770
586
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
771
587
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
772
588
  if (r2) {
773
589
  throw takeObject(r1);
774
590
  }
775
- return r0 !== 0;
591
+ return takeObject(r0);
776
592
  } finally {
777
593
  wasm.__wbindgen_add_to_stack_pointer(16);
778
594
  }
779
595
  }
780
596
  /**
781
- * Insert a vector with optional metadata
782
- * Returns the vector ID
783
- * @param {Float32Array} vector
784
- * @param {any} metadata
785
- * @returns {string}
786
- */
787
- insert(vector, metadata) {
788
- let deferred3_0;
789
- let deferred3_1;
790
- try {
791
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
792
- const ptr0 = passArrayF32ToWasm0(vector, wasm.__wbindgen_export);
793
- const len0 = WASM_VECTOR_LEN;
794
- wasm.rvlite_insert(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(metadata));
795
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
796
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
797
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
798
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
799
- var ptr2 = r0;
800
- var len2 = r1;
801
- if (r3) {
802
- ptr2 = 0; len2 = 0;
803
- throw takeObject(r2);
804
- }
805
- deferred3_0 = ptr2;
806
- deferred3_1 = len2;
807
- return getStringFromWasm0(ptr2, len2);
808
- } finally {
809
- wasm.__wbindgen_add_to_stack_pointer(16);
810
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
811
- }
812
- }
813
- /**
814
- * Search for similar vectors
815
- * @param {Float32Array} query_vector
816
- * @param {number} k
817
- * @returns {any}
818
- */
819
- search(query_vector, k) {
820
- try {
821
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
822
- const ptr0 = passArrayF32ToWasm0(query_vector, wasm.__wbindgen_export);
823
- const len0 = WASM_VECTOR_LEN;
824
- wasm.rvlite_search(retptr, this.__wbg_ptr, ptr0, len0, k);
825
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
826
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
827
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
828
- if (r2) {
829
- throw takeObject(r1);
830
- }
831
- return takeObject(r0);
832
- } finally {
833
- wasm.__wbindgen_add_to_stack_pointer(16);
834
- }
835
- }
836
- /**
837
- * Execute SPARQL query
597
+ * Execute SQL query
838
598
  *
839
- * Supported operations:
840
- * - SELECT ?s ?p ?o WHERE { ?s ?p ?o }
841
- * - SELECT ?s WHERE { ?s <predicate> ?o }
842
- * - ASK { ?s ?p ?o }
599
+ * Supported syntax:
600
+ * - CREATE TABLE vectors (id TEXT PRIMARY KEY, vector VECTOR(384))
601
+ * - SELECT * FROM vectors WHERE id = 'x'
602
+ * - SELECT id, vector <-> '[...]' AS distance FROM vectors ORDER BY distance LIMIT 10
603
+ * - INSERT INTO vectors (id, vector) VALUES ('x', '[...]')
604
+ * - DELETE FROM vectors WHERE id = 'x'
843
605
  * @param {string} query
844
606
  * @returns {any}
845
607
  */
846
- sparql(query) {
608
+ sql(query) {
847
609
  try {
848
610
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
849
611
  const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
850
612
  const len0 = WASM_VECTOR_LEN;
851
- wasm.rvlite_sparql(retptr, this.__wbg_ptr, ptr0, len0);
613
+ wasm.rvlite_sql(retptr, this.__wbg_ptr, ptr0, len0);
852
614
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
853
615
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
854
616
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -861,132 +623,833 @@ export class RvLite {
861
623
  }
862
624
  }
863
625
  /**
864
- * Create with default configuration (384 dimensions, cosine similarity)
865
- * @returns {RvLite}
626
+ * Get the number of triples in the store
627
+ * @returns {number}
866
628
  */
867
- static default() {
868
- try {
869
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
870
- wasm.rvlite_default(retptr);
871
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
872
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
873
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
874
- if (r2) {
875
- throw takeObject(r1);
876
- }
877
- return RvLite.__wrap(r0);
878
- } finally {
879
- wasm.__wbindgen_add_to_stack_pointer(16);
880
- }
629
+ triple_count() {
630
+ const ret = wasm.rvlite_triple_count(this.__wbg_ptr);
631
+ return ret >>> 0;
632
+ }
633
+ }
634
+ if (Symbol.dispose) RvLite.prototype[Symbol.dispose] = RvLite.prototype.free;
635
+
636
+ /**
637
+ * Configuration for RvLite database
638
+ */
639
+ export class RvLiteConfig {
640
+ static __wrap(ptr) {
641
+ ptr = ptr >>> 0;
642
+ const obj = Object.create(RvLiteConfig.prototype);
643
+ obj.__wbg_ptr = ptr;
644
+ RvLiteConfigFinalization.register(obj, obj.__wbg_ptr, obj);
645
+ return obj;
646
+ }
647
+ __destroy_into_raw() {
648
+ const ptr = this.__wbg_ptr;
649
+ this.__wbg_ptr = 0;
650
+ RvLiteConfigFinalization.unregister(this);
651
+ return ptr;
652
+ }
653
+ free() {
654
+ const ptr = this.__destroy_into_raw();
655
+ wasm.__wbg_rvliteconfig_free(ptr, 0);
881
656
  }
882
657
  /**
883
- * Check if database is empty
884
- * @returns {boolean}
658
+ * Get dimensions
659
+ * @returns {number}
885
660
  */
886
- is_empty() {
661
+ get_dimensions() {
662
+ const ret = wasm.rvliteconfig_get_dimensions(this.__wbg_ptr);
663
+ return ret >>> 0;
664
+ }
665
+ /**
666
+ * Get distance metric name
667
+ * @returns {string}
668
+ */
669
+ get_distance_metric() {
670
+ let deferred1_0;
671
+ let deferred1_1;
887
672
  try {
888
673
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
889
- wasm.rvlite_is_empty(retptr, this.__wbg_ptr);
674
+ wasm.rvliteconfig_get_distance_metric(retptr, this.__wbg_ptr);
890
675
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
891
676
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
892
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
893
- if (r2) {
894
- throw takeObject(r1);
895
- }
896
- return r0 !== 0;
677
+ deferred1_0 = r0;
678
+ deferred1_1 = r1;
679
+ return getStringFromWasm0(r0, r1);
897
680
  } finally {
898
681
  wasm.__wbindgen_add_to_stack_pointer(16);
682
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
899
683
  }
900
684
  }
901
685
  /**
902
- * Check if database is ready
903
- * @returns {boolean}
686
+ * @param {number} dimensions
904
687
  */
905
- is_ready() {
906
- const ret = wasm.rvlite_is_ready(this.__wbg_ptr);
907
- return ret !== 0;
688
+ constructor(dimensions) {
689
+ const ret = wasm.rvliteconfig_new(dimensions);
690
+ this.__wbg_ptr = ret >>> 0;
691
+ RvLiteConfigFinalization.register(this, this.__wbg_ptr, this);
692
+ return this;
693
+ }
694
+ /**
695
+ * Set distance metric (euclidean, cosine, dotproduct, manhattan)
696
+ * @param {string} metric
697
+ * @returns {RvLiteConfig}
698
+ */
699
+ with_distance_metric(metric) {
700
+ const ptr = this.__destroy_into_raw();
701
+ const ptr0 = passStringToWasm0(metric, wasm.__wbindgen_export, wasm.__wbindgen_export2);
702
+ const len0 = WASM_VECTOR_LEN;
703
+ const ret = wasm.rvliteconfig_with_distance_metric(ptr, ptr0, len0);
704
+ return RvLiteConfig.__wrap(ret);
908
705
  }
909
706
  }
910
- if (Symbol.dispose) RvLite.prototype[Symbol.dispose] = RvLite.prototype.free;
707
+ if (Symbol.dispose) RvLiteConfig.prototype[Symbol.dispose] = RvLiteConfig.prototype.free;
708
+
709
+ export function init() {
710
+ wasm.init();
711
+ }
712
+
713
+ function __wbg_get_imports() {
714
+ const import0 = {
715
+ __proto__: null,
716
+ __wbg_Error_4577686b3a6d9b3a: function(arg0, arg1) {
717
+ const ret = Error(getStringFromWasm0(arg0, arg1));
718
+ return addHeapObject(ret);
719
+ },
720
+ __wbg_Number_e89e48a2fe1a6355: function(arg0) {
721
+ const ret = Number(getObject(arg0));
722
+ return ret;
723
+ },
724
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
725
+ const ret = String(getObject(arg1));
726
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
727
+ const len1 = WASM_VECTOR_LEN;
728
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
729
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
730
+ },
731
+ __wbg___wbindgen_bigint_get_as_i64_578010f8442e0319: function(arg0, arg1) {
732
+ const v = getObject(arg1);
733
+ const ret = typeof(v) === 'bigint' ? v : undefined;
734
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
735
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
736
+ },
737
+ __wbg___wbindgen_boolean_get_18c4ed9422296fff: function(arg0) {
738
+ const v = getObject(arg0);
739
+ const ret = typeof(v) === 'boolean' ? v : undefined;
740
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
741
+ },
742
+ __wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
743
+ const ret = debugString(getObject(arg1));
744
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
745
+ const len1 = WASM_VECTOR_LEN;
746
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
747
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
748
+ },
749
+ __wbg___wbindgen_in_1064a108f4d18b9e: function(arg0, arg1) {
750
+ const ret = getObject(arg0) in getObject(arg1);
751
+ return ret;
752
+ },
753
+ __wbg___wbindgen_is_bigint_a157f0734ca85901: function(arg0) {
754
+ const ret = typeof(getObject(arg0)) === 'bigint';
755
+ return ret;
756
+ },
757
+ __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
758
+ const ret = typeof(getObject(arg0)) === 'function';
759
+ return ret;
760
+ },
761
+ __wbg___wbindgen_is_null_a2a19127c13e7126: function(arg0) {
762
+ const ret = getObject(arg0) === null;
763
+ return ret;
764
+ },
765
+ __wbg___wbindgen_is_object_4b3de556756ee8a8: function(arg0) {
766
+ const val = getObject(arg0);
767
+ const ret = typeof(val) === 'object' && val !== null;
768
+ return ret;
769
+ },
770
+ __wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
771
+ const ret = typeof(getObject(arg0)) === 'string';
772
+ return ret;
773
+ },
774
+ __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
775
+ const ret = getObject(arg0) === undefined;
776
+ return ret;
777
+ },
778
+ __wbg___wbindgen_jsval_eq_a6afb59d8c5e78d6: function(arg0, arg1) {
779
+ const ret = getObject(arg0) === getObject(arg1);
780
+ return ret;
781
+ },
782
+ __wbg___wbindgen_jsval_loose_eq_1562ceb9af84e990: function(arg0, arg1) {
783
+ const ret = getObject(arg0) == getObject(arg1);
784
+ return ret;
785
+ },
786
+ __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
787
+ const obj = getObject(arg1);
788
+ const ret = typeof(obj) === 'number' ? obj : undefined;
789
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
790
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
791
+ },
792
+ __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
793
+ const obj = getObject(arg1);
794
+ const ret = typeof(obj) === 'string' ? obj : undefined;
795
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
796
+ var len1 = WASM_VECTOR_LEN;
797
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
798
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
799
+ },
800
+ __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
801
+ throw new Error(getStringFromWasm0(arg0, arg1));
802
+ },
803
+ __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
804
+ getObject(arg0)._wbg_cb_unref();
805
+ },
806
+ __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
807
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
808
+ return addHeapObject(ret);
809
+ }, arguments); },
810
+ __wbg_call_73af281463ec8b58: function() { return handleError(function (arg0, arg1) {
811
+ const ret = getObject(arg0).call(getObject(arg1));
812
+ return addHeapObject(ret);
813
+ }, arguments); },
814
+ __wbg_clear_9b50f7831893d6ec: function() { return handleError(function (arg0) {
815
+ const ret = getObject(arg0).clear();
816
+ return addHeapObject(ret);
817
+ }, arguments); },
818
+ __wbg_close_88d72cf512fed8bc: function(arg0) {
819
+ getObject(arg0).close();
820
+ },
821
+ __wbg_contains_412524090060514f: function(arg0, arg1, arg2) {
822
+ const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
823
+ return ret;
824
+ },
825
+ __wbg_count_c0709a30cd0cf55f: function() { return handleError(function (arg0, arg1) {
826
+ const ret = getObject(arg0).count(getObject(arg1));
827
+ return addHeapObject(ret);
828
+ }, arguments); },
829
+ __wbg_createObjectStore_bfd875621f13f126: function() { return handleError(function (arg0, arg1, arg2) {
830
+ const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
831
+ return addHeapObject(ret);
832
+ }, arguments); },
833
+ __wbg_done_5aad55ec6b1954b1: function(arg0) {
834
+ const ret = getObject(arg0).done;
835
+ return ret;
836
+ },
837
+ __wbg_entries_28d32ba4cd93f5fc: function(arg0) {
838
+ const ret = Object.entries(getObject(arg0));
839
+ return addHeapObject(ret);
840
+ },
841
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
842
+ let deferred0_0;
843
+ let deferred0_1;
844
+ try {
845
+ deferred0_0 = arg0;
846
+ deferred0_1 = arg1;
847
+ console.error(getStringFromWasm0(arg0, arg1));
848
+ } finally {
849
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
850
+ }
851
+ },
852
+ __wbg_get_4920fefd3451364b: function() { return handleError(function (arg0, arg1) {
853
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
854
+ return addHeapObject(ret);
855
+ }, arguments); },
856
+ __wbg_get_791b26b41a7de3d5: function() { return handleError(function (arg0, arg1) {
857
+ const ret = getObject(arg0).get(getObject(arg1));
858
+ return addHeapObject(ret);
859
+ }, arguments); },
860
+ __wbg_get_f09c3a16f8848381: function(arg0, arg1) {
861
+ const ret = getObject(arg0)[arg1 >>> 0];
862
+ return addHeapObject(ret);
863
+ },
864
+ __wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
865
+ const ret = getObject(arg0)[arg1 >>> 0];
866
+ return addHeapObject(ret);
867
+ },
868
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
869
+ const ret = getObject(arg0)[getObject(arg1)];
870
+ return addHeapObject(ret);
871
+ },
872
+ __wbg_indexedDB_f950945d950fbd5e: function() { return handleError(function (arg0) {
873
+ const ret = getObject(arg0).indexedDB;
874
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
875
+ }, arguments); },
876
+ __wbg_instanceof_ArrayBuffer_15859862b80b732d: function(arg0) {
877
+ let result;
878
+ try {
879
+ result = getObject(arg0) instanceof ArrayBuffer;
880
+ } catch (_) {
881
+ result = false;
882
+ }
883
+ const ret = result;
884
+ return ret;
885
+ },
886
+ __wbg_instanceof_Map_9df16bf25ceb4ecb: function(arg0) {
887
+ let result;
888
+ try {
889
+ result = getObject(arg0) instanceof Map;
890
+ } catch (_) {
891
+ result = false;
892
+ }
893
+ const ret = result;
894
+ return ret;
895
+ },
896
+ __wbg_instanceof_Uint8Array_2240b7046ac16f05: function(arg0) {
897
+ let result;
898
+ try {
899
+ result = getObject(arg0) instanceof Uint8Array;
900
+ } catch (_) {
901
+ result = false;
902
+ }
903
+ const ret = result;
904
+ return ret;
905
+ },
906
+ __wbg_instanceof_Window_4aba49e4d1a12365: function(arg0) {
907
+ let result;
908
+ try {
909
+ result = getObject(arg0) instanceof Window;
910
+ } catch (_) {
911
+ result = false;
912
+ }
913
+ const ret = result;
914
+ return ret;
915
+ },
916
+ __wbg_isArray_fad08a0d12828686: function(arg0) {
917
+ const ret = Array.isArray(getObject(arg0));
918
+ return ret;
919
+ },
920
+ __wbg_isSafeInteger_10e4151eb694e42a: function(arg0) {
921
+ const ret = Number.isSafeInteger(getObject(arg0));
922
+ return ret;
923
+ },
924
+ __wbg_iterator_fc7ad8d33bab9e26: function() {
925
+ const ret = Symbol.iterator;
926
+ return addHeapObject(ret);
927
+ },
928
+ __wbg_length_5855c1f289dfffc1: function(arg0) {
929
+ const ret = getObject(arg0).length;
930
+ return ret;
931
+ },
932
+ __wbg_length_a31e05262e09b7f8: function(arg0) {
933
+ const ret = getObject(arg0).length;
934
+ return ret;
935
+ },
936
+ __wbg_log_3c5e4b64af29e724: function(arg0) {
937
+ console.log(getObject(arg0));
938
+ },
939
+ __wbg_new_09959f7b4c92c246: function(arg0) {
940
+ const ret = new Uint8Array(getObject(arg0));
941
+ return addHeapObject(ret);
942
+ },
943
+ __wbg_new_227d7c05414eb861: function() {
944
+ const ret = new Error();
945
+ return addHeapObject(ret);
946
+ },
947
+ __wbg_new_79ce7968119cfd96: function(arg0, arg1) {
948
+ try {
949
+ var state0 = {a: arg0, b: arg1};
950
+ var cb0 = (arg0, arg1) => {
951
+ const a = state0.a;
952
+ state0.a = 0;
953
+ try {
954
+ return __wasm_bindgen_func_elem_1407(a, state0.b, arg0, arg1);
955
+ } finally {
956
+ state0.a = a;
957
+ }
958
+ };
959
+ const ret = new Promise(cb0);
960
+ return addHeapObject(ret);
961
+ } finally {
962
+ state0.a = state0.b = 0;
963
+ }
964
+ },
965
+ __wbg_new_92df58a8ec3bfb6b: function() {
966
+ const ret = new Map();
967
+ return addHeapObject(ret);
968
+ },
969
+ __wbg_new_cbee8c0d5c479eac: function() {
970
+ const ret = new Array();
971
+ return addHeapObject(ret);
972
+ },
973
+ __wbg_new_ed69e637b553a997: function() {
974
+ const ret = new Object();
975
+ return addHeapObject(ret);
976
+ },
977
+ __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
978
+ try {
979
+ var state0 = {a: arg0, b: arg1};
980
+ var cb0 = (arg0, arg1) => {
981
+ const a = state0.a;
982
+ state0.a = 0;
983
+ try {
984
+ return __wasm_bindgen_func_elem_1407(a, state0.b, arg0, arg1);
985
+ } finally {
986
+ state0.a = a;
987
+ }
988
+ };
989
+ const ret = new Promise(cb0);
990
+ return addHeapObject(ret);
991
+ } finally {
992
+ state0.a = state0.b = 0;
993
+ }
994
+ },
995
+ __wbg_next_a5fe6f328f7affc2: function(arg0) {
996
+ const ret = getObject(arg0).next;
997
+ return addHeapObject(ret);
998
+ },
999
+ __wbg_next_e592122bb4ed4c67: function() { return handleError(function (arg0) {
1000
+ const ret = getObject(arg0).next();
1001
+ return addHeapObject(ret);
1002
+ }, arguments); },
1003
+ __wbg_now_edd718b3004d8631: function() {
1004
+ const ret = Date.now();
1005
+ return ret;
1006
+ },
1007
+ __wbg_objectStoreNames_3645b6da2d1f3852: function(arg0) {
1008
+ const ret = getObject(arg0).objectStoreNames;
1009
+ return addHeapObject(ret);
1010
+ },
1011
+ __wbg_objectStore_3a6b969b917c6262: function() { return handleError(function (arg0, arg1, arg2) {
1012
+ const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
1013
+ return addHeapObject(ret);
1014
+ }, arguments); },
1015
+ __wbg_open_9badd3c8846fbf11: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1016
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
1017
+ return addHeapObject(ret);
1018
+ }, arguments); },
1019
+ __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
1020
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1021
+ return addHeapObject(ret);
1022
+ }, arguments); },
1023
+ __wbg_prototypesetcall_f034d444741426c3: function(arg0, arg1, arg2) {
1024
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1025
+ },
1026
+ __wbg_push_a6f9488ffd3fae3b: function(arg0, arg1) {
1027
+ const ret = getObject(arg0).push(getObject(arg1));
1028
+ return ret;
1029
+ },
1030
+ __wbg_put_d86a6833e14a4c3b: function() { return handleError(function (arg0, arg1, arg2) {
1031
+ const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
1032
+ return addHeapObject(ret);
1033
+ }, arguments); },
1034
+ __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
1035
+ const ret = getObject(arg0).queueMicrotask;
1036
+ return addHeapObject(ret);
1037
+ },
1038
+ __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
1039
+ queueMicrotask(getObject(arg0));
1040
+ },
1041
+ __wbg_resolve_5d61e0d10c14730a: function(arg0) {
1042
+ const ret = Promise.resolve(getObject(arg0));
1043
+ return addHeapObject(ret);
1044
+ },
1045
+ __wbg_result_aaba1e6bbc5d42c8: function() { return handleError(function (arg0) {
1046
+ const ret = getObject(arg0).result;
1047
+ return addHeapObject(ret);
1048
+ }, arguments); },
1049
+ __wbg_set_4c81cfb5dc3a333c: function(arg0, arg1, arg2) {
1050
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1051
+ },
1052
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1053
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1054
+ },
1055
+ __wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
1056
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1057
+ return addHeapObject(ret);
1058
+ },
1059
+ __wbg_set_onerror_8b43a0b08de76f6d: function(arg0, arg1) {
1060
+ getObject(arg0).onerror = getObject(arg1);
1061
+ },
1062
+ __wbg_set_onsuccess_76214f5146684855: function(arg0, arg1) {
1063
+ getObject(arg0).onsuccess = getObject(arg1);
1064
+ },
1065
+ __wbg_set_onupgradeneeded_74f1c8e9dbd2b70c: function(arg0, arg1) {
1066
+ getObject(arg0).onupgradeneeded = getObject(arg1);
1067
+ },
1068
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1069
+ const ret = getObject(arg1).stack;
1070
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1071
+ const len1 = WASM_VECTOR_LEN;
1072
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1073
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1074
+ },
1075
+ __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
1076
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1077
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1078
+ },
1079
+ __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
1080
+ const ret = typeof global === 'undefined' ? null : global;
1081
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1082
+ },
1083
+ __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
1084
+ const ret = typeof self === 'undefined' ? null : self;
1085
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1086
+ },
1087
+ __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
1088
+ const ret = typeof window === 'undefined' ? null : window;
1089
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1090
+ },
1091
+ __wbg_target_adcfd1353c3de078: function(arg0) {
1092
+ const ret = getObject(arg0).target;
1093
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1094
+ },
1095
+ __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
1096
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1097
+ return addHeapObject(ret);
1098
+ },
1099
+ __wbg_then_f1c954fe00733701: function(arg0, arg1) {
1100
+ const ret = getObject(arg0).then(getObject(arg1));
1101
+ return addHeapObject(ret);
1102
+ },
1103
+ __wbg_transaction_30dda0e59a945fe4: function() { return handleError(function (arg0, arg1, arg2) {
1104
+ const ret = getObject(arg0).transaction(getObject(arg1), __wbindgen_enum_IdbTransactionMode[arg2]);
1105
+ return addHeapObject(ret);
1106
+ }, arguments); },
1107
+ __wbg_transaction_f90e157c0cdb0001: function() { return handleError(function (arg0, arg1, arg2) {
1108
+ const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2));
1109
+ return addHeapObject(ret);
1110
+ }, arguments); },
1111
+ __wbg_value_667dcb90597486a6: function(arg0) {
1112
+ const ret = getObject(arg0).value;
1113
+ return addHeapObject(ret);
1114
+ },
1115
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1116
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1117
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1364, __wasm_bindgen_func_elem_1365);
1118
+ return addHeapObject(ret);
1119
+ },
1120
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1121
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8, function: Function { arguments: [NamedExternref("Event")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1122
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_191, __wasm_bindgen_func_elem_192);
1123
+ return addHeapObject(ret);
1124
+ },
1125
+ __wbindgen_cast_0000000000000003: function(arg0) {
1126
+ // Cast intrinsic for `F64 -> Externref`.
1127
+ const ret = arg0;
1128
+ return addHeapObject(ret);
1129
+ },
1130
+ __wbindgen_cast_0000000000000004: function(arg0) {
1131
+ // Cast intrinsic for `I64 -> Externref`.
1132
+ const ret = arg0;
1133
+ return addHeapObject(ret);
1134
+ },
1135
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1136
+ // Cast intrinsic for `Ref(String) -> Externref`.
1137
+ const ret = getStringFromWasm0(arg0, arg1);
1138
+ return addHeapObject(ret);
1139
+ },
1140
+ __wbindgen_cast_0000000000000006: function(arg0) {
1141
+ // Cast intrinsic for `U64 -> Externref`.
1142
+ const ret = BigInt.asUintN(64, arg0);
1143
+ return addHeapObject(ret);
1144
+ },
1145
+ __wbindgen_object_clone_ref: function(arg0) {
1146
+ const ret = getObject(arg0);
1147
+ return addHeapObject(ret);
1148
+ },
1149
+ __wbindgen_object_drop_ref: function(arg0) {
1150
+ takeObject(arg0);
1151
+ },
1152
+ };
1153
+ return {
1154
+ __proto__: null,
1155
+ "./rvlite_bg.js": import0,
1156
+ };
1157
+ }
1158
+
1159
+ function __wasm_bindgen_func_elem_192(arg0, arg1, arg2) {
1160
+ wasm.__wasm_bindgen_func_elem_192(arg0, arg1, addHeapObject(arg2));
1161
+ }
1162
+
1163
+ function __wasm_bindgen_func_elem_1365(arg0, arg1, arg2) {
1164
+ try {
1165
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1166
+ wasm.__wasm_bindgen_func_elem_1365(retptr, arg0, arg1, addHeapObject(arg2));
1167
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1168
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1169
+ if (r1) {
1170
+ throw takeObject(r0);
1171
+ }
1172
+ } finally {
1173
+ wasm.__wbindgen_add_to_stack_pointer(16);
1174
+ }
1175
+ }
1176
+
1177
+ function __wasm_bindgen_func_elem_1407(arg0, arg1, arg2, arg3) {
1178
+ wasm.__wasm_bindgen_func_elem_1407(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1179
+ }
1180
+
1181
+
1182
+ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
1183
+ const CypherEngineFinalization = (typeof FinalizationRegistry === 'undefined')
1184
+ ? { register: () => {}, unregister: () => {} }
1185
+ : new FinalizationRegistry(ptr => wasm.__wbg_cypherengine_free(ptr >>> 0, 1));
1186
+ const RvLiteFinalization = (typeof FinalizationRegistry === 'undefined')
1187
+ ? { register: () => {}, unregister: () => {} }
1188
+ : new FinalizationRegistry(ptr => wasm.__wbg_rvlite_free(ptr >>> 0, 1));
1189
+ const RvLiteConfigFinalization = (typeof FinalizationRegistry === 'undefined')
1190
+ ? { register: () => {}, unregister: () => {} }
1191
+ : new FinalizationRegistry(ptr => wasm.__wbg_rvliteconfig_free(ptr >>> 0, 1));
1192
+
1193
+ function addHeapObject(obj) {
1194
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1195
+ const idx = heap_next;
1196
+ heap_next = heap[idx];
1197
+
1198
+ heap[idx] = obj;
1199
+ return idx;
1200
+ }
1201
+
1202
+ function _assertClass(instance, klass) {
1203
+ if (!(instance instanceof klass)) {
1204
+ throw new Error(`expected instance of ${klass.name}`);
1205
+ }
1206
+ }
1207
+
1208
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1209
+ ? { register: () => {}, unregister: () => {} }
1210
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1211
+
1212
+ function debugString(val) {
1213
+ // primitive types
1214
+ const type = typeof val;
1215
+ if (type == 'number' || type == 'boolean' || val == null) {
1216
+ return `${val}`;
1217
+ }
1218
+ if (type == 'string') {
1219
+ return `"${val}"`;
1220
+ }
1221
+ if (type == 'symbol') {
1222
+ const description = val.description;
1223
+ if (description == null) {
1224
+ return 'Symbol';
1225
+ } else {
1226
+ return `Symbol(${description})`;
1227
+ }
1228
+ }
1229
+ if (type == 'function') {
1230
+ const name = val.name;
1231
+ if (typeof name == 'string' && name.length > 0) {
1232
+ return `Function(${name})`;
1233
+ } else {
1234
+ return 'Function';
1235
+ }
1236
+ }
1237
+ // objects
1238
+ if (Array.isArray(val)) {
1239
+ const length = val.length;
1240
+ let debug = '[';
1241
+ if (length > 0) {
1242
+ debug += debugString(val[0]);
1243
+ }
1244
+ for(let i = 1; i < length; i++) {
1245
+ debug += ', ' + debugString(val[i]);
1246
+ }
1247
+ debug += ']';
1248
+ return debug;
1249
+ }
1250
+ // Test for built-in
1251
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1252
+ let className;
1253
+ if (builtInMatches && builtInMatches.length > 1) {
1254
+ className = builtInMatches[1];
1255
+ } else {
1256
+ // Failed to match the standard '[object ClassName]'
1257
+ return toString.call(val);
1258
+ }
1259
+ if (className == 'Object') {
1260
+ // we're a user defined class or Object
1261
+ // JSON.stringify avoids problems with cycles, and is generally much
1262
+ // easier than looping through ownProperties of `val`.
1263
+ try {
1264
+ return 'Object(' + JSON.stringify(val) + ')';
1265
+ } catch (_) {
1266
+ return 'Object';
1267
+ }
1268
+ }
1269
+ // errors
1270
+ if (val instanceof Error) {
1271
+ return `${val.name}: ${val.message}\n${val.stack}`;
1272
+ }
1273
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1274
+ return className;
1275
+ }
1276
+
1277
+ function dropObject(idx) {
1278
+ if (idx < 1028) return;
1279
+ heap[idx] = heap_next;
1280
+ heap_next = idx;
1281
+ }
1282
+
1283
+ function getArrayU8FromWasm0(ptr, len) {
1284
+ ptr = ptr >>> 0;
1285
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1286
+ }
1287
+
1288
+ let cachedDataViewMemory0 = null;
1289
+ function getDataViewMemory0() {
1290
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1291
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1292
+ }
1293
+ return cachedDataViewMemory0;
1294
+ }
1295
+
1296
+ let cachedFloat32ArrayMemory0 = null;
1297
+ function getFloat32ArrayMemory0() {
1298
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
1299
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
1300
+ }
1301
+ return cachedFloat32ArrayMemory0;
1302
+ }
1303
+
1304
+ function getStringFromWasm0(ptr, len) {
1305
+ ptr = ptr >>> 0;
1306
+ return decodeText(ptr, len);
1307
+ }
1308
+
1309
+ let cachedUint8ArrayMemory0 = null;
1310
+ function getUint8ArrayMemory0() {
1311
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1312
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1313
+ }
1314
+ return cachedUint8ArrayMemory0;
1315
+ }
1316
+
1317
+ function getObject(idx) { return heap[idx]; }
1318
+
1319
+ function handleError(f, args) {
1320
+ try {
1321
+ return f.apply(this, args);
1322
+ } catch (e) {
1323
+ wasm.__wbindgen_export3(addHeapObject(e));
1324
+ }
1325
+ }
1326
+
1327
+ let heap = new Array(1024).fill(undefined);
1328
+ heap.push(undefined, null, true, false);
1329
+
1330
+ let heap_next = heap.length;
1331
+
1332
+ function isLikeNone(x) {
1333
+ return x === undefined || x === null;
1334
+ }
1335
+
1336
+ function makeMutClosure(arg0, arg1, dtor, f) {
1337
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1338
+ const real = (...args) => {
1339
+
1340
+ // First up with a closure we increment the internal reference
1341
+ // count. This ensures that the Rust closure environment won't
1342
+ // be deallocated while we're invoking it.
1343
+ state.cnt++;
1344
+ const a = state.a;
1345
+ state.a = 0;
1346
+ try {
1347
+ return f(a, state.b, ...args);
1348
+ } finally {
1349
+ state.a = a;
1350
+ real._wbg_cb_unref();
1351
+ }
1352
+ };
1353
+ real._wbg_cb_unref = () => {
1354
+ if (--state.cnt === 0) {
1355
+ state.dtor(state.a, state.b);
1356
+ state.a = 0;
1357
+ CLOSURE_DTORS.unregister(state);
1358
+ }
1359
+ };
1360
+ CLOSURE_DTORS.register(real, state, state);
1361
+ return real;
1362
+ }
911
1363
 
912
- /**
913
- * Configuration for RvLite database
914
- */
915
- export class RvLiteConfig {
916
- static __wrap(ptr) {
917
- ptr = ptr >>> 0;
918
- const obj = Object.create(RvLiteConfig.prototype);
919
- obj.__wbg_ptr = ptr;
920
- RvLiteConfigFinalization.register(obj, obj.__wbg_ptr, obj);
921
- return obj;
922
- }
923
- __destroy_into_raw() {
924
- const ptr = this.__wbg_ptr;
925
- this.__wbg_ptr = 0;
926
- RvLiteConfigFinalization.unregister(this);
1364
+ function passArrayF32ToWasm0(arg, malloc) {
1365
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1366
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
1367
+ WASM_VECTOR_LEN = arg.length;
1368
+ return ptr;
1369
+ }
1370
+
1371
+ function passStringToWasm0(arg, malloc, realloc) {
1372
+ if (realloc === undefined) {
1373
+ const buf = cachedTextEncoder.encode(arg);
1374
+ const ptr = malloc(buf.length, 1) >>> 0;
1375
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1376
+ WASM_VECTOR_LEN = buf.length;
927
1377
  return ptr;
928
1378
  }
929
- free() {
930
- const ptr = this.__destroy_into_raw();
931
- wasm.__wbg_rvliteconfig_free(ptr, 0);
932
- }
933
- /**
934
- * Get dimensions
935
- * @returns {number}
936
- */
937
- get_dimensions() {
938
- const ret = wasm.rvliteconfig_get_dimensions(this.__wbg_ptr);
939
- return ret >>> 0;
1379
+
1380
+ let len = arg.length;
1381
+ let ptr = malloc(len, 1) >>> 0;
1382
+
1383
+ const mem = getUint8ArrayMemory0();
1384
+
1385
+ let offset = 0;
1386
+
1387
+ for (; offset < len; offset++) {
1388
+ const code = arg.charCodeAt(offset);
1389
+ if (code > 0x7F) break;
1390
+ mem[ptr + offset] = code;
940
1391
  }
941
- /**
942
- * Get distance metric name
943
- * @returns {string}
944
- */
945
- get_distance_metric() {
946
- let deferred1_0;
947
- let deferred1_1;
948
- try {
949
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
950
- wasm.rvliteconfig_get_distance_metric(retptr, this.__wbg_ptr);
951
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
952
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
953
- deferred1_0 = r0;
954
- deferred1_1 = r1;
955
- return getStringFromWasm0(r0, r1);
956
- } finally {
957
- wasm.__wbindgen_add_to_stack_pointer(16);
958
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1392
+ if (offset !== len) {
1393
+ if (offset !== 0) {
1394
+ arg = arg.slice(offset);
959
1395
  }
1396
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1397
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1398
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1399
+
1400
+ offset += ret.written;
1401
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
960
1402
  }
961
- /**
962
- * Set distance metric (euclidean, cosine, dotproduct, manhattan)
963
- * @param {string} metric
964
- * @returns {RvLiteConfig}
965
- */
966
- with_distance_metric(metric) {
967
- const ptr = this.__destroy_into_raw();
968
- const ptr0 = passStringToWasm0(metric, wasm.__wbindgen_export, wasm.__wbindgen_export2);
969
- const len0 = WASM_VECTOR_LEN;
970
- const ret = wasm.rvliteconfig_with_distance_metric(ptr, ptr0, len0);
971
- return RvLiteConfig.__wrap(ret);
972
- }
973
- /**
974
- * @param {number} dimensions
975
- */
976
- constructor(dimensions) {
977
- const ret = wasm.rvliteconfig_new(dimensions);
978
- this.__wbg_ptr = ret >>> 0;
979
- RvLiteConfigFinalization.register(this, this.__wbg_ptr, this);
980
- return this;
1403
+
1404
+ WASM_VECTOR_LEN = offset;
1405
+ return ptr;
1406
+ }
1407
+
1408
+ function takeObject(idx) {
1409
+ const ret = getObject(idx);
1410
+ dropObject(idx);
1411
+ return ret;
1412
+ }
1413
+
1414
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1415
+ cachedTextDecoder.decode();
1416
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1417
+ let numBytesDecoded = 0;
1418
+ function decodeText(ptr, len) {
1419
+ numBytesDecoded += len;
1420
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1421
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1422
+ cachedTextDecoder.decode();
1423
+ numBytesDecoded = len;
981
1424
  }
1425
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
982
1426
  }
983
- if (Symbol.dispose) RvLiteConfig.prototype[Symbol.dispose] = RvLiteConfig.prototype.free;
984
1427
 
985
- export function init() {
986
- wasm.init();
1428
+ const cachedTextEncoder = new TextEncoder();
1429
+
1430
+ if (!('encodeInto' in cachedTextEncoder)) {
1431
+ cachedTextEncoder.encodeInto = function (arg, view) {
1432
+ const buf = cachedTextEncoder.encode(arg);
1433
+ view.set(buf);
1434
+ return {
1435
+ read: arg.length,
1436
+ written: buf.length
1437
+ };
1438
+ };
987
1439
  }
988
1440
 
989
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1441
+ let WASM_VECTOR_LEN = 0;
1442
+
1443
+ let wasmModule, wasm;
1444
+ function __wbg_finalize_init(instance, module) {
1445
+ wasm = instance.exports;
1446
+ wasmModule = module;
1447
+ cachedDataViewMemory0 = null;
1448
+ cachedFloat32ArrayMemory0 = null;
1449
+ cachedUint8ArrayMemory0 = null;
1450
+ wasm.__wbindgen_start();
1451
+ return wasm;
1452
+ }
990
1453
 
991
1454
  async function __wbg_load(module, imports) {
992
1455
  if (typeof Response === 'function' && module instanceof Response) {
@@ -994,14 +1457,12 @@ async function __wbg_load(module, imports) {
994
1457
  try {
995
1458
  return await WebAssembly.instantiateStreaming(module, imports);
996
1459
  } catch (e) {
997
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1460
+ const validResponse = module.ok && expectedResponseType(module.type);
998
1461
 
999
1462
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1000
1463
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1001
1464
 
1002
- } else {
1003
- throw e;
1004
- }
1465
+ } else { throw e; }
1005
1466
  }
1006
1467
  }
1007
1468
 
@@ -1016,450 +1477,20 @@ async function __wbg_load(module, imports) {
1016
1477
  return instance;
1017
1478
  }
1018
1479
  }
1019
- }
1020
1480
 
1021
- function __wbg_get_imports() {
1022
- const imports = {};
1023
- imports.wbg = {};
1024
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1025
- const ret = Error(getStringFromWasm0(arg0, arg1));
1026
- return addHeapObject(ret);
1027
- };
1028
- imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
1029
- const ret = Number(getObject(arg0));
1030
- return ret;
1031
- };
1032
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1033
- const ret = String(getObject(arg1));
1034
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1035
- const len1 = WASM_VECTOR_LEN;
1036
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1037
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1038
- };
1039
- imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
1040
- const v = getObject(arg1);
1041
- const ret = typeof(v) === 'bigint' ? v : undefined;
1042
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1043
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1044
- };
1045
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1046
- const v = getObject(arg0);
1047
- const ret = typeof(v) === 'boolean' ? v : undefined;
1048
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1049
- };
1050
- imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1051
- const ret = debugString(getObject(arg1));
1052
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1053
- const len1 = WASM_VECTOR_LEN;
1054
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1055
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1056
- };
1057
- imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1058
- const ret = getObject(arg0) in getObject(arg1);
1059
- return ret;
1060
- };
1061
- imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
1062
- const ret = typeof(getObject(arg0)) === 'bigint';
1063
- return ret;
1064
- };
1065
- imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
1066
- const ret = typeof(getObject(arg0)) === 'function';
1067
- return ret;
1068
- };
1069
- imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
1070
- const ret = getObject(arg0) === null;
1071
- return ret;
1072
- };
1073
- imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1074
- const val = getObject(arg0);
1075
- const ret = typeof(val) === 'object' && val !== null;
1076
- return ret;
1077
- };
1078
- imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1079
- const ret = typeof(getObject(arg0)) === 'string';
1080
- return ret;
1081
- };
1082
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1083
- const ret = getObject(arg0) === undefined;
1084
- return ret;
1085
- };
1086
- imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
1087
- const ret = getObject(arg0) === getObject(arg1);
1088
- return ret;
1089
- };
1090
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1091
- const ret = getObject(arg0) == getObject(arg1);
1092
- return ret;
1093
- };
1094
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1095
- const obj = getObject(arg1);
1096
- const ret = typeof(obj) === 'number' ? obj : undefined;
1097
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1098
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1099
- };
1100
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1101
- const obj = getObject(arg1);
1102
- const ret = typeof(obj) === 'string' ? obj : undefined;
1103
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1104
- var len1 = WASM_VECTOR_LEN;
1105
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1106
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1107
- };
1108
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1109
- throw new Error(getStringFromWasm0(arg0, arg1));
1110
- };
1111
- imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
1112
- getObject(arg0)._wbg_cb_unref();
1113
- };
1114
- imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
1115
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1116
- return addHeapObject(ret);
1117
- }, arguments) };
1118
- imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1119
- const ret = getObject(arg0).call(getObject(arg1));
1120
- return addHeapObject(ret);
1121
- }, arguments) };
1122
- imports.wbg.__wbg_clear_0e6ff4790cdabf11 = function() { return handleError(function (arg0) {
1123
- const ret = getObject(arg0).clear();
1124
- return addHeapObject(ret);
1125
- }, arguments) };
1126
- imports.wbg.__wbg_close_cf7ef4e294ac3858 = function(arg0) {
1127
- getObject(arg0).close();
1128
- };
1129
- imports.wbg.__wbg_contains_de2a27de1ed31877 = function(arg0, arg1, arg2) {
1130
- const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
1131
- return ret;
1132
- };
1133
- imports.wbg.__wbg_count_5aeeb43c8c540e73 = function() { return handleError(function (arg0, arg1) {
1134
- const ret = getObject(arg0).count(getObject(arg1));
1135
- return addHeapObject(ret);
1136
- }, arguments) };
1137
- imports.wbg.__wbg_createObjectStore_dba64acfe84d4191 = function() { return handleError(function (arg0, arg1, arg2) {
1138
- const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
1139
- return addHeapObject(ret);
1140
- }, arguments) };
1141
- imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1142
- const ret = getObject(arg0).done;
1143
- return ret;
1144
- };
1145
- imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
1146
- const ret = Object.entries(getObject(arg0));
1147
- return addHeapObject(ret);
1148
- };
1149
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1150
- let deferred0_0;
1151
- let deferred0_1;
1152
- try {
1153
- deferred0_0 = arg0;
1154
- deferred0_1 = arg1;
1155
- console.error(getStringFromWasm0(arg0, arg1));
1156
- } finally {
1157
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1158
- }
1159
- };
1160
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1161
- const ret = getObject(arg0)[arg1 >>> 0];
1162
- return addHeapObject(ret);
1163
- };
1164
- imports.wbg.__wbg_get_7d8b665fa88606d5 = function() { return handleError(function (arg0, arg1) {
1165
- const ret = getObject(arg0).get(getObject(arg1));
1166
- return addHeapObject(ret);
1167
- }, arguments) };
1168
- imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1169
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1170
- return addHeapObject(ret);
1171
- }, arguments) };
1172
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1173
- const ret = getObject(arg0)[getObject(arg1)];
1174
- return addHeapObject(ret);
1175
- };
1176
- imports.wbg.__wbg_indexedDB_23c232e00a1e28ad = function() { return handleError(function (arg0) {
1177
- const ret = getObject(arg0).indexedDB;
1178
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1179
- }, arguments) };
1180
- imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1181
- let result;
1182
- try {
1183
- result = getObject(arg0) instanceof ArrayBuffer;
1184
- } catch (_) {
1185
- result = false;
1186
- }
1187
- const ret = result;
1188
- return ret;
1189
- };
1190
- imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
1191
- let result;
1192
- try {
1193
- result = getObject(arg0) instanceof Map;
1194
- } catch (_) {
1195
- result = false;
1196
- }
1197
- const ret = result;
1198
- return ret;
1199
- };
1200
- imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1201
- let result;
1202
- try {
1203
- result = getObject(arg0) instanceof Uint8Array;
1204
- } catch (_) {
1205
- result = false;
1206
- }
1207
- const ret = result;
1208
- return ret;
1209
- };
1210
- imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
1211
- let result;
1212
- try {
1213
- result = getObject(arg0) instanceof Window;
1214
- } catch (_) {
1215
- result = false;
1216
- }
1217
- const ret = result;
1218
- return ret;
1219
- };
1220
- imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1221
- const ret = Array.isArray(getObject(arg0));
1222
- return ret;
1223
- };
1224
- imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1225
- const ret = Number.isSafeInteger(getObject(arg0));
1226
- return ret;
1227
- };
1228
- imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
1229
- const ret = Symbol.iterator;
1230
- return addHeapObject(ret);
1231
- };
1232
- imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1233
- const ret = getObject(arg0).length;
1234
- return ret;
1235
- };
1236
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1237
- const ret = getObject(arg0).length;
1238
- return ret;
1239
- };
1240
- imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
1241
- console.log(getObject(arg0));
1242
- };
1243
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1244
- const ret = new Object();
1245
- return addHeapObject(ret);
1246
- };
1247
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1248
- const ret = new Array();
1249
- return addHeapObject(ret);
1250
- };
1251
- imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1252
- const ret = new Uint8Array(getObject(arg0));
1253
- return addHeapObject(ret);
1254
- };
1255
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1256
- const ret = new Error();
1257
- return addHeapObject(ret);
1258
- };
1259
- imports.wbg.__wbg_new_b546ae120718850e = function() {
1260
- const ret = new Map();
1261
- return addHeapObject(ret);
1262
- };
1263
- imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
1264
- try {
1265
- var state0 = {a: arg0, b: arg1};
1266
- var cb0 = (arg0, arg1) => {
1267
- const a = state0.a;
1268
- state0.a = 0;
1269
- try {
1270
- return __wasm_bindgen_func_elem_1385(a, state0.b, arg0, arg1);
1271
- } finally {
1272
- state0.a = a;
1273
- }
1274
- };
1275
- const ret = new Promise(cb0);
1276
- return addHeapObject(ret);
1277
- } finally {
1278
- state0.a = state0.b = 0;
1481
+ function expectedResponseType(type) {
1482
+ switch (type) {
1483
+ case 'basic': case 'cors': case 'default': return true;
1279
1484
  }
1280
- };
1281
- imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1282
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1283
- return addHeapObject(ret);
1284
- };
1285
- imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1286
- const ret = getObject(arg0).next;
1287
- return addHeapObject(ret);
1288
- };
1289
- imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1290
- const ret = getObject(arg0).next();
1291
- return addHeapObject(ret);
1292
- }, arguments) };
1293
- imports.wbg.__wbg_now_69d776cd24f5215b = function() {
1294
- const ret = Date.now();
1295
- return ret;
1296
- };
1297
- imports.wbg.__wbg_objectStoreNames_90900f9a531513ac = function(arg0) {
1298
- const ret = getObject(arg0).objectStoreNames;
1299
- return addHeapObject(ret);
1300
- };
1301
- imports.wbg.__wbg_objectStore_da9a077b8849dbe9 = function() { return handleError(function (arg0, arg1, arg2) {
1302
- const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
1303
- return addHeapObject(ret);
1304
- }, arguments) };
1305
- imports.wbg.__wbg_open_0d7b85f4c0a38ffe = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1306
- const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
1307
- return addHeapObject(ret);
1308
- }, arguments) };
1309
- imports.wbg.__wbg_parse_a09a54cf72639456 = function() { return handleError(function (arg0, arg1) {
1310
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1311
- return addHeapObject(ret);
1312
- }, arguments) };
1313
- imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1314
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1315
- };
1316
- imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
1317
- const ret = getObject(arg0).push(getObject(arg1));
1318
- return ret;
1319
- };
1320
- imports.wbg.__wbg_put_d40a68e5a8902a46 = function() { return handleError(function (arg0, arg1, arg2) {
1321
- const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
1322
- return addHeapObject(ret);
1323
- }, arguments) };
1324
- imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1325
- const ret = getObject(arg0).queueMicrotask;
1326
- return addHeapObject(ret);
1327
- };
1328
- imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1329
- queueMicrotask(getObject(arg0));
1330
- };
1331
- imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1332
- const ret = Promise.resolve(getObject(arg0));
1333
- return addHeapObject(ret);
1334
- };
1335
- imports.wbg.__wbg_result_084f962aedb54250 = function() { return handleError(function (arg0) {
1336
- const ret = getObject(arg0).result;
1337
- return addHeapObject(ret);
1338
- }, arguments) };
1339
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1340
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1341
- };
1342
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1343
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1344
- };
1345
- imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1346
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1347
- return addHeapObject(ret);
1348
- };
1349
- imports.wbg.__wbg_set_onerror_08fecec3bdc9d24d = function(arg0, arg1) {
1350
- getObject(arg0).onerror = getObject(arg1);
1351
- };
1352
- imports.wbg.__wbg_set_onsuccess_94332a00452de699 = function(arg0, arg1) {
1353
- getObject(arg0).onsuccess = getObject(arg1);
1354
- };
1355
- imports.wbg.__wbg_set_onupgradeneeded_3dc6e233a6d13fe2 = function(arg0, arg1) {
1356
- getObject(arg0).onupgradeneeded = getObject(arg1);
1357
- };
1358
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1359
- const ret = getObject(arg1).stack;
1360
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1361
- const len1 = WASM_VECTOR_LEN;
1362
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1363
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1364
- };
1365
- imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1366
- const ret = typeof global === 'undefined' ? null : global;
1367
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1368
- };
1369
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1370
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1371
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1372
- };
1373
- imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1374
- const ret = typeof self === 'undefined' ? null : self;
1375
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1376
- };
1377
- imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1378
- const ret = typeof window === 'undefined' ? null : window;
1379
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1380
- };
1381
- imports.wbg.__wbg_target_0e3e05a6263c37a0 = function(arg0) {
1382
- const ret = getObject(arg0).target;
1383
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1384
- };
1385
- imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1386
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1387
- return addHeapObject(ret);
1388
- };
1389
- imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1390
- const ret = getObject(arg0).then(getObject(arg1));
1391
- return addHeapObject(ret);
1392
- };
1393
- imports.wbg.__wbg_transaction_257422def49a0094 = function() { return handleError(function (arg0, arg1, arg2) {
1394
- const ret = getObject(arg0).transaction(getObject(arg1), __wbindgen_enum_IdbTransactionMode[arg2]);
1395
- return addHeapObject(ret);
1396
- }, arguments) };
1397
- imports.wbg.__wbg_transaction_754344c3ae25fdcf = function() { return handleError(function (arg0, arg1, arg2) {
1398
- const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2));
1399
- return addHeapObject(ret);
1400
- }, arguments) };
1401
- imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1402
- const ret = getObject(arg0).value;
1403
- return addHeapObject(ret);
1404
- };
1405
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1406
- // Cast intrinsic for `Ref(String) -> Externref`.
1407
- const ret = getStringFromWasm0(arg0, arg1);
1408
- return addHeapObject(ret);
1409
- };
1410
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1411
- // Cast intrinsic for `U64 -> Externref`.
1412
- const ret = BigInt.asUintN(64, arg0);
1413
- return addHeapObject(ret);
1414
- };
1415
- imports.wbg.__wbindgen_cast_59e89726c7c5a9af = function(arg0, arg1) {
1416
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8, function: Function { arguments: [NamedExternref("Event")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1417
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_179, __wasm_bindgen_func_elem_180);
1418
- return addHeapObject(ret);
1419
- };
1420
- imports.wbg.__wbindgen_cast_8ff99cee1f2c383b = function(arg0, arg1) {
1421
- // Cast intrinsic for `Closure(Closure { dtor_idx: 348, function: Function { arguments: [Externref], shim_idx: 349, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1422
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1338, __wasm_bindgen_func_elem_1339);
1423
- return addHeapObject(ret);
1424
- };
1425
- imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1426
- // Cast intrinsic for `I64 -> Externref`.
1427
- const ret = arg0;
1428
- return addHeapObject(ret);
1429
- };
1430
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1431
- // Cast intrinsic for `F64 -> Externref`.
1432
- const ret = arg0;
1433
- return addHeapObject(ret);
1434
- };
1435
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1436
- const ret = getObject(arg0);
1437
- return addHeapObject(ret);
1438
- };
1439
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1440
- takeObject(arg0);
1441
- };
1442
-
1443
- return imports;
1444
- }
1445
-
1446
- function __wbg_finalize_init(instance, module) {
1447
- wasm = instance.exports;
1448
- __wbg_init.__wbindgen_wasm_module = module;
1449
- cachedDataViewMemory0 = null;
1450
- cachedFloat32ArrayMemory0 = null;
1451
- cachedUint8ArrayMemory0 = null;
1452
-
1453
-
1454
- wasm.__wbindgen_start();
1455
- return wasm;
1485
+ return false;
1486
+ }
1456
1487
  }
1457
1488
 
1458
1489
  function initSync(module) {
1459
1490
  if (wasm !== undefined) return wasm;
1460
1491
 
1461
1492
 
1462
- if (typeof module !== 'undefined') {
1493
+ if (module !== undefined) {
1463
1494
  if (Object.getPrototypeOf(module) === Object.prototype) {
1464
1495
  ({module} = module)
1465
1496
  } else {
@@ -1479,7 +1510,7 @@ async function __wbg_init(module_or_path) {
1479
1510
  if (wasm !== undefined) return wasm;
1480
1511
 
1481
1512
 
1482
- if (typeof module_or_path !== 'undefined') {
1513
+ if (module_or_path !== undefined) {
1483
1514
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1484
1515
  ({module_or_path} = module_or_path)
1485
1516
  } else {
@@ -1487,7 +1518,7 @@ async function __wbg_init(module_or_path) {
1487
1518
  }
1488
1519
  }
1489
1520
 
1490
- if (typeof module_or_path === 'undefined') {
1521
+ if (module_or_path === undefined) {
1491
1522
  module_or_path = new URL('rvlite_bg.wasm', import.meta.url);
1492
1523
  }
1493
1524
  const imports = __wbg_get_imports();
@@ -1501,5 +1532,4 @@ async function __wbg_init(module_or_path) {
1501
1532
  return __wbg_finalize_init(instance, module);
1502
1533
  }
1503
1534
 
1504
- export { initSync };
1505
- export default __wbg_init;
1535
+ export { initSync, __wbg_init as default };