MCPcopy
hub / github.com/microsoft/data-formulator / openDB

Function openDB

src/app/workspaceDB.ts:51–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51function openDB(): Promise<IDBDatabase> {
52 return new Promise((resolve, reject) => {
53 const req = indexedDB.open(DB_NAME, DB_VERSION);
54 req.onupgradeneeded = () => {
55 const db = req.result;
56 if (!db.objectStoreNames.contains(STORE_WORKSPACES)) {
57 db.createObjectStore(STORE_WORKSPACES, { keyPath: 'id' });
58 }
59 if (!db.objectStoreNames.contains(STORE_TABLE_DATA)) {
60 const tableStore = db.createObjectStore(STORE_TABLE_DATA, { keyPath: 'key' });
61 tableStore.createIndex('workspaceId', 'workspaceId', { unique: false });
62 }
63 };
64 req.onsuccess = () => resolve(req.result);
65 req.onerror = () => reject(req.error);
66 });
67}
68
69function txStore(
70 db: IDBDatabase,

Callers 7

listFunction · 0.85
loadFunction · 0.85
saveFunction · 0.85
deleteFunction · 0.85
updateDisplayNameFunction · 0.85
loadAllFunction · 0.85
deleteAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected