Draft
Conversation
9 tasks
- Add await to all async DB methods: createNode, getNode, updateNode, deleteNode, createEdge, getEdge, deleteEdge, export, import, close, mergeNode, mergeEdge, createPropertyIndex, listIndexes, dropIndex - Make transaction callbacks async with await on inner calls - Await NodeQuery terminal methods: exec(), first(), count(), exists() - Await TraversalQuery terminal methods: toArray(), toPaths(), etc. - Make beforeEach/afterEach/it() callbacks async where needed - Transform expect(() => asyncMethod()).toThrow() to rejects.toThrow() - Handle Array.from/map with async callbacks using Promise.all - Convert forEach(async ...) to await Promise.all(arr.map(async ...)) - PatternQuery.exec/first/count remain synchronous (no await) - traverse() sync validation unchanged Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: michaeloboyle <61171+michaeloboyle@users.noreply.github.com>
Agent-Logs-Url: https://github.com/michaeloboyle/sqlite-graph/sessions/c2e30f86-7c89-4c8c-a70d-c9ff39267e19 Co-authored-by: michaeloboyle <61171+michaeloboyle@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement async Database API for browser compatibility
Implement async Database API (breaking change)
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts all
GraphDatabasepublic methods from synchronous to async-returning Promises, enabling browser WASM compatibility where synchronous file I/O is unavailable.API Changes
Migration example
src/core/Database.tsstatic async create(path, options?)factory method_getNodeSync()helper for internal sync node lookups (avoids async chains inside CRUD methods that need to validate node existence)createNode,getNode,updateNode,deleteNode,createEdge,getEdge,deleteEdge,transaction,export,import,close,mergeNode,mergeEdge,createPropertyIndex,listIndexes,dropIndextraverse()andnodes()remain synchronous — they return builder objects with no I/O;traverse()still validates node existence via directdb.prepare()calltransaction()callback now acceptsT | Promise<T>, enabling async operations inside transactionspattern()(Record<string, unknown>→Record<string, GraphEntity>)src/query/NodeQuery.tsexec(),first(),count(),exists()→ asyncsrc/query/TraversalQuery.tstoArray(),toPaths(),shortestPath(),paths(),allPaths()→ asyncgetNode,getNeighbors) remain synchronousTests (11 files)
beforeEach/afterEachand test callbacks made asyncexpect(() => ...).toThrow()→await expect(...).rejects.toThrow()where neededasync (ctx) => { ... }