@livestore/wa-sqlite 1.0.1-dev.23 → 1.0.1-dev.25
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 +1 -1
- package/src/sqlite-api.js +9 -2
- package/src/types/index.d.ts +4 -0
package/package.json
CHANGED
package/src/sqlite-api.js
CHANGED
|
@@ -936,11 +936,18 @@ export function Factory(Module) {
|
|
|
936
936
|
};
|
|
937
937
|
})();
|
|
938
938
|
|
|
939
|
+
const registeredVfs = new Set();
|
|
940
|
+
|
|
939
941
|
sqlite3.vfs_register = function(vfs, makeDefault) {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
+
if (registeredVfs.has(vfs.name)) return
|
|
943
|
+
const result = Module.vfs_register(vfs.name, makeDefault);
|
|
944
|
+
const res = check('sqlite3_vfs_register', result);
|
|
945
|
+
registeredVfs.add(vfs);
|
|
946
|
+
return res
|
|
942
947
|
};
|
|
943
948
|
|
|
949
|
+
sqlite3.vfs_registered = registeredVfs;
|
|
950
|
+
|
|
944
951
|
function check(fname, result, db = null, allowed = [SQLite.SQLITE_OK]) {
|
|
945
952
|
if (allowed.includes(result)) return result;
|
|
946
953
|
const message = db ?
|
package/src/types/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ interface SQLiteVFS {
|
|
|
37
37
|
/** Maximum length of a file path in UTF-8 bytes (default 64) */
|
|
38
38
|
mxPathName?: number;
|
|
39
39
|
|
|
40
|
+
name: string;
|
|
41
|
+
|
|
40
42
|
close(): void|Promise<void>;
|
|
41
43
|
isReady(): boolean|Promise<boolean>;
|
|
42
44
|
|
|
@@ -891,6 +893,8 @@ interface SQLiteAPI {
|
|
|
891
893
|
* @returns `SQLITE_OK` (throws exception on error)
|
|
892
894
|
*/
|
|
893
895
|
vfs_register(vfs: SQLiteVFS, makeDefault?: boolean): number;
|
|
896
|
+
|
|
897
|
+
vfs_registered: Set<string>;
|
|
894
898
|
}
|
|
895
899
|
|
|
896
900
|
declare module '@livestore/wa-sqlite' {
|