MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / openEditHistoryDb

Function openEditHistoryDb

packages/studio/src/utils/editHistoryStorage.ts:28–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function openEditHistoryDb(): Promise<IDBDatabase> {
29 return new Promise((resolve, reject) => {
30 if (!globalThis.indexedDB) {
31 reject(new Error("IndexedDB is not available"));
32 return;
33 }
34
35 const request = globalThis.indexedDB.open(DB_NAME, DB_VERSION);
36 request.onupgradeneeded = () => {
37 const db = request.result;
38 if (!db.objectStoreNames.contains(STORE_NAME)) {
39 db.createObjectStore(STORE_NAME);
40 }
41 };
42 request.onerror = () => reject(request.error ?? new Error("Failed to open edit history db"));
43 request.onsuccess = () => resolve(request.result);
44 });
45}
46
47function withStore<T>(
48 mode: IDBTransactionMode,

Callers 1

withStoreFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected