Skip to content

feat: add @nicia-ai/typegraph/sqlite/libsql convenience export#80

Merged
pdlug merged 1 commit into
mainfrom
feat/libsql-backend
Apr 6, 2026
Merged

feat: add @nicia-ai/typegraph/sqlite/libsql convenience export#80
pdlug merged 1 commit into
mainfrom
feat/libsql-backend

Conversation

@pdlug
Copy link
Copy Markdown
Contributor

@pdlug pdlug commented Apr 6, 2026

Adds a first-class libsql backend export at @nicia-ai/typegraph/sqlite/libsql.

  • createLibsqlBackend(client, options?) — async factory that wraps @libsql/client with automatic DDL execution, correct async execution profile (isSync: false, transactionMode: "drizzle"), and managed lifecycle (idempotent close that also closes the client)
  • Drizzle bug fixes affecting all async SQLite drivers:
  • wrapWithManagedClose() helper extracted from duplicated pattern in local.ts and new libsql.ts
  • Async test suite support — shared adapter/integration suites now accept async factories
  • Full test coverage — libsql runs the same 214-test shared suite as SQLite and PostgreSQL
  • Docs updated: backend-setup, getting-started, limitations (including in-memory transaction caveat from tursodatabase/libsql-client-ts#229)
  • @libsql/client added as optional peer dependency

Closes #79

@pdlug pdlug force-pushed the feat/libsql-backend branch 2 times, most recently from edf4271 to c290d51 Compare April 6, 2026 22:37
Add first-class libsql backend with automatic DDL execution, async
execution profile, and caller-retained client ownership for shared-driver
setups. Fix Drizzle bugs affecting all async SQLite drivers.

New export:
- createLibsqlBackend() at @nicia-ai/typegraph/sqlite/libsql
- Caller owns the client lifecycle, enabling shared connections
- @libsql/client added as optional peer dependency

Bug fixes:
- bootstrapTables() now awaits db.run() for async drivers
- execGet uses db.all()[0] instead of db.get() to avoid Drizzle
  normalizeRow crash on empty results (drizzle-team/drizzle-orm#1049)
- All SQLite exec helpers use unconditional await instead of
  instanceof Promise check (drizzle-team/drizzle-orm#2275)

Internal:
- Extract wrapWithManagedClose() shared helper
- Widen shared test suite factories to accept async backends
- libsql runs full adapter + integration suites (214 tests)
- Document libsql support in backend-setup, getting-started, limitations
@pdlug pdlug force-pushed the feat/libsql-backend branch from c290d51 to 1d86604 Compare April 6, 2026 22:39
@pdlug pdlug merged commit 0845fa9 into main Apr 6, 2026
10 checks passed
@pdlug pdlug deleted the feat/libsql-backend branch April 6, 2026 22:46
@github-actions github-actions Bot mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add @nicia-ai/typegraph/sqlite/libsql convenience export

1 participant