Compare commits
2 Commits
claim-view
...
sql-wa-sql
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d7bc5f728 | |||
| 753d178fc3 |
@@ -123,6 +123,7 @@
|
||||
"vue-picture-cropper": "^0.7.0",
|
||||
"vue-qrcode-reader": "^5.5.3",
|
||||
"vue-router": "^4.5.0",
|
||||
"wa-sqlite": "github:rhashimoto/wa-sqlite",
|
||||
"web-did-resolver": "^2.0.27",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
|
||||
28
src/db-sql/index.ts
Normal file
28
src/db-sql/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
// Started with https://rhashimoto.github.io/wa-sqlite/docs/interfaces/SQLiteAPI.html
|
||||
// and then https://github.com/rhashimoto/wa-sqlite/blob/master/demo/demo-worker.js
|
||||
|
||||
import SQLiteESMFactory from 'wa-sqlite/dist/wa-sqlite.mjs';
|
||||
|
||||
import * as SQLite from 'wa-sqlite';
|
||||
|
||||
const IDBBatchAtomicVFS = await import('wa-sqlite/src/examples/IDBBatchAtomicVFS.js');
|
||||
|
||||
let db: any;
|
||||
|
||||
export async function sql() {
|
||||
if (!db) {
|
||||
const module = await SQLiteESMFactory();
|
||||
|
||||
// Use the module to build the API instance.
|
||||
const sqlite3 = SQLite.Factory(module);
|
||||
|
||||
const vfs = new IDBBatchAtomicVFS.create("IDBBatchAtomicVFS", module, { lockPolicy: 'shared+hint' });
|
||||
sqlite3.vfs_register(vfs, true);
|
||||
|
||||
// Use the API to open and access a database.
|
||||
const db = await sqlite3.open_v2("myDB");
|
||||
console.log("----- sqlite3 db", db);
|
||||
sqlite3.close(db);
|
||||
}
|
||||
return db;
|
||||
}
|
||||
5
src/types/wa-sqlite.d.ts
vendored
Normal file
5
src/types/wa-sqlite.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare module "wa-sqlite/src/examples/IDBBatchAtomicVFS.js" {
|
||||
export const create: {
|
||||
new (name: string, module: any, options?: { lockPolicy?: string }): any;
|
||||
};
|
||||
}
|
||||
@@ -996,6 +996,7 @@ import {
|
||||
retrieveSettingsForActiveAccount,
|
||||
updateAccountSettings,
|
||||
} from "../db/index";
|
||||
import { sql } from "../db-sql/index";
|
||||
import { Account } from "../db/tables/accounts";
|
||||
import { Contact } from "../db/tables/contacts";
|
||||
import {
|
||||
@@ -1202,6 +1203,8 @@ export default class AccountViewView extends Vue {
|
||||
);
|
||||
}
|
||||
this.passkeyExpirationDescription = tokenExpiryTimeDescription();
|
||||
const db = await sql();
|
||||
console.log("----- db", db);
|
||||
}
|
||||
|
||||
beforeUnmount() {
|
||||
|
||||
Reference in New Issue
Block a user