To dump all IndexedDB data to console:
(() => {
const asyncForEach = (array, callback, done) => {
const runAndWait = i => {
if (i === array.length) return done();
return callback(array[i], () => runAndWait(i + 1));
};
return runAndWait(0);
};
const dump = {};
const dbRequest = window.indexedDB.open("Prisma Studio");
dbRequest.onsuccess = () => {
const db = dbRequest.result;
const stores = Array.from(db.objectStoreNames);
const tx = db.transaction(stores);
asyncForEach(
stores,
(store, next) => {
const req = tx.objectStore(store).getAll();
req.onsuccess = () => {
dump[store] = req.result;
next();
};
},
() => {
console.log(JSON.stringify(dump));
}
);
};
})();