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.
- package/dist/index.js +821 -782
- package/dist/index.mjs +821 -782
- package/dist/wasm/package.json +1 -1
- package/dist/wasm/rvlite.d.ts +259 -250
- package/dist/wasm/rvlite.js +1115 -1085
- package/dist/wasm/rvlite_bg.wasm +0 -0
- package/dist/wasm/rvlite_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
package/dist/wasm/package.json
CHANGED
package/dist/wasm/rvlite.d.ts
CHANGED
|
@@ -1,195 +1,204 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* WASM-compatible Cypher engine
|
|
6
|
+
*/
|
|
4
7
|
export class CypherEngine {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Clear the graph
|
|
12
|
+
*/
|
|
13
|
+
clear(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Execute a Cypher query and return JSON results
|
|
16
|
+
*/
|
|
17
|
+
execute(query: string): any;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new Cypher engine with empty graph
|
|
20
|
+
*/
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Get graph statistics
|
|
24
|
+
*/
|
|
25
|
+
stats(): any;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Main RvLite database
|
|
30
|
+
*/
|
|
25
31
|
export class RvLite {
|
|
26
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
32
|
+
free(): void;
|
|
33
|
+
[Symbol.dispose](): void;
|
|
34
|
+
/**
|
|
35
|
+
* Add an RDF triple
|
|
36
|
+
*
|
|
37
|
+
* # Arguments
|
|
38
|
+
* * `subject` - Subject IRI or blank node (e.g., "<http://example.org/s>" or "_:b1")
|
|
39
|
+
* * `predicate` - Predicate IRI (e.g., "<http://example.org/p>")
|
|
40
|
+
* * `object` - Object IRI, blank node, or literal (e.g., "<http://example.org/o>" or '"value"')
|
|
41
|
+
*/
|
|
42
|
+
add_triple(subject: string, predicate: string, object: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Clear saved state from IndexedDB
|
|
45
|
+
*/
|
|
46
|
+
static clear_storage(): Promise<any>;
|
|
47
|
+
/**
|
|
48
|
+
* Clear all triples
|
|
49
|
+
*/
|
|
50
|
+
clear_triples(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Execute Cypher query
|
|
53
|
+
*
|
|
54
|
+
* Supported operations:
|
|
55
|
+
* - CREATE (n:Label {prop: value})
|
|
56
|
+
* - MATCH (n:Label) WHERE n.prop = value RETURN n
|
|
57
|
+
* - CREATE (a)-[r:REL]->(b)
|
|
58
|
+
* - DELETE n
|
|
59
|
+
*/
|
|
60
|
+
cypher(query: string): any;
|
|
61
|
+
/**
|
|
62
|
+
* Clear the Cypher graph
|
|
63
|
+
*/
|
|
64
|
+
cypher_clear(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Get Cypher graph statistics
|
|
67
|
+
*/
|
|
68
|
+
cypher_stats(): any;
|
|
69
|
+
/**
|
|
70
|
+
* Create with default configuration (384 dimensions, cosine similarity)
|
|
71
|
+
*/
|
|
72
|
+
static default(): RvLite;
|
|
73
|
+
/**
|
|
74
|
+
* Delete a vector by ID
|
|
75
|
+
*/
|
|
76
|
+
delete(id: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Export database state as JSON (for manual backup)
|
|
79
|
+
*/
|
|
80
|
+
export_json(): any;
|
|
81
|
+
/**
|
|
82
|
+
* Get a vector by ID
|
|
83
|
+
*/
|
|
84
|
+
get(id: string): any;
|
|
85
|
+
/**
|
|
86
|
+
* Get configuration
|
|
87
|
+
*/
|
|
88
|
+
get_config(): any;
|
|
89
|
+
/**
|
|
90
|
+
* Get enabled features
|
|
91
|
+
*/
|
|
92
|
+
get_features(): any;
|
|
93
|
+
/**
|
|
94
|
+
* Get version string
|
|
95
|
+
*/
|
|
96
|
+
get_version(): string;
|
|
97
|
+
/**
|
|
98
|
+
* Check if saved state exists in IndexedDB
|
|
99
|
+
*/
|
|
100
|
+
static has_saved_state(): Promise<any>;
|
|
101
|
+
/**
|
|
102
|
+
* Import database state from JSON
|
|
103
|
+
*/
|
|
104
|
+
import_json(json: any): void;
|
|
105
|
+
/**
|
|
106
|
+
* Initialize IndexedDB storage for persistence
|
|
107
|
+
* Must be called before save() or load()
|
|
108
|
+
*/
|
|
109
|
+
init_storage(): Promise<any>;
|
|
110
|
+
/**
|
|
111
|
+
* Insert a vector with optional metadata
|
|
112
|
+
* Returns the vector ID
|
|
113
|
+
*/
|
|
114
|
+
insert(vector: Float32Array, metadata: any): string;
|
|
115
|
+
/**
|
|
116
|
+
* Insert a vector with a specific ID
|
|
117
|
+
*/
|
|
118
|
+
insert_with_id(id: string, vector: Float32Array, metadata: any): void;
|
|
119
|
+
/**
|
|
120
|
+
* Check if database is empty
|
|
121
|
+
*/
|
|
122
|
+
is_empty(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Check if database is ready
|
|
125
|
+
*/
|
|
126
|
+
is_ready(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Check if IndexedDB is available in the browser
|
|
129
|
+
*/
|
|
130
|
+
static is_storage_available(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Get the number of vectors in the database
|
|
133
|
+
*/
|
|
134
|
+
len(): number;
|
|
135
|
+
/**
|
|
136
|
+
* Load database from IndexedDB
|
|
137
|
+
* Returns a Promise<RvLite> with the restored database
|
|
138
|
+
*/
|
|
139
|
+
static load(config: RvLiteConfig): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Create a new RvLite database
|
|
142
|
+
*/
|
|
143
|
+
constructor(config: RvLiteConfig);
|
|
144
|
+
/**
|
|
145
|
+
* Save database state to IndexedDB
|
|
146
|
+
* Returns a Promise that resolves when save is complete
|
|
147
|
+
*/
|
|
148
|
+
save(): Promise<any>;
|
|
149
|
+
/**
|
|
150
|
+
* Search for similar vectors
|
|
151
|
+
*/
|
|
152
|
+
search(query_vector: Float32Array, k: number): any;
|
|
153
|
+
/**
|
|
154
|
+
* Search with metadata filter
|
|
155
|
+
*/
|
|
156
|
+
search_with_filter(query_vector: Float32Array, k: number, filter: any): any;
|
|
157
|
+
/**
|
|
158
|
+
* Execute SPARQL query
|
|
159
|
+
*
|
|
160
|
+
* Supported operations:
|
|
161
|
+
* - SELECT ?s ?p ?o WHERE { ?s ?p ?o }
|
|
162
|
+
* - SELECT ?s WHERE { ?s <predicate> ?o }
|
|
163
|
+
* - ASK { ?s ?p ?o }
|
|
164
|
+
*/
|
|
165
|
+
sparql(query: string): any;
|
|
166
|
+
/**
|
|
167
|
+
* Execute SQL query
|
|
168
|
+
*
|
|
169
|
+
* Supported syntax:
|
|
170
|
+
* - CREATE TABLE vectors (id TEXT PRIMARY KEY, vector VECTOR(384))
|
|
171
|
+
* - SELECT * FROM vectors WHERE id = 'x'
|
|
172
|
+
* - SELECT id, vector <-> '[...]' AS distance FROM vectors ORDER BY distance LIMIT 10
|
|
173
|
+
* - INSERT INTO vectors (id, vector) VALUES ('x', '[...]')
|
|
174
|
+
* - DELETE FROM vectors WHERE id = 'x'
|
|
175
|
+
*/
|
|
176
|
+
sql(query: string): any;
|
|
177
|
+
/**
|
|
178
|
+
* Get the number of triples in the store
|
|
179
|
+
*/
|
|
180
|
+
triple_count(): number;
|
|
175
181
|
}
|
|
176
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Configuration for RvLite database
|
|
185
|
+
*/
|
|
177
186
|
export class RvLiteConfig {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
free(): void;
|
|
188
|
+
[Symbol.dispose](): void;
|
|
189
|
+
/**
|
|
190
|
+
* Get dimensions
|
|
191
|
+
*/
|
|
192
|
+
get_dimensions(): number;
|
|
193
|
+
/**
|
|
194
|
+
* Get distance metric name
|
|
195
|
+
*/
|
|
196
|
+
get_distance_metric(): string;
|
|
197
|
+
constructor(dimensions: number);
|
|
198
|
+
/**
|
|
199
|
+
* Set distance metric (euclidean, cosine, dotproduct, manhattan)
|
|
200
|
+
*/
|
|
201
|
+
with_distance_metric(metric: string): RvLiteConfig;
|
|
193
202
|
}
|
|
194
203
|
|
|
195
204
|
export function init(): void;
|
|
@@ -197,80 +206,80 @@ export function init(): void;
|
|
|
197
206
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
198
207
|
|
|
199
208
|
export interface InitOutput {
|
|
200
|
-
|
|
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
|
-
|
|
209
|
+
readonly memory: WebAssembly.Memory;
|
|
210
|
+
readonly __wbg_cypherengine_free: (a: number, b: number) => void;
|
|
211
|
+
readonly __wbg_rvlite_free: (a: number, b: number) => void;
|
|
212
|
+
readonly __wbg_rvliteconfig_free: (a: number, b: number) => void;
|
|
213
|
+
readonly cypherengine_clear: (a: number) => void;
|
|
214
|
+
readonly cypherengine_execute: (a: number, b: number, c: number, d: number) => void;
|
|
215
|
+
readonly cypherengine_new: () => number;
|
|
216
|
+
readonly cypherengine_stats: (a: number, b: number) => void;
|
|
217
|
+
readonly rvlite_add_triple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
218
|
+
readonly rvlite_clear_triples: (a: number) => void;
|
|
219
|
+
readonly rvlite_cypher: (a: number, b: number, c: number, d: number) => void;
|
|
220
|
+
readonly rvlite_cypher_clear: (a: number) => void;
|
|
221
|
+
readonly rvlite_cypher_stats: (a: number, b: number) => void;
|
|
222
|
+
readonly rvlite_default: (a: number) => void;
|
|
223
|
+
readonly rvlite_delete: (a: number, b: number, c: number, d: number) => void;
|
|
224
|
+
readonly rvlite_export_json: (a: number, b: number) => void;
|
|
225
|
+
readonly rvlite_get: (a: number, b: number, c: number, d: number) => void;
|
|
226
|
+
readonly rvlite_get_config: (a: number, b: number) => void;
|
|
227
|
+
readonly rvlite_get_features: (a: number, b: number) => void;
|
|
228
|
+
readonly rvlite_get_version: (a: number, b: number) => void;
|
|
229
|
+
readonly rvlite_import_json: (a: number, b: number, c: number) => void;
|
|
230
|
+
readonly rvlite_init_storage: (a: number) => number;
|
|
231
|
+
readonly rvlite_insert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
232
|
+
readonly rvlite_insert_with_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
233
|
+
readonly rvlite_is_empty: (a: number, b: number) => void;
|
|
234
|
+
readonly rvlite_is_ready: (a: number) => number;
|
|
235
|
+
readonly rvlite_is_storage_available: () => number;
|
|
236
|
+
readonly rvlite_len: (a: number, b: number) => void;
|
|
237
|
+
readonly rvlite_load: (a: number) => number;
|
|
238
|
+
readonly rvlite_new: (a: number, b: number) => void;
|
|
239
|
+
readonly rvlite_save: (a: number) => number;
|
|
240
|
+
readonly rvlite_search: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
241
|
+
readonly rvlite_search_with_filter: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
242
|
+
readonly rvlite_sparql: (a: number, b: number, c: number, d: number) => void;
|
|
243
|
+
readonly rvlite_sql: (a: number, b: number, c: number, d: number) => void;
|
|
244
|
+
readonly rvlite_triple_count: (a: number) => number;
|
|
245
|
+
readonly rvliteconfig_get_dimensions: (a: number) => number;
|
|
246
|
+
readonly rvliteconfig_get_distance_metric: (a: number, b: number) => void;
|
|
247
|
+
readonly rvliteconfig_new: (a: number) => number;
|
|
248
|
+
readonly rvliteconfig_with_distance_metric: (a: number, b: number, c: number) => number;
|
|
249
|
+
readonly init: () => void;
|
|
250
|
+
readonly rvlite_clear_storage: () => number;
|
|
251
|
+
readonly rvlite_has_saved_state: () => number;
|
|
252
|
+
readonly __wasm_bindgen_func_elem_1364: (a: number, b: number) => void;
|
|
253
|
+
readonly __wasm_bindgen_func_elem_191: (a: number, b: number) => void;
|
|
254
|
+
readonly __wasm_bindgen_func_elem_1365: (a: number, b: number, c: number, d: number) => void;
|
|
255
|
+
readonly __wasm_bindgen_func_elem_1407: (a: number, b: number, c: number, d: number) => void;
|
|
256
|
+
readonly __wasm_bindgen_func_elem_192: (a: number, b: number, c: number) => void;
|
|
257
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
258
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
259
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
260
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
261
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
262
|
+
readonly __wbindgen_start: () => void;
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
257
266
|
|
|
258
267
|
/**
|
|
259
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
260
|
-
* a precompiled `WebAssembly.Module`.
|
|
261
|
-
*
|
|
262
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
263
|
-
*
|
|
264
|
-
* @returns {InitOutput}
|
|
265
|
-
*/
|
|
268
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
269
|
+
* a precompiled `WebAssembly.Module`.
|
|
270
|
+
*
|
|
271
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
272
|
+
*
|
|
273
|
+
* @returns {InitOutput}
|
|
274
|
+
*/
|
|
266
275
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
267
276
|
|
|
268
277
|
/**
|
|
269
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
270
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
271
|
-
*
|
|
272
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
273
|
-
*
|
|
274
|
-
* @returns {Promise<InitOutput>}
|
|
275
|
-
*/
|
|
278
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
279
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
280
|
+
*
|
|
281
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
282
|
+
*
|
|
283
|
+
* @returns {Promise<InitOutput>}
|
|
284
|
+
*/
|
|
276
285
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|