import { getDb, type RelayRecord } from '../database'; import { normalizeRelayUrl } from '$lib/utils/relay-url'; /** storage for the relays the user has added. */ export const relayRepository = { async list(): Promise { return getDb().relays.orderBy('addedAt').toArray(); }, async add(url: string): Promise { const normalized = normalizeRelayUrl(url); await getDb().relays.put({ url: normalized, addedAt: Date.now() }); }, async remove(url: string): Promise { await getDb().relays.delete(normalizeRelayUrl(url)); } };