feat(sql-tursodatabase): add @effect/sql-tursodatabase driver for the Rust Turso engine#6522
feat(sql-tursodatabase): add @effect/sql-tursodatabase driver for the Rust Turso engine#6522artile wants to merge 2 commits into
Conversation
… Rust Turso engine
🦋 Changeset detectedLatest commit: 0eacaa7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds ChangesTurso Database SQL Driver
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Application
participant TursoClient
participant TursoDatabase
Application->>TursoClient: Execute SQL effect
TursoClient->>TursoDatabase: Prepare and execute statement
TursoDatabase-->>TursoClient: Return rows or metadata
TursoClient-->>Application: Return result or SqlError
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
packages/sql/tursodatabase/src/TursoClient.ts (1)
136-146: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer
Effect.fnUntracedover a function that only returnsEffect.gen.
makeis a plain arrow function whose body is solely anEffect.gencall.As per coding guidelines, "In Effect TypeScript code, prefer
Effect.fnUntracedover functions that only returnEffect.gen".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/sql/tursodatabase/src/TursoClient.ts` around lines 136 - 146, Update the TursoClient make function to use Effect.fnUntraced rather than a plain arrow function wrapping Effect.gen. Preserve the existing compiler setup, result-name transformation logic, return type, and generator body unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/sql/tursodatabase/docgen.json`:
- Line 2: Update the paths in docgen.json: use
../../../node_modules/@effect/docgen/schema.json for $schema, and change the
effect source references from ../../../effect/src to ../../effect/src for both
index.js and the wildcard pattern.
In `@packages/sql/tursodatabase/src/TursoClient.ts`:
- Line 138: Update the TursoClient connection setup in make to use
Effect.tryPromise instead of Effect.promise, mapping connection failures to
SqlError so they follow the same error contract as prepare, run, and runValues.
Propagate the widened SqlError type through make, layerConfig, and layer while
preserving successful connection behavior.
- Around line 192-205: Update runValues to honor the Client.SafeIntegers
fiber-context setting just as runStatement does: check the setting and apply
statement.safeIntegers(true) before executing either reader or non-reader
statements. Preserve the existing raw/all and run execution paths and error
classification.
In `@packages/sql/tursodatabase/src/TursoMigrator.ts`:
- Around line 35-47: Update the public JSDoc for the exported layer function in
TursoMigrator.ts to use the package’s established `@category` layers convention,
matching the sibling layer and layerConfig APIs in TursoClient.ts; leave the
implementation unchanged.
---
Nitpick comments:
In `@packages/sql/tursodatabase/src/TursoClient.ts`:
- Around line 136-146: Update the TursoClient make function to use
Effect.fnUntraced rather than a plain arrow function wrapping Effect.gen.
Preserve the existing compiler setup, result-name transformation logic, return
type, and generator body unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0270ec6a-24aa-495e-a51f-d124552550c3
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
.changeset/add-sql-tursodatabase.mdpackages/sql/tursodatabase/LICENSEpackages/sql/tursodatabase/README.mdpackages/sql/tursodatabase/docgen.jsonpackages/sql/tursodatabase/package.jsonpackages/sql/tursodatabase/src/TursoClient.tspackages/sql/tursodatabase/src/TursoMigrator.tspackages/sql/tursodatabase/src/index.tspackages/sql/tursodatabase/test/Client.test.tspackages/sql/tursodatabase/tsconfig.jsonpackages/sql/tursodatabase/vitest.config.tstsconfig.jsontsconfig.packages.json
- runValues now honors SafeIntegers like runStatement (.values queries no longer silently lose integer precision); add a regression test - classify connect() failures as SqlError (parity with sqlite-wasm's async in-process open), widening make/layer/layerConfig error channels - @category layers for TursoMigrator.layer, per .patterns/jsdoc.md
|
Addressed the CodeRabbit review in Applied (3):
Declined (2), with parity rationale on the threads:
Local verification: |
Adds
@effect/sql-tursodatabase, an@effect/sqlimplementation backed by the in-process Rust Turso engine (@tursodatabase/database), modeled on@effect/sql-libsql.This is the migration of Effect-TS/effect-smol#2509 (closed because V4 development moved here). See that PR for the original discussion and review history.
Summary by CodeRabbit
New Features
@effect/sql-tursodatabasefor SQL access via the in-process Turso engine.Tests
Documentation