import * as dexie from "https://unpkg.com/dexie@3.2.3/dist/modern/dexie.mjs"; import { NostrEvent } from "../lib/nostr-ts/nostr.ts"; export class DexieDatabase extends dexie.Dexie { // 'friends' is added by dexie when declaring the stores() // We just tell the typing system this is the case // @ts-ignore events!: dexie.Table; constructor() { super("Events"); this.version(6).stores({ events: "&id, created_at, kind, tags, pubkey", // indices }); } } export function NewIndexedDB(): DexieDatabase | Error { try { const db = new DexieDatabase(); return db; } catch (e) { return e; } }