@taladb/web 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/pkg/package.json +1 -1
- package/pkg/taladb_web.d.ts +34 -10
- package/pkg/taladb_web.js +110 -16
- package/pkg/taladb_web_bg.wasm +0 -0
- package/pkg/taladb_web_bg.wasm.d.ts +14 -10
- package/worker/taladb.worker.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taladb/web",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "TalaDB WASM bindings — document queries and vector search in the browser",
|
|
5
5
|
"main": "pkg/taladb_web.js",
|
|
6
6
|
"types": "pkg/taladb_web.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/taladb.git",
|
|
22
|
-
"directory": "packages/
|
|
22
|
+
"directory": "packages/bindings/web"
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://thinkgrid-labs.github.io/taladb/guide/web",
|
|
25
25
|
"bugs": {
|
package/pkg/package.json
CHANGED
package/pkg/taladb_web.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export class CollectionWasm {
|
|
|
5
5
|
private constructor();
|
|
6
6
|
free(): void;
|
|
7
7
|
[Symbol.dispose](): void;
|
|
8
|
+
/**
|
|
9
|
+
* Run a MongoDB-style aggregation pipeline (`$match`, `$group`, `$sort`,
|
|
10
|
+
* `$skip`, `$limit`, `$project`). Returns the resulting documents.
|
|
11
|
+
*/
|
|
12
|
+
aggregate(pipeline: any): any;
|
|
8
13
|
/**
|
|
9
14
|
* Count documents matching the filter.
|
|
10
15
|
*/
|
|
@@ -86,6 +91,12 @@ export class TalaDBWasm {
|
|
|
86
91
|
* Get a collection handle by name.
|
|
87
92
|
*/
|
|
88
93
|
collection(name: string): CollectionWasm;
|
|
94
|
+
/**
|
|
95
|
+
* Export changes to `collections` after `sinceMs` (exclusive) as a JSON
|
|
96
|
+
* changeset string, for bidirectional sync. `sinceMs` is a millisecond
|
|
97
|
+
* epoch timestamp (the persisted sync cursor).
|
|
98
|
+
*/
|
|
99
|
+
exportChanges(since_ms: number, collections: string[]): string;
|
|
89
100
|
/**
|
|
90
101
|
* Serialize the entire in-memory database to bytes.
|
|
91
102
|
*
|
|
@@ -94,6 +105,11 @@ export class TalaDBWasm {
|
|
|
94
105
|
* `openWithSnapshot` to restore all data.
|
|
95
106
|
*/
|
|
96
107
|
exportSnapshot(): Uint8Array;
|
|
108
|
+
/**
|
|
109
|
+
* Merge a JSON changeset string (from a remote peer) into the local
|
|
110
|
+
* database via Last-Write-Wins. Returns the number of documents changed.
|
|
111
|
+
*/
|
|
112
|
+
importChanges(changeset_json: string): number;
|
|
97
113
|
/**
|
|
98
114
|
* Open an in-memory database (suitable for tests and environments without OPFS).
|
|
99
115
|
*/
|
|
@@ -119,6 +135,10 @@ export class WorkerDB {
|
|
|
119
135
|
private constructor();
|
|
120
136
|
free(): void;
|
|
121
137
|
[Symbol.dispose](): void;
|
|
138
|
+
/**
|
|
139
|
+
* Run an aggregation pipeline. Returns a JSON array of result documents.
|
|
140
|
+
*/
|
|
141
|
+
aggregate(collection: string, pipeline_json: string): string;
|
|
122
142
|
/**
|
|
123
143
|
* Compact the underlying OPFS / redb storage file, reclaiming space freed
|
|
124
144
|
* by deletes and updates.
|
|
@@ -358,6 +378,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
358
378
|
export interface InitOutput {
|
|
359
379
|
readonly memory: WebAssembly.Memory;
|
|
360
380
|
readonly __wbg_workerdb_free: (a: number, b: number) => void;
|
|
381
|
+
readonly workerdb_aggregate: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
361
382
|
readonly workerdb_compact: (a: number) => [number, number];
|
|
362
383
|
readonly workerdb_compactTombstones: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
363
384
|
readonly workerdb_count: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
@@ -389,6 +410,7 @@ export interface InitOutput {
|
|
|
389
410
|
readonly workerdb_upgradeVectorIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
390
411
|
readonly __wbg_collectionwasm_free: (a: number, b: number) => void;
|
|
391
412
|
readonly __wbg_taladbwasm_free: (a: number, b: number) => void;
|
|
413
|
+
readonly collectionwasm_aggregate: (a: number, b: any) => [number, number, number];
|
|
392
414
|
readonly collectionwasm_count: (a: number, b: any) => [number, number, number];
|
|
393
415
|
readonly collectionwasm_createIndex: (a: number, b: number, c: number) => [number, number];
|
|
394
416
|
readonly collectionwasm_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
@@ -405,24 +427,26 @@ export interface InitOutput {
|
|
|
405
427
|
readonly collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
|
|
406
428
|
readonly collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
|
|
407
429
|
readonly taladbwasm_collection: (a: number, b: number, c: number) => [number, number, number];
|
|
430
|
+
readonly taladbwasm_exportChanges: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
408
431
|
readonly taladbwasm_exportSnapshot: (a: number) => [number, number, number, number];
|
|
432
|
+
readonly taladbwasm_importChanges: (a: number, b: number, c: number) => [number, number, number];
|
|
409
433
|
readonly taladbwasm_openInMemory: () => [number, number, number];
|
|
410
434
|
readonly taladbwasm_openWithSnapshot: (a: number, b: number) => [number, number, number];
|
|
411
435
|
readonly init: () => void;
|
|
436
|
+
readonly idb_load_snapshot: (a: number, b: number) => any;
|
|
437
|
+
readonly idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
|
|
438
|
+
readonly opfs_open_backend: (a: number, b: number) => any;
|
|
412
439
|
readonly is_opfs_available: () => any;
|
|
413
440
|
readonly opfs_delete_snapshot: (a: number, b: number) => any;
|
|
414
441
|
readonly opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
|
|
415
442
|
readonly opfs_load_snapshot: (a: number, b: number) => any;
|
|
416
|
-
readonly
|
|
417
|
-
readonly
|
|
418
|
-
readonly
|
|
419
|
-
readonly
|
|
420
|
-
readonly
|
|
421
|
-
readonly
|
|
422
|
-
readonly
|
|
423
|
-
readonly wasm_bindgen__convert__closures_____invoke__h19185396894e5dfb: (a: number, b: number, c: any, d: any) => void;
|
|
424
|
-
readonly wasm_bindgen__convert__closures_____invoke__h7b2d358a66567a58: (a: number, b: number, c: any) => void;
|
|
425
|
-
readonly wasm_bindgen__convert__closures_____invoke__h88d126a9c69f3dfa: (a: number, b: number) => void;
|
|
443
|
+
readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
|
|
444
|
+
readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___: (a: number, b: number) => void;
|
|
445
|
+
readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______: (a: number, b: number) => void;
|
|
446
|
+
readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
447
|
+
readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
448
|
+
readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_: (a: number, b: number, c: any) => void;
|
|
449
|
+
readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
426
450
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
427
451
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
428
452
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/pkg/taladb_web.js
CHANGED
|
@@ -18,6 +18,19 @@ export class CollectionWasm {
|
|
|
18
18
|
const ptr = this.__destroy_into_raw();
|
|
19
19
|
wasm.__wbg_collectionwasm_free(ptr, 0);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Run a MongoDB-style aggregation pipeline (`$match`, `$group`, `$sort`,
|
|
23
|
+
* `$skip`, `$limit`, `$project`). Returns the resulting documents.
|
|
24
|
+
* @param {any} pipeline
|
|
25
|
+
* @returns {any}
|
|
26
|
+
*/
|
|
27
|
+
aggregate(pipeline) {
|
|
28
|
+
const ret = wasm.collectionwasm_aggregate(this.__wbg_ptr, pipeline);
|
|
29
|
+
if (ret[2]) {
|
|
30
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
31
|
+
}
|
|
32
|
+
return takeFromExternrefTable0(ret[0]);
|
|
33
|
+
}
|
|
21
34
|
/**
|
|
22
35
|
* Count documents matching the filter.
|
|
23
36
|
* @param {any} filter
|
|
@@ -273,6 +286,34 @@ export class TalaDBWasm {
|
|
|
273
286
|
}
|
|
274
287
|
return CollectionWasm.__wrap(ret[0]);
|
|
275
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Export changes to `collections` after `sinceMs` (exclusive) as a JSON
|
|
291
|
+
* changeset string, for bidirectional sync. `sinceMs` is a millisecond
|
|
292
|
+
* epoch timestamp (the persisted sync cursor).
|
|
293
|
+
* @param {number} since_ms
|
|
294
|
+
* @param {string[]} collections
|
|
295
|
+
* @returns {string}
|
|
296
|
+
*/
|
|
297
|
+
exportChanges(since_ms, collections) {
|
|
298
|
+
let deferred3_0;
|
|
299
|
+
let deferred3_1;
|
|
300
|
+
try {
|
|
301
|
+
const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
|
|
302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
303
|
+
const ret = wasm.taladbwasm_exportChanges(this.__wbg_ptr, since_ms, ptr0, len0);
|
|
304
|
+
var ptr2 = ret[0];
|
|
305
|
+
var len2 = ret[1];
|
|
306
|
+
if (ret[3]) {
|
|
307
|
+
ptr2 = 0; len2 = 0;
|
|
308
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
309
|
+
}
|
|
310
|
+
deferred3_0 = ptr2;
|
|
311
|
+
deferred3_1 = len2;
|
|
312
|
+
return getStringFromWasm0(ptr2, len2);
|
|
313
|
+
} finally {
|
|
314
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
276
317
|
/**
|
|
277
318
|
* Serialize the entire in-memory database to bytes.
|
|
278
319
|
*
|
|
@@ -290,6 +331,21 @@ export class TalaDBWasm {
|
|
|
290
331
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
291
332
|
return v1;
|
|
292
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Merge a JSON changeset string (from a remote peer) into the local
|
|
336
|
+
* database via Last-Write-Wins. Returns the number of documents changed.
|
|
337
|
+
* @param {string} changeset_json
|
|
338
|
+
* @returns {number}
|
|
339
|
+
*/
|
|
340
|
+
importChanges(changeset_json) {
|
|
341
|
+
const ptr0 = passStringToWasm0(changeset_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
const len0 = WASM_VECTOR_LEN;
|
|
343
|
+
const ret = wasm.taladbwasm_importChanges(this.__wbg_ptr, ptr0, len0);
|
|
344
|
+
if (ret[2]) {
|
|
345
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
346
|
+
}
|
|
347
|
+
return ret[0] >>> 0;
|
|
348
|
+
}
|
|
293
349
|
/**
|
|
294
350
|
* Open an in-memory database (suitable for tests and environments without OPFS).
|
|
295
351
|
* @returns {TalaDBWasm}
|
|
@@ -347,6 +403,34 @@ export class WorkerDB {
|
|
|
347
403
|
const ptr = this.__destroy_into_raw();
|
|
348
404
|
wasm.__wbg_workerdb_free(ptr, 0);
|
|
349
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Run an aggregation pipeline. Returns a JSON array of result documents.
|
|
408
|
+
* @param {string} collection
|
|
409
|
+
* @param {string} pipeline_json
|
|
410
|
+
* @returns {string}
|
|
411
|
+
*/
|
|
412
|
+
aggregate(collection, pipeline_json) {
|
|
413
|
+
let deferred4_0;
|
|
414
|
+
let deferred4_1;
|
|
415
|
+
try {
|
|
416
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
418
|
+
const ptr1 = passStringToWasm0(pipeline_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
419
|
+
const len1 = WASM_VECTOR_LEN;
|
|
420
|
+
const ret = wasm.workerdb_aggregate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
421
|
+
var ptr3 = ret[0];
|
|
422
|
+
var len3 = ret[1];
|
|
423
|
+
if (ret[3]) {
|
|
424
|
+
ptr3 = 0; len3 = 0;
|
|
425
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
426
|
+
}
|
|
427
|
+
deferred4_0 = ptr3;
|
|
428
|
+
deferred4_1 = len3;
|
|
429
|
+
return getStringFromWasm0(ptr3, len3);
|
|
430
|
+
} finally {
|
|
431
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
350
434
|
/**
|
|
351
435
|
* Compact the underlying OPFS / redb storage file, reclaiming space freed
|
|
352
436
|
* by deletes and updates.
|
|
@@ -1453,7 +1537,7 @@ function __wbg_get_imports() {
|
|
|
1453
1537
|
const a = state0.a;
|
|
1454
1538
|
state0.a = 0;
|
|
1455
1539
|
try {
|
|
1456
|
-
return
|
|
1540
|
+
return wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1457
1541
|
} finally {
|
|
1458
1542
|
state0.a = a;
|
|
1459
1543
|
}
|
|
@@ -1475,7 +1559,7 @@ function __wbg_get_imports() {
|
|
|
1475
1559
|
const a = state0.a;
|
|
1476
1560
|
state0.a = 0;
|
|
1477
1561
|
try {
|
|
1478
|
-
return
|
|
1562
|
+
return wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1479
1563
|
} finally {
|
|
1480
1564
|
state0.a = a;
|
|
1481
1565
|
}
|
|
@@ -1636,18 +1720,18 @@ function __wbg_get_imports() {
|
|
|
1636
1720
|
return ret;
|
|
1637
1721
|
},
|
|
1638
1722
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1639
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1640
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1723
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 208, function: Function { arguments: [], shim_idx: 209, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1724
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_);
|
|
1641
1725
|
return ret;
|
|
1642
1726
|
},
|
|
1643
1727
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1644
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1645
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1728
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 647, function: Function { arguments: [Externref], shim_idx: 648, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1729
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_);
|
|
1646
1730
|
return ret;
|
|
1647
1731
|
},
|
|
1648
1732
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1649
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1650
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1733
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 83, function: Function { arguments: [Externref], shim_idx: 84, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1734
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_);
|
|
1651
1735
|
return ret;
|
|
1652
1736
|
},
|
|
1653
1737
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -1693,23 +1777,23 @@ function __wbg_get_imports() {
|
|
|
1693
1777
|
};
|
|
1694
1778
|
}
|
|
1695
1779
|
|
|
1696
|
-
function
|
|
1697
|
-
wasm.
|
|
1780
|
+
function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_(arg0, arg1) {
|
|
1781
|
+
wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_(arg0, arg1);
|
|
1698
1782
|
}
|
|
1699
1783
|
|
|
1700
|
-
function
|
|
1701
|
-
wasm.
|
|
1784
|
+
function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_(arg0, arg1, arg2) {
|
|
1785
|
+
wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_(arg0, arg1, arg2);
|
|
1702
1786
|
}
|
|
1703
1787
|
|
|
1704
|
-
function
|
|
1705
|
-
const ret = wasm.
|
|
1788
|
+
function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_(arg0, arg1, arg2) {
|
|
1789
|
+
const ret = wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_(arg0, arg1, arg2);
|
|
1706
1790
|
if (ret[1]) {
|
|
1707
1791
|
throw takeFromExternrefTable0(ret[0]);
|
|
1708
1792
|
}
|
|
1709
1793
|
}
|
|
1710
1794
|
|
|
1711
|
-
function
|
|
1712
|
-
wasm.
|
|
1795
|
+
function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
1796
|
+
wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
1713
1797
|
}
|
|
1714
1798
|
|
|
1715
1799
|
|
|
@@ -1894,6 +1978,16 @@ function passArrayF32ToWasm0(arg, malloc) {
|
|
|
1894
1978
|
return ptr;
|
|
1895
1979
|
}
|
|
1896
1980
|
|
|
1981
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
1982
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
1983
|
+
for (let i = 0; i < array.length; i++) {
|
|
1984
|
+
const add = addToExternrefTable0(array[i]);
|
|
1985
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
1986
|
+
}
|
|
1987
|
+
WASM_VECTOR_LEN = array.length;
|
|
1988
|
+
return ptr;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1897
1991
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
1898
1992
|
if (realloc === undefined) {
|
|
1899
1993
|
const buf = cachedTextEncoder.encode(arg);
|
package/pkg/taladb_web_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_workerdb_free: (a: number, b: number) => void;
|
|
5
|
+
export const workerdb_aggregate: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
5
6
|
export const workerdb_compact: (a: number) => [number, number];
|
|
6
7
|
export const workerdb_compactTombstones: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
7
8
|
export const workerdb_count: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
@@ -33,6 +34,7 @@ export const workerdb_updateOne: (a: number, b: number, c: number, d: number, e:
|
|
|
33
34
|
export const workerdb_upgradeVectorIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
34
35
|
export const __wbg_collectionwasm_free: (a: number, b: number) => void;
|
|
35
36
|
export const __wbg_taladbwasm_free: (a: number, b: number) => void;
|
|
37
|
+
export const collectionwasm_aggregate: (a: number, b: any) => [number, number, number];
|
|
36
38
|
export const collectionwasm_count: (a: number, b: any) => [number, number, number];
|
|
37
39
|
export const collectionwasm_createIndex: (a: number, b: number, c: number) => [number, number];
|
|
38
40
|
export const collectionwasm_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
@@ -49,24 +51,26 @@ export const collectionwasm_updateMany: (a: number, b: any, c: any) => [number,
|
|
|
49
51
|
export const collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
|
|
50
52
|
export const collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
|
|
51
53
|
export const taladbwasm_collection: (a: number, b: number, c: number) => [number, number, number];
|
|
54
|
+
export const taladbwasm_exportChanges: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
52
55
|
export const taladbwasm_exportSnapshot: (a: number) => [number, number, number, number];
|
|
56
|
+
export const taladbwasm_importChanges: (a: number, b: number, c: number) => [number, number, number];
|
|
53
57
|
export const taladbwasm_openInMemory: () => [number, number, number];
|
|
54
58
|
export const taladbwasm_openWithSnapshot: (a: number, b: number) => [number, number, number];
|
|
55
59
|
export const init: () => void;
|
|
60
|
+
export const idb_load_snapshot: (a: number, b: number) => any;
|
|
61
|
+
export const idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
|
|
62
|
+
export const opfs_open_backend: (a: number, b: number) => any;
|
|
56
63
|
export const is_opfs_available: () => any;
|
|
57
64
|
export const opfs_delete_snapshot: (a: number, b: number) => any;
|
|
58
65
|
export const opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
|
|
59
66
|
export const opfs_load_snapshot: (a: number, b: number) => any;
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
65
|
-
export const
|
|
66
|
-
export const
|
|
67
|
-
export const wasm_bindgen__convert__closures_____invoke__h19185396894e5dfb: (a: number, b: number, c: any, d: any) => void;
|
|
68
|
-
export const wasm_bindgen__convert__closures_____invoke__h7b2d358a66567a58: (a: number, b: number, c: any) => void;
|
|
69
|
-
export const wasm_bindgen__convert__closures_____invoke__h88d126a9c69f3dfa: (a: number, b: number) => void;
|
|
67
|
+
export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
|
|
68
|
+
export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___: (a: number, b: number) => void;
|
|
69
|
+
export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______: (a: number, b: number) => void;
|
|
70
|
+
export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
71
|
+
export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
72
|
+
export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_: (a: number, b: number, c: any) => void;
|
|
73
|
+
export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
70
74
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
71
75
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
72
76
|
export const __wbindgen_exn_store: (a: number) => void;
|
package/worker/taladb.worker.js
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
* deleteOne { collection, filterJson }
|
|
40
40
|
* deleteMany { collection, filterJson }
|
|
41
41
|
* count { collection, filterJson }
|
|
42
|
+
* aggregate { collection, pipelineJson } → JSON array of result docs
|
|
42
43
|
* createIndex { collection, field }
|
|
43
44
|
* dropIndex { collection, field }
|
|
44
45
|
* createFtsIndex { collection, field }
|
|
@@ -431,6 +432,9 @@ async function dispatch(op, args) {
|
|
|
431
432
|
case 'count':
|
|
432
433
|
return db.count(args.collection, args.filterJson ?? 'null');
|
|
433
434
|
|
|
435
|
+
case 'aggregate':
|
|
436
|
+
return db.aggregate(args.collection, args.pipelineJson ?? '[]');
|
|
437
|
+
|
|
434
438
|
case 'createIndex':
|
|
435
439
|
db.createIndex(args.collection, args.field);
|
|
436
440
|
return null;
|