@livestore/wa-sqlite 1.0.1-dev.1 → 1.0.1-dev.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/wa-sqlite",
3
- "version": "1.0.1-dev.1",
3
+ "version": "1.0.1-dev.3",
4
4
  "type": "module",
5
5
  "main": "src/sqlite-api.js",
6
6
  "types": "src/types/index.d.ts",
package/src/sqlite-api.js CHANGED
@@ -237,6 +237,18 @@ export function Factory(Module) {
237
237
  };
238
238
  })();
239
239
 
240
+ sqlite3.deserialize = (function() {
241
+ const fname = 'sqlite3_deserialize';
242
+ const f = Module.cwrap(fname, ...decl('nnnnnn:n'));
243
+ return function(db, schema, data, szDb, szBuf, flags) {
244
+ verifyDatabase(db);
245
+ const ptr = Module._sqlite3_malloc(szDb);
246
+ Module.HEAPU8.subarray(ptr).set(data);
247
+ const result = f(db, schema, ptr, szDb, szBuf, flags);
248
+ return result;
249
+ };
250
+ })();
251
+
240
252
  sqlite3.clear_bindings = (function() {
241
253
  const fname = 'sqlite3_clear_bindings';
242
254
  const f = Module.cwrap(fname, ...decl('n:n'));
@@ -330,6 +330,27 @@ declare interface SQLiteAPI {
330
330
  */
331
331
  changes(db): number;
332
332
 
333
+ /**
334
+ * https://www.sqlite.org/c3ref/deserialize.html
335
+ * int sqlite3_deserialize(
336
+ * sqlite3 *db, The database connection
337
+ * const char *zSchema, Which DB to reopen with the deserialization
338
+ * unsigned char *pData, The serialized database content
339
+ * sqlite3_int64 szDb, Number bytes in the deserialization
340
+ * sqlite3_int64 szBuf, Total size of buffer pData[]
341
+ * unsigned mFlags Zero or more SQLITE_DESERIALIZE_* flags
342
+ * );
343
+ */
344
+
345
+ deserialize(
346
+ db: number,
347
+ zSchema: string,
348
+ pData: Uint8Array,
349
+ szDb: number,
350
+ szBuf: number,
351
+ mFlags: number
352
+ ): number;
353
+
333
354
  /**
334
355
  * Reset all bindings on a prepared statement.
335
356
  * @see https://www.sqlite.org/c3ref/clear_bindings.html
@@ -725,7 +746,7 @@ declare interface SQLiteAPI {
725
746
  * @param options
726
747
  */
727
748
  // statements(db: number, sql: string, options?: SQLitePrepareOptions): AsyncIterable<number>;
728
- statements(db: number, sql: string, options?: SQLitePrepareOptions): Iterable<number>;
749
+ statements(db: number, sql: string, options?: SQLitePrepareOptions): ReadonlyArray<number>;
729
750
 
730
751
  /**
731
752
  * Evaluate an SQL statement
@@ -1207,7 +1228,7 @@ declare module '@livestore/wa-sqlite/src/VFS.js' {
1207
1228
 
1208
1229
  /** @ignore */
1209
1230
  declare module '@livestore/wa-sqlite/src/examples/IndexedDbVFS.js' {
1210
- import * as VFS from "wa-sqlite/src/VFS.js";
1231
+ import * as VFS from "@livestore/wa-sqlite/src/VFS.js";
1211
1232
  export class IndexedDbVFS extends VFS.Base {
1212
1233
  /**
1213
1234
  * @param {string} idbName Name of IndexedDB database.
@@ -1261,7 +1282,7 @@ declare module '@livestore/wa-sqlite/src/examples/IndexedDbVFS.js' {
1261
1282
 
1262
1283
  /** @ignore */
1263
1284
  declare module '@livestore/wa-sqlite/src/examples/MemoryVFS.js' {
1264
- import * as VFS from "wa-sqlite/src/VFS.js";
1285
+ import * as VFS from "@livestore/wa-sqlite/src/VFS.js";
1265
1286
  /** @ignore */
1266
1287
  export class MemoryVFS extends VFS.Base {
1267
1288
  name: string;
@@ -1272,7 +1293,7 @@ declare module '@livestore/wa-sqlite/src/examples/MemoryVFS.js' {
1272
1293
 
1273
1294
  /** @ignore */
1274
1295
  declare module '@livestore/wa-sqlite/src/examples/MemoryAsyncVFS.js' {
1275
- import { MemoryVFS } from "wa-sqlite/src/examples/MemoryVFS.js";
1296
+ import { MemoryVFS } from "@livestore/wa-sqlite/src/examples/MemoryVFS.js";
1276
1297
  export class MemoryAsyncVFS extends MemoryVFS {
1277
1298
  }
1278
1299
  }