hermes-wasm 1.8.133 → 1.8.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/hermes_wasm.d.ts +28 -2
- package/hermes_wasm.js +73 -13
- package/hermes_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -359,3 +359,34 @@ the configured retrieval depth and does not run Boolean clauses independently.
|
|
|
359
359
|
The diagnostic window is capped at 10,000; candidate/ordinal bounds and a 64 MiB
|
|
360
360
|
JSON response limit reject oversized exports. WASM supports its existing RRF and
|
|
361
361
|
weighted-sum fusion modes; server L1/reranker features remain server APIs.
|
|
362
|
+
|
|
363
|
+
## Delete and upsert local documents
|
|
364
|
+
|
|
365
|
+
LocalIndex supports primary-key schemas and enforces uniqueness on insert and
|
|
366
|
+
reopen. Delete removes the document and every chunk, including indexed-only data.
|
|
367
|
+
Upserts are complete replacements; an absent key is inserted.
|
|
368
|
+
|
|
369
|
+
```javascript
|
|
370
|
+
const index = await LocalIndex.create(`index documents {
|
|
371
|
+
field id: text<raw> [primary, indexed, stored]
|
|
372
|
+
field body: text<simple> [indexed<chunked>]
|
|
373
|
+
}`);
|
|
374
|
+
await index.addDocument({ id: "a", body: ["first chunk", "second chunk"] });
|
|
375
|
+
await index.commit();
|
|
376
|
+
await index.upsertDocument({ id: "a", body: ["replacement"] });
|
|
377
|
+
await index.commit();
|
|
378
|
+
index.deleteDocument("a");
|
|
379
|
+
await index.commit();
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
`deleteDocuments(keys)` and `await upsertDocuments(documents)` return
|
|
383
|
+
`{ acceptedCount, errors: [{ index, error }] }`. Inspect errors and commit accepted
|
|
384
|
+
work. A pending insertion/replacement must be committed before another mutation
|
|
385
|
+
of the same key. `await index.abort()` discards the entire pending transaction.
|
|
386
|
+
A failed builder requires abort; a failed storage commit can be retried without
|
|
387
|
+
replaying mutations. RemoteIndex and IpfsIndex remain read-only.
|
|
388
|
+
|
|
389
|
+
Deletion batches allow 100,000 keys / 8 MiB key bytes; replacement batches allow
|
|
390
|
+
1,000 documents / 32 MiB JSON. Keep one writable LocalIndex per storage namespace,
|
|
391
|
+
and implement atomic per-file replacement in the storage adapter. Physical
|
|
392
|
+
compaction is available through native core, CLI, and the server ForceMerge API.
|
package/hermes_wasm.d.ts
CHANGED
|
@@ -151,6 +151,10 @@ export class LocalIndex {
|
|
|
151
151
|
private constructor();
|
|
152
152
|
free(): void;
|
|
153
153
|
[Symbol.dispose](): void;
|
|
154
|
+
/**
|
|
155
|
+
* Discard the entire pending transaction, retaining published documents.
|
|
156
|
+
*/
|
|
157
|
+
abort(): Promise<void>;
|
|
154
158
|
/**
|
|
155
159
|
* Add a single document (JSON object with field names matching the schema).
|
|
156
160
|
*/
|
|
@@ -171,6 +175,15 @@ export class LocalIndex {
|
|
|
171
175
|
* Data is lost on page refresh. Use `withStorage()` for persistence.
|
|
172
176
|
*/
|
|
173
177
|
static create(schema_sdl: string): Promise<LocalIndex>;
|
|
178
|
+
/**
|
|
179
|
+
* Stage a whole-document deletion by exact primary key, including all chunks.
|
|
180
|
+
*/
|
|
181
|
+
deleteDocument(primary_key: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* Stage deletions. Returns { acceptedCount, errors: [{ index, error }] }.
|
|
184
|
+
* Commit publishes accepted operations; missing keys are accepted.
|
|
185
|
+
*/
|
|
186
|
+
deleteDocuments(primary_keys: any): any;
|
|
174
187
|
/**
|
|
175
188
|
* Get field names from the schema.
|
|
176
189
|
*/
|
|
@@ -216,6 +229,14 @@ export class LocalIndex {
|
|
|
216
229
|
* Returns `{ hits: [{ address: { segment_id, doc_id }, score }], total_hits }`.
|
|
217
230
|
*/
|
|
218
231
|
search(query_str: string, limit: number): Promise<any>;
|
|
232
|
+
/**
|
|
233
|
+
* Stage a complete replacement (insert if absent); call commit to publish.
|
|
234
|
+
*/
|
|
235
|
+
upsertDocument(document: any): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Stage replacements, returning { acceptedCount, errors: [{ index, error }] }.
|
|
238
|
+
*/
|
|
239
|
+
upsertDocuments(documents: any): Promise<any>;
|
|
219
240
|
/**
|
|
220
241
|
* Create or open an index with a pluggable storage backend.
|
|
221
242
|
*
|
|
@@ -405,10 +426,13 @@ export interface InitOutput {
|
|
|
405
426
|
readonly ipfsindex_searchStructured: (a: number, b: any) => any;
|
|
406
427
|
readonly ipfsindex_search_offset: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
407
428
|
readonly ipfsindex_with_cache_size: (a: number, b: number, c: number) => number;
|
|
429
|
+
readonly localindex_abort: (a: number) => any;
|
|
408
430
|
readonly localindex_addDocument: (a: number, b: any) => any;
|
|
409
431
|
readonly localindex_addDocuments: (a: number, b: any) => any;
|
|
410
432
|
readonly localindex_commit: (a: number) => any;
|
|
411
433
|
readonly localindex_create: (a: number, b: number) => any;
|
|
434
|
+
readonly localindex_deleteDocument: (a: number, b: number, c: number) => [number, number];
|
|
435
|
+
readonly localindex_deleteDocuments: (a: number, b: any) => [number, number, number];
|
|
412
436
|
readonly localindex_fieldNames: (a: number) => any;
|
|
413
437
|
readonly localindex_getDocument: (a: number, b: number, c: number, d: number) => any;
|
|
414
438
|
readonly localindex_getDocumentWithFields: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
@@ -417,6 +441,8 @@ export interface InitOutput {
|
|
|
417
441
|
readonly localindex_search: (a: number, b: number, c: number, d: number) => any;
|
|
418
442
|
readonly localindex_searchOffset: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
419
443
|
readonly localindex_searchStructured: (a: number, b: any) => any;
|
|
444
|
+
readonly localindex_upsertDocument: (a: number, b: any) => any;
|
|
445
|
+
readonly localindex_upsertDocuments: (a: number, b: any) => any;
|
|
420
446
|
readonly localindex_withStorage: (a: any, b: number, c: number) => any;
|
|
421
447
|
readonly remoteindex_cache_stats: (a: number) => any;
|
|
422
448
|
readonly remoteindex_clear_idb_cache: (a: number) => any;
|
|
@@ -451,8 +477,8 @@ export interface InitOutput {
|
|
|
451
477
|
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
452
478
|
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___js_sys_59b4256fe4dcc1af___Function_fn_wasm_bindgen_7dc0dc7663c6ddce___JsValue_____wasm_bindgen_7dc0dc7663c6ddce___sys__Undefined___js_sys_59b4256fe4dcc1af___Function_fn_wasm_bindgen_7dc0dc7663c6ddce___JsValue_____wasm_bindgen_7dc0dc7663c6ddce___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
453
479
|
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___wasm_bindgen_7dc0dc7663c6ddce___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_7dc0dc7663c6ddce___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
454
|
-
readonly
|
|
455
|
-
readonly
|
|
480
|
+
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_: (a: number, b: number, c: any) => void;
|
|
481
|
+
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71: (a: number, b: number, c: any) => void;
|
|
456
482
|
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
457
483
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
458
484
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/hermes_wasm.js
CHANGED
|
@@ -346,6 +346,14 @@ export class LocalIndex {
|
|
|
346
346
|
const ptr = this.__destroy_into_raw();
|
|
347
347
|
wasm.__wbg_localindex_free(ptr, 0);
|
|
348
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Discard the entire pending transaction, retaining published documents.
|
|
351
|
+
* @returns {Promise<void>}
|
|
352
|
+
*/
|
|
353
|
+
abort() {
|
|
354
|
+
const ret = wasm.localindex_abort(this.__wbg_ptr);
|
|
355
|
+
return ret;
|
|
356
|
+
}
|
|
349
357
|
/**
|
|
350
358
|
* Add a single document (JSON object with field names matching the schema).
|
|
351
359
|
* @param {any} doc_json
|
|
@@ -387,6 +395,31 @@ export class LocalIndex {
|
|
|
387
395
|
const ret = wasm.localindex_create(ptr0, len0);
|
|
388
396
|
return ret;
|
|
389
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Stage a whole-document deletion by exact primary key, including all chunks.
|
|
400
|
+
* @param {string} primary_key
|
|
401
|
+
*/
|
|
402
|
+
deleteDocument(primary_key) {
|
|
403
|
+
const ptr0 = passStringToWasm0(primary_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
404
|
+
const len0 = WASM_VECTOR_LEN;
|
|
405
|
+
const ret = wasm.localindex_deleteDocument(this.__wbg_ptr, ptr0, len0);
|
|
406
|
+
if (ret[1]) {
|
|
407
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Stage deletions. Returns { acceptedCount, errors: [{ index, error }] }.
|
|
412
|
+
* Commit publishes accepted operations; missing keys are accepted.
|
|
413
|
+
* @param {any} primary_keys
|
|
414
|
+
* @returns {any}
|
|
415
|
+
*/
|
|
416
|
+
deleteDocuments(primary_keys) {
|
|
417
|
+
const ret = wasm.localindex_deleteDocuments(this.__wbg_ptr, primary_keys);
|
|
418
|
+
if (ret[2]) {
|
|
419
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
420
|
+
}
|
|
421
|
+
return takeFromExternrefTable0(ret[0]);
|
|
422
|
+
}
|
|
390
423
|
/**
|
|
391
424
|
* Get field names from the schema.
|
|
392
425
|
* @returns {any}
|
|
@@ -485,6 +518,24 @@ export class LocalIndex {
|
|
|
485
518
|
const ret = wasm.localindex_search(this.__wbg_ptr, ptr0, len0, limit);
|
|
486
519
|
return ret;
|
|
487
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Stage a complete replacement (insert if absent); call commit to publish.
|
|
523
|
+
* @param {any} document
|
|
524
|
+
* @returns {Promise<void>}
|
|
525
|
+
*/
|
|
526
|
+
upsertDocument(document) {
|
|
527
|
+
const ret = wasm.localindex_upsertDocument(this.__wbg_ptr, document);
|
|
528
|
+
return ret;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Stage replacements, returning { acceptedCount, errors: [{ index, error }] }.
|
|
532
|
+
* @param {any} documents
|
|
533
|
+
* @returns {Promise<any>}
|
|
534
|
+
*/
|
|
535
|
+
upsertDocuments(documents) {
|
|
536
|
+
const ret = wasm.localindex_upsertDocuments(this.__wbg_ptr, documents);
|
|
537
|
+
return ret;
|
|
538
|
+
}
|
|
488
539
|
/**
|
|
489
540
|
* Create or open an index with a pluggable storage backend.
|
|
490
541
|
*
|
|
@@ -917,7 +968,7 @@ function __wbg_get_imports() {
|
|
|
917
968
|
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
918
969
|
return ret;
|
|
919
970
|
}, arguments); },
|
|
920
|
-
|
|
971
|
+
__wbg_clearTimeout_1daad5c6ee4fcd3b: function(arg0) {
|
|
921
972
|
const ret = clearTimeout(arg0);
|
|
922
973
|
return ret;
|
|
923
974
|
},
|
|
@@ -962,7 +1013,7 @@ function __wbg_get_imports() {
|
|
|
962
1013
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
963
1014
|
}
|
|
964
1015
|
},
|
|
965
|
-
|
|
1016
|
+
__wbg_fetch_7a37768ab67c5bd8: function(arg0) {
|
|
966
1017
|
const ret = fetch(arg0);
|
|
967
1018
|
return ret;
|
|
968
1019
|
},
|
|
@@ -1231,7 +1282,7 @@ function __wbg_get_imports() {
|
|
|
1231
1282
|
const ret = arg0.result;
|
|
1232
1283
|
return ret;
|
|
1233
1284
|
}, arguments); },
|
|
1234
|
-
|
|
1285
|
+
__wbg_setTimeout_b4a9096784635514: function(arg0, arg1) {
|
|
1235
1286
|
const ret = setTimeout(arg0, arg1);
|
|
1236
1287
|
return ret;
|
|
1237
1288
|
},
|
|
@@ -1275,6 +1326,12 @@ function __wbg_get_imports() {
|
|
|
1275
1326
|
__wbg_set_onupgradeneeded_49d6dd635034b91f: function(arg0, arg1) {
|
|
1276
1327
|
arg0.onupgradeneeded = arg1;
|
|
1277
1328
|
},
|
|
1329
|
+
__wbg_set_referrer_13cf56bbccbb2ceb: function(arg0, arg1, arg2) {
|
|
1330
|
+
arg0.referrer = getStringFromWasm0(arg1, arg2);
|
|
1331
|
+
},
|
|
1332
|
+
__wbg_set_referrer_policy_dac1caa6e937479a: function(arg0, arg1) {
|
|
1333
|
+
arg0.referrerPolicy = __wbindgen_enum_ReferrerPolicy[arg1];
|
|
1334
|
+
},
|
|
1278
1335
|
__wbg_set_signal_f4b32f40f19786f4: function(arg0, arg1) {
|
|
1279
1336
|
arg0.signal = arg1;
|
|
1280
1337
|
},
|
|
@@ -1344,22 +1401,22 @@ function __wbg_get_imports() {
|
|
|
1344
1401
|
console.warn(arg0);
|
|
1345
1402
|
},
|
|
1346
1403
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1347
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1404
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1970, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1348
1405
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___wasm_bindgen_7dc0dc7663c6ddce___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_7dc0dc7663c6ddce___JsError___true_);
|
|
1349
1406
|
return ret;
|
|
1350
1407
|
},
|
|
1351
1408
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1352
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
1353
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1409
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1410
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_);
|
|
1354
1411
|
return ret;
|
|
1355
1412
|
},
|
|
1356
1413
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
1357
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx:
|
|
1358
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1414
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1415
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71);
|
|
1359
1416
|
return ret;
|
|
1360
1417
|
},
|
|
1361
1418
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
1362
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1419
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1102, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1363
1420
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke_______true_);
|
|
1364
1421
|
return ret;
|
|
1365
1422
|
},
|
|
@@ -1403,12 +1460,12 @@ function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke_______true
|
|
|
1403
1460
|
wasm.wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke_______true_(arg0, arg1);
|
|
1404
1461
|
}
|
|
1405
1462
|
|
|
1406
|
-
function
|
|
1407
|
-
wasm.
|
|
1463
|
+
function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_(arg0, arg1, arg2) {
|
|
1464
|
+
wasm.wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_(arg0, arg1, arg2);
|
|
1408
1465
|
}
|
|
1409
1466
|
|
|
1410
|
-
function
|
|
1411
|
-
wasm.
|
|
1467
|
+
function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71(arg0, arg1, arg2) {
|
|
1468
|
+
wasm.wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_460f5e7203ed5507___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71(arg0, arg1, arg2);
|
|
1412
1469
|
}
|
|
1413
1470
|
|
|
1414
1471
|
function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___wasm_bindgen_7dc0dc7663c6ddce___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_7dc0dc7663c6ddce___JsError___true_(arg0, arg1, arg2) {
|
|
@@ -1426,6 +1483,9 @@ function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___js_sys_5
|
|
|
1426
1483
|
const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
|
|
1427
1484
|
|
|
1428
1485
|
|
|
1486
|
+
const __wbindgen_enum_ReferrerPolicy = ["", "no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", "strict-origin-when-cross-origin"];
|
|
1487
|
+
|
|
1488
|
+
|
|
1429
1489
|
const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
1430
1490
|
|
|
1431
1491
|
|
package/hermes_wasm_bg.wasm
CHANGED
|
Binary file
|