hermes-wasm 0.4.3 → 0.4.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/hermes_wasm.d.ts +267 -255
- package/hermes_wasm.js +922 -917
- package/hermes_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/hermes_wasm.d.ts
CHANGED
|
@@ -1,188 +1,200 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Index registry for managing multiple indexes
|
|
6
|
+
*/
|
|
4
7
|
export class IndexRegistry {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Add a remote index
|
|
12
|
+
*/
|
|
13
|
+
add_remote(name: string, base_url: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* List index names
|
|
16
|
+
*/
|
|
17
|
+
list(): any;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Remove an index
|
|
21
|
+
*/
|
|
22
|
+
remove(name: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Search an index by name
|
|
25
|
+
*/
|
|
26
|
+
search(index_name: string, text: string, limit: number): Promise<any>;
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
/**
|
|
30
|
+
* IPFS Index that uses JavaScript verified-fetch for content retrieval
|
|
31
|
+
*
|
|
32
|
+
* This allows loading indexes from IPFS without using gateways by
|
|
33
|
+
* leveraging @helia/verified-fetch in JavaScript.
|
|
34
|
+
*/
|
|
26
35
|
export class IpfsIndex {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
36
|
+
free(): void;
|
|
37
|
+
[Symbol.dispose](): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get cache statistics
|
|
40
|
+
*/
|
|
41
|
+
cache_stats(): any;
|
|
42
|
+
/**
|
|
43
|
+
* Clear IndexedDB cache
|
|
44
|
+
*/
|
|
45
|
+
clear_idb_cache(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Get default fields
|
|
48
|
+
*/
|
|
49
|
+
default_fields(): any;
|
|
50
|
+
/**
|
|
51
|
+
* Export cache
|
|
52
|
+
*/
|
|
53
|
+
export_cache(): Uint8Array | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Get field names
|
|
56
|
+
*/
|
|
57
|
+
field_names(): any;
|
|
58
|
+
/**
|
|
59
|
+
* Get a document by address
|
|
60
|
+
*/
|
|
61
|
+
get_document(segment_id: string, doc_id: number): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Import cache
|
|
64
|
+
*/
|
|
65
|
+
import_cache(data: Uint8Array): void;
|
|
66
|
+
/**
|
|
67
|
+
* Load index using JavaScript fetch functions
|
|
68
|
+
*
|
|
69
|
+
* @param fetch_fn - JS function: (path: string) => Promise<Uint8Array>
|
|
70
|
+
* @param size_fn - JS function: (path: string) => Promise<number>
|
|
71
|
+
*/
|
|
72
|
+
load(fetch_fn: Function, size_fn: Function): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Load cache from IndexedDB
|
|
75
|
+
*/
|
|
76
|
+
load_cache_from_idb(): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new IPFS index
|
|
79
|
+
*
|
|
80
|
+
* @param base_path - The IPFS path (e.g., "/ipfs/Qm..." or "/ipns/...")
|
|
81
|
+
*/
|
|
82
|
+
constructor(base_path: string);
|
|
83
|
+
/**
|
|
84
|
+
* Get number of documents
|
|
85
|
+
*/
|
|
86
|
+
num_docs(): number;
|
|
87
|
+
/**
|
|
88
|
+
* Get number of segments
|
|
89
|
+
*/
|
|
90
|
+
num_segments(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Save cache to IndexedDB
|
|
93
|
+
*/
|
|
94
|
+
save_cache_to_idb(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Search the index
|
|
97
|
+
*/
|
|
98
|
+
search(query_str: string, limit: number): Promise<any>;
|
|
99
|
+
/**
|
|
100
|
+
* Create with custom cache size
|
|
101
|
+
*/
|
|
102
|
+
static with_cache_size(base_path: string, cache_size: number): IpfsIndex;
|
|
94
103
|
}
|
|
95
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Remote index that loads data via HTTP with slice caching
|
|
107
|
+
*/
|
|
96
108
|
export class RemoteIndex {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
109
|
+
free(): void;
|
|
110
|
+
[Symbol.dispose](): void;
|
|
111
|
+
/**
|
|
112
|
+
* Get cache statistics
|
|
113
|
+
*/
|
|
114
|
+
cache_stats(): any;
|
|
115
|
+
/**
|
|
116
|
+
* Clear the persisted cache from IndexedDB
|
|
117
|
+
*/
|
|
118
|
+
clear_idb_cache(): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Get default field names for query parsing
|
|
121
|
+
*/
|
|
122
|
+
default_fields(): any;
|
|
123
|
+
/**
|
|
124
|
+
* Export the current slice cache as bytes
|
|
125
|
+
*
|
|
126
|
+
* Returns the serialized cache data that can be stored in IndexedDB
|
|
127
|
+
* or other persistent storage for later restoration.
|
|
128
|
+
*/
|
|
129
|
+
export_cache(): Uint8Array | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Get field names
|
|
132
|
+
*/
|
|
133
|
+
field_names(): any;
|
|
134
|
+
/**
|
|
135
|
+
* Get a document by its address (segment_id + doc_id)
|
|
136
|
+
*
|
|
137
|
+
* Returns the document as a JSON object, or null if not found.
|
|
138
|
+
*/
|
|
139
|
+
get_document(segment_id: string, doc_id: number): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Import a previously exported slice cache
|
|
142
|
+
*
|
|
143
|
+
* Merges the cached slices into the current cache, reducing
|
|
144
|
+
* network requests for previously fetched data.
|
|
145
|
+
*/
|
|
146
|
+
import_cache(data: Uint8Array): void;
|
|
147
|
+
/**
|
|
148
|
+
* Load index from URL using hermes-core Index with slice caching
|
|
149
|
+
*
|
|
150
|
+
* Automatically attempts to load the slice cache file (index.slicecache)
|
|
151
|
+
* to prefill the cache with hot data, reducing cold-start latency.
|
|
152
|
+
*/
|
|
153
|
+
load(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Load the slice cache from IndexedDB
|
|
156
|
+
*
|
|
157
|
+
* Call this after load() to restore cached data from a previous session.
|
|
158
|
+
*/
|
|
159
|
+
load_cache_from_idb(): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Get network statistics (requests made, bytes transferred, etc.)
|
|
162
|
+
*/
|
|
163
|
+
network_stats(): any;
|
|
164
|
+
/**
|
|
165
|
+
* Create a new remote index pointing to a URL
|
|
166
|
+
*/
|
|
167
|
+
constructor(base_url: string);
|
|
168
|
+
/**
|
|
169
|
+
* Get number of documents
|
|
170
|
+
*/
|
|
171
|
+
num_docs(): number;
|
|
172
|
+
/**
|
|
173
|
+
* Get number of segments
|
|
174
|
+
*/
|
|
175
|
+
num_segments(): number;
|
|
176
|
+
/**
|
|
177
|
+
* Reset network statistics
|
|
178
|
+
*/
|
|
179
|
+
reset_network_stats(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Save the slice cache to IndexedDB for persistence across sessions
|
|
182
|
+
*
|
|
183
|
+
* The cache is stored under a key derived from the base URL.
|
|
184
|
+
*/
|
|
185
|
+
save_cache_to_idb(): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Search the index
|
|
188
|
+
*
|
|
189
|
+
* Accepts both query language syntax (field:term, AND, OR, NOT, grouping)
|
|
190
|
+
* and simple text (tokenized and searched across default fields).
|
|
191
|
+
* Returns document addresses (segment_id + doc_id) without document content.
|
|
192
|
+
*/
|
|
193
|
+
search(query_str: string, limit: number): Promise<any>;
|
|
194
|
+
/**
|
|
195
|
+
* Create with custom cache size (in bytes)
|
|
196
|
+
*/
|
|
197
|
+
static with_cache_size(base_url: string, cache_size: number): RemoteIndex;
|
|
186
198
|
}
|
|
187
199
|
|
|
188
200
|
/**
|
|
@@ -198,92 +210,92 @@ export function setup_logging(): void;
|
|
|
198
210
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
199
211
|
|
|
200
212
|
export interface InitOutput {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
213
|
+
readonly memory: WebAssembly.Memory;
|
|
214
|
+
readonly __wbg_ipfsindex_free: (a: number, b: number) => void;
|
|
215
|
+
readonly ipfsindex_cache_stats: (a: number) => any;
|
|
216
|
+
readonly ipfsindex_clear_idb_cache: (a: number) => any;
|
|
217
|
+
readonly ipfsindex_default_fields: (a: number) => any;
|
|
218
|
+
readonly ipfsindex_export_cache: (a: number) => [number, number];
|
|
219
|
+
readonly ipfsindex_field_names: (a: number) => any;
|
|
220
|
+
readonly ipfsindex_get_document: (a: number, b: number, c: number, d: number) => any;
|
|
221
|
+
readonly ipfsindex_import_cache: (a: number, b: number, c: number) => [number, number];
|
|
222
|
+
readonly ipfsindex_load: (a: number, b: any, c: any) => any;
|
|
223
|
+
readonly ipfsindex_load_cache_from_idb: (a: number) => any;
|
|
224
|
+
readonly ipfsindex_new: (a: number, b: number) => number;
|
|
225
|
+
readonly ipfsindex_num_docs: (a: number) => number;
|
|
226
|
+
readonly ipfsindex_num_segments: (a: number) => number;
|
|
227
|
+
readonly ipfsindex_save_cache_to_idb: (a: number) => any;
|
|
228
|
+
readonly ipfsindex_search: (a: number, b: number, c: number, d: number) => any;
|
|
229
|
+
readonly ipfsindex_with_cache_size: (a: number, b: number, c: number) => number;
|
|
230
|
+
readonly init: () => void;
|
|
231
|
+
readonly setup_logging: () => void;
|
|
232
|
+
readonly __wbg_remoteindex_free: (a: number, b: number) => void;
|
|
233
|
+
readonly remoteindex_cache_stats: (a: number) => any;
|
|
234
|
+
readonly remoteindex_clear_idb_cache: (a: number) => any;
|
|
235
|
+
readonly remoteindex_default_fields: (a: number) => any;
|
|
236
|
+
readonly remoteindex_export_cache: (a: number) => [number, number];
|
|
237
|
+
readonly remoteindex_field_names: (a: number) => any;
|
|
238
|
+
readonly remoteindex_get_document: (a: number, b: number, c: number, d: number) => any;
|
|
239
|
+
readonly remoteindex_import_cache: (a: number, b: number, c: number) => [number, number];
|
|
240
|
+
readonly remoteindex_load: (a: number) => any;
|
|
241
|
+
readonly remoteindex_load_cache_from_idb: (a: number) => any;
|
|
242
|
+
readonly remoteindex_network_stats: (a: number) => any;
|
|
243
|
+
readonly remoteindex_new: (a: number, b: number) => number;
|
|
244
|
+
readonly remoteindex_num_docs: (a: number) => number;
|
|
245
|
+
readonly remoteindex_num_segments: (a: number) => number;
|
|
246
|
+
readonly remoteindex_reset_network_stats: (a: number) => void;
|
|
247
|
+
readonly remoteindex_save_cache_to_idb: (a: number) => any;
|
|
248
|
+
readonly remoteindex_search: (a: number, b: number, c: number, d: number) => any;
|
|
249
|
+
readonly remoteindex_with_cache_size: (a: number, b: number, c: number) => number;
|
|
250
|
+
readonly __wbg_indexregistry_free: (a: number, b: number) => void;
|
|
251
|
+
readonly indexregistry_add_remote: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
252
|
+
readonly indexregistry_list: (a: number) => any;
|
|
253
|
+
readonly indexregistry_new: () => number;
|
|
254
|
+
readonly indexregistry_remove: (a: number, b: number, c: number) => void;
|
|
255
|
+
readonly indexregistry_search: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
256
|
+
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
257
|
+
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
258
|
+
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
259
|
+
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
260
|
+
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
261
|
+
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
262
|
+
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
263
|
+
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
264
|
+
readonly wasm_bindgen__closure__destroy__h599c4d2da8d95df2: (a: number, b: number) => void;
|
|
265
|
+
readonly wasm_bindgen__closure__destroy__h1350f7c666e1bbd4: (a: number, b: number) => void;
|
|
266
|
+
readonly wasm_bindgen__closure__destroy__h5abbeebb46a4841f: (a: number, b: number) => void;
|
|
267
|
+
readonly wasm_bindgen__convert__closures_____invoke__hb9974b33ecb02c45: (a: number, b: number, c: any, d: any) => void;
|
|
268
|
+
readonly wasm_bindgen__convert__closures_____invoke__h59936b7fc4e3dc77: (a: number, b: number, c: any) => void;
|
|
269
|
+
readonly wasm_bindgen__convert__closures_____invoke__h92271f2d5d02a5fa: (a: number, b: number, c: any) => void;
|
|
270
|
+
readonly wasm_bindgen__convert__closures_____invoke__h12264eefbd788797: (a: number, b: number) => void;
|
|
271
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
272
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
273
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
274
|
+
readonly __externref_table_alloc: () => number;
|
|
275
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
276
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
277
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
278
|
+
readonly __wbindgen_start: () => void;
|
|
267
279
|
}
|
|
268
280
|
|
|
269
281
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
270
282
|
|
|
271
283
|
/**
|
|
272
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
273
|
-
* a precompiled `WebAssembly.Module`.
|
|
274
|
-
*
|
|
275
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
276
|
-
*
|
|
277
|
-
* @returns {InitOutput}
|
|
278
|
-
*/
|
|
284
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
285
|
+
* a precompiled `WebAssembly.Module`.
|
|
286
|
+
*
|
|
287
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
288
|
+
*
|
|
289
|
+
* @returns {InitOutput}
|
|
290
|
+
*/
|
|
279
291
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
280
292
|
|
|
281
293
|
/**
|
|
282
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
283
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
284
|
-
*
|
|
285
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
286
|
-
*
|
|
287
|
-
* @returns {Promise<InitOutput>}
|
|
288
|
-
*/
|
|
294
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
295
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
296
|
+
*
|
|
297
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
298
|
+
*
|
|
299
|
+
* @returns {Promise<InitOutput>}
|
|
300
|
+
*/
|
|
289
301
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|