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.
@@ -4,7 +4,7 @@
4
4
  "RuVector Contributors"
5
5
  ],
6
6
  "description": "Standalone vector database with SQL, SPARQL, and Cypher - powered by RuVector WASM",
7
- "version": "0.3.0",
7
+ "version": "0.3.1",
8
8
  "license": "MIT OR Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
@@ -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
- free(): void;
6
- [Symbol.dispose](): void;
7
- /**
8
- * Create a new Cypher engine with empty graph
9
- */
10
- constructor();
11
- /**
12
- * Clear the graph
13
- */
14
- clear(): void;
15
- /**
16
- * Get graph statistics
17
- */
18
- stats(): any;
19
- /**
20
- * Execute a Cypher query and return JSON results
21
- */
22
- execute(query: string): any;
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
- free(): void;
27
- [Symbol.dispose](): void;
28
- /**
29
- * Add an RDF triple
30
- *
31
- * # Arguments
32
- * * `subject` - Subject IRI or blank node (e.g., "<http://example.org/s>" or "_:b1")
33
- * * `predicate` - Predicate IRI (e.g., "<http://example.org/p>")
34
- * * `object` - Object IRI, blank node, or literal (e.g., "<http://example.org/o>" or '"value"')
35
- */
36
- add_triple(subject: string, predicate: string, object: string): void;
37
- /**
38
- * Get configuration
39
- */
40
- get_config(): any;
41
- /**
42
- * Export database state as JSON (for manual backup)
43
- */
44
- export_json(): any;
45
- /**
46
- * Get version string
47
- */
48
- get_version(): string;
49
- /**
50
- * Import database state from JSON
51
- */
52
- import_json(json: any): void;
53
- /**
54
- * Clear the Cypher graph
55
- */
56
- cypher_clear(): void;
57
- /**
58
- * Get Cypher graph statistics
59
- */
60
- cypher_stats(): any;
61
- /**
62
- * Get enabled features
63
- */
64
- get_features(): any;
65
- /**
66
- * Initialize IndexedDB storage for persistence
67
- * Must be called before save() or load()
68
- */
69
- init_storage(): Promise<any>;
70
- /**
71
- * Get the number of triples in the store
72
- */
73
- triple_count(): number;
74
- /**
75
- * Clear saved state from IndexedDB
76
- */
77
- static clear_storage(): Promise<any>;
78
- /**
79
- * Clear all triples
80
- */
81
- clear_triples(): void;
82
- /**
83
- * Insert a vector with a specific ID
84
- */
85
- insert_with_id(id: string, vector: Float32Array, metadata: any): void;
86
- /**
87
- * Check if saved state exists in IndexedDB
88
- */
89
- static has_saved_state(): Promise<any>;
90
- /**
91
- * Search with metadata filter
92
- */
93
- search_with_filter(query_vector: Float32Array, k: number, filter: any): any;
94
- /**
95
- * Check if IndexedDB is available in the browser
96
- */
97
- static is_storage_available(): boolean;
98
- /**
99
- * Get a vector by ID
100
- */
101
- get(id: string): any;
102
- /**
103
- * Get the number of vectors in the database
104
- */
105
- len(): number;
106
- /**
107
- * Create a new RvLite database
108
- */
109
- constructor(config: RvLiteConfig);
110
- /**
111
- * Execute SQL query
112
- *
113
- * Supported syntax:
114
- * - CREATE TABLE vectors (id TEXT PRIMARY KEY, vector VECTOR(384))
115
- * - SELECT * FROM vectors WHERE id = 'x'
116
- * - SELECT id, vector <-> '[...]' AS distance FROM vectors ORDER BY distance LIMIT 10
117
- * - INSERT INTO vectors (id, vector) VALUES ('x', '[...]')
118
- * - DELETE FROM vectors WHERE id = 'x'
119
- */
120
- sql(query: string): any;
121
- /**
122
- * Load database from IndexedDB
123
- * Returns a Promise<RvLite> with the restored database
124
- */
125
- static load(config: RvLiteConfig): Promise<any>;
126
- /**
127
- * Save database state to IndexedDB
128
- * Returns a Promise that resolves when save is complete
129
- */
130
- save(): Promise<any>;
131
- /**
132
- * Execute Cypher query
133
- *
134
- * Supported operations:
135
- * - CREATE (n:Label {prop: value})
136
- * - MATCH (n:Label) WHERE n.prop = value RETURN n
137
- * - CREATE (a)-[r:REL]->(b)
138
- * - DELETE n
139
- */
140
- cypher(query: string): any;
141
- /**
142
- * Delete a vector by ID
143
- */
144
- delete(id: string): boolean;
145
- /**
146
- * Insert a vector with optional metadata
147
- * Returns the vector ID
148
- */
149
- insert(vector: Float32Array, metadata: any): string;
150
- /**
151
- * Search for similar vectors
152
- */
153
- search(query_vector: Float32Array, k: number): any;
154
- /**
155
- * Execute SPARQL query
156
- *
157
- * Supported operations:
158
- * - SELECT ?s ?p ?o WHERE { ?s ?p ?o }
159
- * - SELECT ?s WHERE { ?s <predicate> ?o }
160
- * - ASK { ?s ?p ?o }
161
- */
162
- sparql(query: string): any;
163
- /**
164
- * Create with default configuration (384 dimensions, cosine similarity)
165
- */
166
- static default(): RvLite;
167
- /**
168
- * Check if database is empty
169
- */
170
- is_empty(): boolean;
171
- /**
172
- * Check if database is ready
173
- */
174
- is_ready(): boolean;
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
- free(): void;
179
- [Symbol.dispose](): void;
180
- /**
181
- * Get dimensions
182
- */
183
- get_dimensions(): number;
184
- /**
185
- * Get distance metric name
186
- */
187
- get_distance_metric(): string;
188
- /**
189
- * Set distance metric (euclidean, cosine, dotproduct, manhattan)
190
- */
191
- with_distance_metric(metric: string): RvLiteConfig;
192
- constructor(dimensions: number);
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
- readonly memory: WebAssembly.Memory;
201
- readonly __wbg_cypherengine_free: (a: number, b: number) => void;
202
- readonly __wbg_rvlite_free: (a: number, b: number) => void;
203
- readonly __wbg_rvliteconfig_free: (a: number, b: number) => void;
204
- readonly cypherengine_clear: (a: number) => void;
205
- readonly cypherengine_execute: (a: number, b: number, c: number, d: number) => void;
206
- readonly cypherengine_new: () => number;
207
- readonly cypherengine_stats: (a: number, b: number) => void;
208
- readonly rvlite_add_triple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
209
- readonly rvlite_clear_triples: (a: number) => void;
210
- readonly rvlite_cypher: (a: number, b: number, c: number, d: number) => void;
211
- readonly rvlite_cypher_clear: (a: number) => void;
212
- readonly rvlite_cypher_stats: (a: number, b: number) => void;
213
- readonly rvlite_default: (a: number) => void;
214
- readonly rvlite_delete: (a: number, b: number, c: number, d: number) => void;
215
- readonly rvlite_export_json: (a: number, b: number) => void;
216
- readonly rvlite_get: (a: number, b: number, c: number, d: number) => void;
217
- readonly rvlite_get_config: (a: number, b: number) => void;
218
- readonly rvlite_get_features: (a: number, b: number) => void;
219
- readonly rvlite_get_version: (a: number, b: number) => void;
220
- readonly rvlite_import_json: (a: number, b: number, c: number) => void;
221
- readonly rvlite_init_storage: (a: number) => number;
222
- readonly rvlite_insert: (a: number, b: number, c: number, d: number, e: number) => void;
223
- readonly rvlite_insert_with_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
224
- readonly rvlite_is_empty: (a: number, b: number) => void;
225
- readonly rvlite_is_ready: (a: number) => number;
226
- readonly rvlite_is_storage_available: () => number;
227
- readonly rvlite_len: (a: number, b: number) => void;
228
- readonly rvlite_load: (a: number) => number;
229
- readonly rvlite_new: (a: number, b: number) => void;
230
- readonly rvlite_save: (a: number) => number;
231
- readonly rvlite_search: (a: number, b: number, c: number, d: number, e: number) => void;
232
- readonly rvlite_search_with_filter: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
233
- readonly rvlite_sparql: (a: number, b: number, c: number, d: number) => void;
234
- readonly rvlite_sql: (a: number, b: number, c: number, d: number) => void;
235
- readonly rvlite_triple_count: (a: number) => number;
236
- readonly rvliteconfig_get_dimensions: (a: number) => number;
237
- readonly rvliteconfig_get_distance_metric: (a: number, b: number) => void;
238
- readonly rvliteconfig_new: (a: number) => number;
239
- readonly rvliteconfig_with_distance_metric: (a: number, b: number, c: number) => number;
240
- readonly init: () => void;
241
- readonly rvlite_clear_storage: () => number;
242
- readonly rvlite_has_saved_state: () => number;
243
- readonly __wasm_bindgen_func_elem_1339: (a: number, b: number, c: number) => void;
244
- readonly __wasm_bindgen_func_elem_1338: (a: number, b: number) => void;
245
- readonly __wasm_bindgen_func_elem_180: (a: number, b: number, c: number) => void;
246
- readonly __wasm_bindgen_func_elem_179: (a: number, b: number) => void;
247
- readonly __wasm_bindgen_func_elem_1385: (a: number, b: number, c: number, d: number) => void;
248
- readonly __wbindgen_export: (a: number, b: number) => number;
249
- readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
250
- readonly __wbindgen_export3: (a: number) => void;
251
- readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
252
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
253
- readonly __wbindgen_start: () => void;
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>;