You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
README browser example uses MiniGrafDb.inMemory(), but @minigraf/browser exports BrowserDb #5
The package actually exports (from minigraf_wasm.d.ts in 2.0.4):
BrowserDb, not MiniGrafDb
BrowserDb.open(dbName) (IndexedDB-backed, returns a Promise<BrowserDb>)
BrowserDb.openInMemory() (not inMemory())
execute() returns a Promise<string>, so it needs await
MiniGrafDb with inMemory() and a synchronous execute() is the Node binding's API (minigraf on npm), so the example looks copied from there.
Suggested example:
importinit,{BrowserDb}from'@minigraf/browser'awaitinit()constdb=awaitBrowserDb.open('mydb')// or BrowserDb.openInMemory() for testsawaitdb.execute('(transact [[:alice :name "Alice"]])')constresult=JSON.parse(awaitdb.execute('(query [:find ?n :where [?e :name ?n]])'))console.log(result.results[0][0])// "Alice"
It may also be worth mentioning exportGraph() / importGraph() and checkpoint(), which the README doesn't cover.
Checked against:@minigraf/browser@2.0.4 from npm. I confirmed BrowserDb.openInMemory() and await db.execute(...) work by loading the package with initSync in Node 24. minigraf-playground/lib/wasm-loader.ts also uses BrowserDb.open.
Activity