hermes-wasm 1.8.133 → 1.8.134
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 +37 -11
- package/hermes_wasm.js +76 -25
- 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
|
@@ -67,10 +67,6 @@ export class IpfsIndex {
|
|
|
67
67
|
* Import cache
|
|
68
68
|
*/
|
|
69
69
|
import_cache(data: Uint8Array): void;
|
|
70
|
-
/**
|
|
71
|
-
* Load cache from IndexedDB
|
|
72
|
-
*/
|
|
73
|
-
load_cache_from_idb(): Promise<boolean>;
|
|
74
70
|
/**
|
|
75
71
|
* Load index using JavaScript fetch functions
|
|
76
72
|
*
|
|
@@ -78,6 +74,10 @@ export class IpfsIndex {
|
|
|
78
74
|
* @param size_fn - JS function: (path: string) => Promise<number>
|
|
79
75
|
*/
|
|
80
76
|
load(fetch_fn: Function, size_fn: Function): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Load cache from IndexedDB
|
|
79
|
+
*/
|
|
80
|
+
load_cache_from_idb(): Promise<boolean>;
|
|
81
81
|
/**
|
|
82
82
|
* Load index with IndexedDB cache pre-loaded
|
|
83
83
|
*
|
|
@@ -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
|
*
|
|
@@ -284,12 +305,6 @@ export class RemoteIndex {
|
|
|
284
305
|
* network requests for previously fetched data.
|
|
285
306
|
*/
|
|
286
307
|
import_cache(data: Uint8Array): void;
|
|
287
|
-
/**
|
|
288
|
-
* Load the slice cache from IndexedDB
|
|
289
|
-
*
|
|
290
|
-
* Call this after load() to restore cached data from a previous session.
|
|
291
|
-
*/
|
|
292
|
-
load_cache_from_idb(): Promise<boolean>;
|
|
293
308
|
/**
|
|
294
309
|
* Load index from URL using hermes-core Index with slice caching
|
|
295
310
|
*
|
|
@@ -297,6 +312,12 @@ export class RemoteIndex {
|
|
|
297
312
|
* to prefill the cache with hot data, reducing cold-start latency.
|
|
298
313
|
*/
|
|
299
314
|
load(): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Load the slice cache from IndexedDB
|
|
317
|
+
*
|
|
318
|
+
* Call this after load() to restore cached data from a previous session.
|
|
319
|
+
*/
|
|
320
|
+
load_cache_from_idb(): Promise<boolean>;
|
|
300
321
|
/**
|
|
301
322
|
* Load index with IndexedDB cache pre-loaded
|
|
302
323
|
*
|
|
@@ -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;
|
|
@@ -452,7 +478,7 @@ export interface InitOutput {
|
|
|
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
480
|
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_: (a: number, b: number, c: any) => void;
|
|
455
|
-
readonly
|
|
481
|
+
readonly wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___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
|
@@ -176,14 +176,6 @@ export class IpfsIndex {
|
|
|
176
176
|
throw takeFromExternrefTable0(ret[0]);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Load cache from IndexedDB
|
|
181
|
-
* @returns {Promise<boolean>}
|
|
182
|
-
*/
|
|
183
|
-
load_cache_from_idb() {
|
|
184
|
-
const ret = wasm.ipfsindex_load_cache_from_idb(this.__wbg_ptr);
|
|
185
|
-
return ret;
|
|
186
|
-
}
|
|
187
179
|
/**
|
|
188
180
|
* Load index using JavaScript fetch functions
|
|
189
181
|
*
|
|
@@ -197,6 +189,14 @@ export class IpfsIndex {
|
|
|
197
189
|
const ret = wasm.ipfsindex_load(this.__wbg_ptr, fetch_fn, size_fn);
|
|
198
190
|
return ret;
|
|
199
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Load cache from IndexedDB
|
|
194
|
+
* @returns {Promise<boolean>}
|
|
195
|
+
*/
|
|
196
|
+
load_cache_from_idb() {
|
|
197
|
+
const ret = wasm.ipfsindex_load_cache_from_idb(this.__wbg_ptr);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
200
|
/**
|
|
201
201
|
* Load index with IndexedDB cache pre-loaded
|
|
202
202
|
*
|
|
@@ -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
|
*
|
|
@@ -628,16 +679,6 @@ export class RemoteIndex {
|
|
|
628
679
|
throw takeFromExternrefTable0(ret[0]);
|
|
629
680
|
}
|
|
630
681
|
}
|
|
631
|
-
/**
|
|
632
|
-
* Load the slice cache from IndexedDB
|
|
633
|
-
*
|
|
634
|
-
* Call this after load() to restore cached data from a previous session.
|
|
635
|
-
* @returns {Promise<boolean>}
|
|
636
|
-
*/
|
|
637
|
-
load_cache_from_idb() {
|
|
638
|
-
const ret = wasm.remoteindex_load_cache_from_idb(this.__wbg_ptr);
|
|
639
|
-
return ret;
|
|
640
|
-
}
|
|
641
682
|
/**
|
|
642
683
|
* Load index from URL using hermes-core Index with slice caching
|
|
643
684
|
*
|
|
@@ -649,6 +690,16 @@ export class RemoteIndex {
|
|
|
649
690
|
const ret = wasm.remoteindex_load(this.__wbg_ptr);
|
|
650
691
|
return ret;
|
|
651
692
|
}
|
|
693
|
+
/**
|
|
694
|
+
* Load the slice cache from IndexedDB
|
|
695
|
+
*
|
|
696
|
+
* Call this after load() to restore cached data from a previous session.
|
|
697
|
+
* @returns {Promise<boolean>}
|
|
698
|
+
*/
|
|
699
|
+
load_cache_from_idb() {
|
|
700
|
+
const ret = wasm.remoteindex_load_cache_from_idb(this.__wbg_ptr);
|
|
701
|
+
return ret;
|
|
702
|
+
}
|
|
652
703
|
/**
|
|
653
704
|
* Load index with IndexedDB cache pre-loaded
|
|
654
705
|
*
|
|
@@ -1344,22 +1395,22 @@ function __wbg_get_imports() {
|
|
|
1344
1395
|
console.warn(arg0);
|
|
1345
1396
|
},
|
|
1346
1397
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1347
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1398
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1976, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1348
1399
|
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
1400
|
return ret;
|
|
1350
1401
|
},
|
|
1351
1402
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1352
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
1403
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1353
1404
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_);
|
|
1354
1405
|
return ret;
|
|
1355
1406
|
},
|
|
1356
1407
|
__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,
|
|
1408
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1409
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71);
|
|
1359
1410
|
return ret;
|
|
1360
1411
|
},
|
|
1361
1412
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
1362
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1413
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1108, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1363
1414
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke_______true_);
|
|
1364
1415
|
return ret;
|
|
1365
1416
|
},
|
|
@@ -1407,8 +1458,8 @@ function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_
|
|
|
1407
1458
|
wasm.wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_(arg0, arg1, arg2);
|
|
1408
1459
|
}
|
|
1409
1460
|
|
|
1410
|
-
function
|
|
1411
|
-
wasm.
|
|
1461
|
+
function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71(arg0, arg1, arg2) {
|
|
1462
|
+
wasm.wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___web_sys_456b715baf4530bf___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__71(arg0, arg1, arg2);
|
|
1412
1463
|
}
|
|
1413
1464
|
|
|
1414
1465
|
function wasm_bindgen_7dc0dc7663c6ddce___convert__closures_____invoke___wasm_bindgen_7dc0dc7663c6ddce___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_7dc0dc7663c6ddce___JsError___true_(arg0, arg1, arg2) {
|
package/hermes_wasm_bg.wasm
CHANGED
|
Binary file
|