@livestore/wa-sqlite 1.0.1-dev.22 → 1.0.1-dev.24

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/sqlite-api.js +6 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/wa-sqlite",
3
- "version": "1.0.1-dev.22",
3
+ "version": "1.0.1-dev.24",
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
@@ -273,19 +273,6 @@ export function Factory(Module) {
273
273
  };
274
274
  })();
275
275
 
276
- // sqlite3.serialize = (function() {
277
- // const fname = 'sqlite3_serialize';
278
- // const f = Module.cwrap(fname, ...decl('nsnn:n'));
279
- // return function(db, schema, flags) {
280
- // verifyDatabase(db);
281
- // const piSize = tmpPtr[0];
282
- // const address = f(db, schema, piSize, flags);
283
- // const size = Module.getValue(piSize, '*');
284
- // const result = Module.HEAPU8.subarray(address, address + size);
285
- // return result;
286
- // };
287
- // })();
288
-
289
276
  sqlite3.backup = (function() {
290
277
  const fInit = Module.cwrap('sqlite3_backup_init', ...decl('nsns:n'));
291
278
  const fStep = Module.cwrap('sqlite3_backup_step', ...decl('nn:n'));
@@ -949,9 +936,14 @@ export function Factory(Module) {
949
936
  };
950
937
  })();
951
938
 
939
+ const registeredVfs = new Set();
940
+
952
941
  sqlite3.vfs_register = function(vfs, makeDefault) {
942
+ if (registeredVfs.has(vfs)) return
953
943
  const result = Module.vfs_register(vfs, makeDefault);
954
- return check('sqlite3_vfs_register', result);
944
+ const res = check('sqlite3_vfs_register', result);
945
+ registeredVfs.add(vfs);
946
+ return res
955
947
  };
956
948
 
957
949
  function check(fname, result, db = null, allowed = [SQLite.SQLITE_OK]) {