@grafeo-db/wasm-lite 0.5.33 → 0.5.34

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/grafeo_wasm.d.ts CHANGED
@@ -24,6 +24,10 @@ export class Database {
24
24
  * CSR adjacency, and switches to read-only mode. After this call, write
25
25
  * operations will fail. Gives ~60x memory reduction and 100x+ traversal
26
26
  * speedup for read-only workloads.
27
+ *
28
+ * # Errors
29
+ *
30
+ * Returns `JsError` if compaction fails (e.g., the database is already in compact mode).
27
31
  */
28
32
  compact(): void;
29
33
  /**
@@ -43,12 +47,20 @@ export class Database {
43
47
  * const results = db.execute("MATCH (p:Person) RETURN p.name, p.age");
44
48
  * // [{name: "Alix", age: 30}, {name: "Gus", age: 25}]
45
49
  * ```
50
+ *
51
+ * # Errors
52
+ *
53
+ * Returns `JsError` if the query fails to parse or execute.
46
54
  */
47
55
  execute(query: string): any;
48
56
  /**
49
57
  * Executes a GQL query and returns raw columns, rows, and metadata.
50
58
  *
51
59
  * Returns `{ columns: string[], rows: any[][], executionTimeMs?: number }`.
60
+ *
61
+ * # Errors
62
+ *
63
+ * Returns `JsError` if the query fails to parse or execute.
52
64
  */
53
65
  executeRaw(query: string): any;
54
66
  /**
@@ -60,6 +72,10 @@ export class Database {
60
72
  * const raw = db.executeRawWithLanguage("MATCH (p:Person) RETURN p.name", "cypher");
61
73
  * // { columns: ["p.name"], rows: [["Alix"], ["Gus"]], executionTimeMs: 0.5 }
62
74
  * ```
75
+ *
76
+ * # Errors
77
+ *
78
+ * Returns `JsError` if the language is unsupported or the query fails to parse or execute.
63
79
  */
64
80
  executeRawWithLanguage(query: string, language: string): any;
65
81
  /**
@@ -74,6 +90,10 @@ export class Database {
74
90
  * "cypher"
75
91
  * );
76
92
  * ```
93
+ *
94
+ * # Errors
95
+ *
96
+ * Returns `JsError` if the language is unsupported or the query fails to parse or execute.
77
97
  */
78
98
  executeWithLanguage(query: string, language: string): any;
79
99
  /**
@@ -88,6 +108,10 @@ export class Database {
88
108
  * { name: "Alix" }
89
109
  * );
90
110
  * ```
111
+ *
112
+ * # Errors
113
+ *
114
+ * Returns `JsError` if `params` is invalid, the language is unsupported, or the query fails.
91
115
  */
92
116
  executeWithLanguageAndParams(query: string, language: string, params: any): any;
93
117
  /**
@@ -102,6 +126,10 @@ export class Database {
102
126
  * { name: "Alix" }
103
127
  * );
104
128
  * ```
129
+ *
130
+ * # Errors
131
+ *
132
+ * Returns `JsError` if `params` is not a valid object, or if the query fails to parse or execute.
105
133
  */
106
134
  executeWithParams(query: string, params: any): any;
107
135
  /**
@@ -114,6 +142,10 @@ export class Database {
114
142
  * const bytes = db.exportSnapshot();
115
143
  * // Store in IndexedDB, download as file, etc.
116
144
  * ```
145
+ *
146
+ * # Errors
147
+ *
148
+ * Returns `JsError` if snapshot serialisation fails.
117
149
  */
118
150
  exportSnapshot(): Uint8Array;
119
151
  /**
@@ -138,6 +170,10 @@ export class Database {
138
170
  * });
139
171
  * // { nodes: 2, edges: 1 }
140
172
  * ```
173
+ *
174
+ * # Errors
175
+ *
176
+ * Returns `JsError` if `data` cannot be deserialised or if an edge references an out-of-bounds node index.
141
177
  */
142
178
  importLpg(data: any): any;
143
179
  /**
@@ -175,6 +211,14 @@ export class Database {
175
211
  * { mode: "edges", edgeType: "KNOWS", source: "from", target: "to" }
176
212
  * );
177
213
  * ```
214
+ *
215
+ * # Errors
216
+ *
217
+ * Returns `JsError` if:
218
+ * - `options` cannot be deserialised or has an invalid `mode`.
219
+ * - `rows` is not an array of objects.
220
+ * - A required column (`label`, `edgeType`, `source`, `target`) is missing.
221
+ * - A source/target value is not a valid non-negative integer.
178
222
  */
179
223
  importRows(rows: any, options: any): number;
180
224
  /**
@@ -185,10 +229,18 @@ export class Database {
185
229
  * ```js
186
230
  * const db = Database.importSnapshot(bytes);
187
231
  * ```
232
+ *
233
+ * # Errors
234
+ *
235
+ * Returns `JsError` if `data` is not a valid snapshot or deserialisation fails.
188
236
  */
189
237
  static importSnapshot(data: Uint8Array): Database;
190
238
  /**
191
239
  * Returns high-level database information (counts, mode, features).
240
+ *
241
+ * # Errors
242
+ *
243
+ * Returns `JsError` if the info data cannot be serialised to a JS value.
192
244
  */
193
245
  info(): any;
194
246
  /**
@@ -204,10 +256,18 @@ export class Database {
204
256
  * console.log(`Store: ${usage.store.total_bytes} bytes`);
205
257
  * console.log(`Indexes: ${usage.indexes.total_bytes} bytes`);
206
258
  * ```
259
+ *
260
+ * # Errors
261
+ *
262
+ * Returns `JsError` if the memory usage data cannot be serialised to a JS value.
207
263
  */
208
264
  memoryUsage(): any;
209
265
  /**
210
266
  * Creates a new in-memory database.
267
+ *
268
+ * # Errors
269
+ *
270
+ * Returns `JsError` if the database fails to initialise.
211
271
  */
212
272
  constructor();
213
273
  /**
@@ -229,6 +289,10 @@ export class Database {
229
289
  * const schema = db.schema();
230
290
  * // { lpg: { labels: [...], edgeTypes: [...], propertyKeys: [...] } }
231
291
  * ```
292
+ *
293
+ * # Errors
294
+ *
295
+ * Returns `JsError` if the schema info cannot be serialised to a JS value.
232
296
  */
233
297
  schema(): any;
234
298
  /**
package/grafeo_wasm_bg.js CHANGED
@@ -38,6 +38,10 @@ export class Database {
38
38
  * CSR adjacency, and switches to read-only mode. After this call, write
39
39
  * operations will fail. Gives ~60x memory reduction and 100x+ traversal
40
40
  * speedup for read-only workloads.
41
+ *
42
+ * # Errors
43
+ *
44
+ * Returns `JsError` if compaction fails (e.g., the database is already in compact mode).
41
45
  */
42
46
  compact() {
43
47
  try {
@@ -89,6 +93,10 @@ export class Database {
89
93
  * const results = db.execute("MATCH (p:Person) RETURN p.name, p.age");
90
94
  * // [{name: "Alix", age: 30}, {name: "Gus", age: 25}]
91
95
  * ```
96
+ *
97
+ * # Errors
98
+ *
99
+ * Returns `JsError` if the query fails to parse or execute.
92
100
  * @param {string} query
93
101
  * @returns {any}
94
102
  */
@@ -113,6 +121,10 @@ export class Database {
113
121
  * Executes a GQL query and returns raw columns, rows, and metadata.
114
122
  *
115
123
  * Returns `{ columns: string[], rows: any[][], executionTimeMs?: number }`.
124
+ *
125
+ * # Errors
126
+ *
127
+ * Returns `JsError` if the query fails to parse or execute.
116
128
  * @param {string} query
117
129
  * @returns {any}
118
130
  */
@@ -142,6 +154,10 @@ export class Database {
142
154
  * const raw = db.executeRawWithLanguage("MATCH (p:Person) RETURN p.name", "cypher");
143
155
  * // { columns: ["p.name"], rows: [["Alix"], ["Gus"]], executionTimeMs: 0.5 }
144
156
  * ```
157
+ *
158
+ * # Errors
159
+ *
160
+ * Returns `JsError` if the language is unsupported or the query fails to parse or execute.
145
161
  * @param {string} query
146
162
  * @param {string} language
147
163
  * @returns {any}
@@ -177,6 +193,10 @@ export class Database {
177
193
  * "cypher"
178
194
  * );
179
195
  * ```
196
+ *
197
+ * # Errors
198
+ *
199
+ * Returns `JsError` if the language is unsupported or the query fails to parse or execute.
180
200
  * @param {string} query
181
201
  * @param {string} language
182
202
  * @returns {any}
@@ -212,6 +232,10 @@ export class Database {
212
232
  * { name: "Alix" }
213
233
  * );
214
234
  * ```
235
+ *
236
+ * # Errors
237
+ *
238
+ * Returns `JsError` if `params` is invalid, the language is unsupported, or the query fails.
215
239
  * @param {string} query
216
240
  * @param {string} language
217
241
  * @param {any} params
@@ -248,6 +272,10 @@ export class Database {
248
272
  * { name: "Alix" }
249
273
  * );
250
274
  * ```
275
+ *
276
+ * # Errors
277
+ *
278
+ * Returns `JsError` if `params` is not a valid object, or if the query fails to parse or execute.
251
279
  * @param {string} query
252
280
  * @param {any} params
253
281
  * @returns {any}
@@ -279,6 +307,10 @@ export class Database {
279
307
  * const bytes = db.exportSnapshot();
280
308
  * // Store in IndexedDB, download as file, etc.
281
309
  * ```
310
+ *
311
+ * # Errors
312
+ *
313
+ * Returns `JsError` if snapshot serialisation fails.
282
314
  * @returns {Uint8Array}
283
315
  */
284
316
  exportSnapshot() {
@@ -321,6 +353,10 @@ export class Database {
321
353
  * });
322
354
  * // { nodes: 2, edges: 1 }
323
355
  * ```
356
+ *
357
+ * # Errors
358
+ *
359
+ * Returns `JsError` if `data` cannot be deserialised or if an edge references an out-of-bounds node index.
324
360
  * @param {any} data
325
361
  * @returns {any}
326
362
  */
@@ -374,6 +410,14 @@ export class Database {
374
410
  * { mode: "edges", edgeType: "KNOWS", source: "from", target: "to" }
375
411
  * );
376
412
  * ```
413
+ *
414
+ * # Errors
415
+ *
416
+ * Returns `JsError` if:
417
+ * - `options` cannot be deserialised or has an invalid `mode`.
418
+ * - `rows` is not an array of objects.
419
+ * - A required column (`label`, `edgeType`, `source`, `target`) is missing.
420
+ * - A source/target value is not a valid non-negative integer.
377
421
  * @param {any} rows
378
422
  * @param {any} options
379
423
  * @returns {number}
@@ -401,6 +445,10 @@ export class Database {
401
445
  * ```js
402
446
  * const db = Database.importSnapshot(bytes);
403
447
  * ```
448
+ *
449
+ * # Errors
450
+ *
451
+ * Returns `JsError` if `data` is not a valid snapshot or deserialisation fails.
404
452
  * @param {Uint8Array} data
405
453
  * @returns {Database}
406
454
  */
@@ -423,6 +471,10 @@ export class Database {
423
471
  }
424
472
  /**
425
473
  * Returns high-level database information (counts, mode, features).
474
+ *
475
+ * # Errors
476
+ *
477
+ * Returns `JsError` if the info data cannot be serialised to a JS value.
426
478
  * @returns {any}
427
479
  */
428
480
  info() {
@@ -453,6 +505,10 @@ export class Database {
453
505
  * console.log(`Store: ${usage.store.total_bytes} bytes`);
454
506
  * console.log(`Indexes: ${usage.indexes.total_bytes} bytes`);
455
507
  * ```
508
+ *
509
+ * # Errors
510
+ *
511
+ * Returns `JsError` if the memory usage data cannot be serialised to a JS value.
456
512
  * @returns {any}
457
513
  */
458
514
  memoryUsage() {
@@ -472,6 +528,10 @@ export class Database {
472
528
  }
473
529
  /**
474
530
  * Creates a new in-memory database.
531
+ *
532
+ * # Errors
533
+ *
534
+ * Returns `JsError` if the database fails to initialise.
475
535
  */
476
536
  constructor() {
477
537
  try {
@@ -515,6 +575,10 @@ export class Database {
515
575
  * const schema = db.schema();
516
576
  * // { lpg: { labels: [...], edgeTypes: [...], propertyKeys: [...] } }
517
577
  * ```
578
+ *
579
+ * # Errors
580
+ *
581
+ * Returns `JsError` if the schema info cannot be serialised to a JS value.
518
582
  * @returns {any}
519
583
  */
520
584
  schema() {
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grafeo-db/wasm-lite",
3
3
  "type": "module",
4
- "version": "0.5.33",
4
+ "version": "0.5.34",
5
5
  "description": "WebAssembly bindings for Grafeo - GQL-only lightweight variant",
6
6
  "keywords": [
7
7
  "graph",