Registry / database / remote-sql-libsql

remote-sql-libsql

JSON →
library0.0.7jsnpmunverified

An implementation of the RemoteSQL interface for LibSQL databases (including Turso), enabling batch transaction workflows. Current version: 0.0.7. Release cadence: early development, frequent minor updates. Key differentiator: provides a unified batch and prepared statement API on top of @libsql/core, allowing for transactional batching of multiple SQL statements. Requires @libsql/core as a peer dependency. Supports TypeScript with bundled types.

npm install remote-sql-libsql
INSTALL
IMPORT
SIG · REMOTE-SQL-LIBSQL
R
remote-sql-libsql
databasejavascriptv0.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RemoteLibSQL
import { RemoteLibSQL } from 'remote-sql-libsql'
const RemoteLibSQL = require('remote-sql-libsql'); // Wrong: CommonJS require does not work with named exports in this ESM-first library
Named export; library requires ESM. Default import not available.
LibSQLPreparedStatement
import { LibSQLPreparedStatement } from 'remote-sql-libsql'
import { PreparedStatement } from 'remote-sql-libsql'; // Wrong: symbol is LibSQLPreparedStatement, not PreparedStatement
TypeScript type; exported alongside RemoteLibSQL.
RemoteSQL interface
import type { RemoteSQL } from 'remote-sql'
import { RemoteSQL } from 'remote-sql-libsql'; // Wrong: the interface is defined in remote-sql package, not this implementation
For type alignment, import the RemoteSQL interface from the main remote-sql package.

Demonstrates creating a RemoteLibSQL instance from a Turso client, preparing and executing a query, and running a batch transaction.

import { RemoteLibSQL } from 'remote-sql-libsql'; import { createClient } from '@libsql/core'; const client = createClient({ url: process.env.TURSO_DATABASE_URL ?? 'libsql://your-database.turso.io', authToken: process.env.TURSO_AUTH_TOKEN ?? '' }); const rls = new RemoteLibSQL(client); const stmt = rls.prepare('SELECT name FROM users WHERE id = ?'); const result = await stmt.bind(1).all<{ name: string }>(); console.log(result); // Batch transaction const insert1 = rls.prepare('INSERT INTO users (name) VALUES (?)').bind('Alice'); const insert2 = rls.prepare('INSERT INTO users (name) VALUES (?)').bind('Bob'); const batchResults = await rls.batch([insert1, insert2]); console.log(batchResults);
Debug
Known issues
gotchaThe peer dependency @libsql/core must be installed explicitly; not bundled.
fix
Run: pnpm add @libsql/core (or npm/yarn equivalent)
affects: >=0.0.1
breakingBreaking change: In version 0.0.7, the constructor signature changed to require a Client object; previously may have accepted a config object.
fix
Update constructor usage to pass a @libsql/core Client instance: new RemoteLibSQL(client)
affects: <0.0.7
deprecatedThe method .query() is deprecated; use .all() instead.
fix
Replace .query() with .all()
affects: >=0.0.5
gotchaBatch errors: If one statement in a batch fails, the entire batch may roll back depending on LibSQL transaction support.
fix
Handle batch results individually; check result.error for each statement.
affects: >=0.0.0
deprecatedESM-only library: Import via CommonJS require will fail. Use dynamic import() if needed.
fix
Switch to ESM imports or use dynamic import('remote-sql-libsql').
affects: >=0.0.0
Errors
Common errors & fixes
RemoteLibSQL is not a constructor
Importing as default instead of named export.
fix
Use import { RemoteLibSQL } from 'remote-sql-libsql'
Missing package: @libsql/core
Peer dependency not installed.
fix
Install @libsql/core: pnpm add @libsql/core
TypeError: Cannot read properties of undefined (reading 'prepare')
Client passed to RemoteLibSQL constructor is undefined or invalid.
fix
Ensure createClient() returns a valid Client object before constructing RemoteLibSQL.
Method 'query' does not exist
Trying to call .query() which was removed in favor of .all().
fix
Use .all<T>() instead of .query<T>().
Upgrade
Version history
0.0.7latest on npm
Audit
Dependencies
@libsql/corerequiredPeer dependency: provides the underlying LibSQL client needed to instantiate RemoteLibSQL
Agent activity
7 hits · last 30 days
node
6
Resources
remote-sql-libsql — npm install remote-sql-libsql · libregistry