attempting to resurrect full beans

This commit is contained in:
authentik Default Admin 2026-03-04 18:26:43 -08:00
parent bceee7ecf1
commit a961f387d6
9 changed files with 170 additions and 65 deletions

33
store/idb.js Normal file
View file

@ -0,0 +1,33 @@
// lib/idb.js
import { createStore, get, set, del, entries, clear } from 'idb-keyval'
// Named stores — each maps to a distinct IDBObjectStore
export const itemsStore = createStore('app-db', 'items')
export const userStore = createStore('app-db', 'user')
export const cacheStore = createStore('app-db', 'cache')
// Typed wrappers — keeps raw idb-keyval calls out of the rest of the app
// and gives you one place to add validation, logging, or migration logic
export const db = {
items: {
getAll: () => entries(itemsStore),
get: (id) => get(id, itemsStore),
set: (id, value) => set(id, value, itemsStore),
remove: (id) => del(id, itemsStore),
clear: () => clear(itemsStore),
},
user: {
get: () => get('user', userStore),
set: (value) => set('user', value, userStore),
clear: () => del('user', userStore),
},
cache: {
get: (key) => get(key, cacheStore),
set: (key, value) => set(key, value, cacheStore),
remove: (key) => del(key, cacheStore),
clear: () => clear(cacheStore),
}
}