@libsql/client
Advanced tools
Comparing version 0.14.0 to 0.15.0-pre.1
@@ -269,13 +269,24 @@ "use strict"; | ||
function stmtToHrana(stmt) { | ||
if (typeof stmt === "string") { | ||
return new hrana.Stmt(stmt); | ||
let sql; | ||
let args; | ||
if (Array.isArray(stmt)) { | ||
[sql, args] = stmt; | ||
} | ||
const hranaStmt = new hrana.Stmt(stmt.sql); | ||
if (Array.isArray(stmt.args)) { | ||
hranaStmt.bindIndexes(stmt.args); | ||
else if (typeof stmt === "string") { | ||
sql = stmt; | ||
} | ||
else { | ||
for (const [key, value] of Object.entries(stmt.args)) { | ||
hranaStmt.bindName(key, value); | ||
sql = stmt.sql; | ||
args = stmt.args; | ||
} | ||
const hranaStmt = new hrana.Stmt(sql); | ||
if (args) { | ||
if (Array.isArray(args)) { | ||
hranaStmt.bindIndexes(args); | ||
} | ||
else { | ||
for (const [key, value] of Object.entries(args)) { | ||
hranaStmt.bindName(key, value); | ||
} | ||
} | ||
} | ||
@@ -282,0 +293,0 @@ return hranaStmt; |
@@ -117,3 +117,12 @@ "use strict"; | ||
try { | ||
const hranaStmts = stmts.map(hrana_js_1.stmtToHrana); | ||
const normalizedStmts = stmts.map((stmt) => { | ||
if (Array.isArray(stmt)) { | ||
return { | ||
sql: stmt[0], | ||
args: stmt[1] || [], | ||
}; | ||
} | ||
return stmt; | ||
}); | ||
const hranaStmts = normalizedStmts.map(hrana_js_1.stmtToHrana); | ||
const version = await this.#client.getVersion(); | ||
@@ -120,0 +129,0 @@ // Pipeline all operations, so `hrana.HttpClient` can open the stream, execute the batch and |
@@ -67,2 +67,4 @@ "use strict"; | ||
syncPeriod: config.syncInterval, | ||
readYourWrites: config.readYourWrites, | ||
offline: config.offline, | ||
}; | ||
@@ -113,3 +115,6 @@ const db = new libsql_1.default(path, options); | ||
} | ||
return executeStmt(db, stmt, this.#intMode); | ||
const normalizedStmt = Array.isArray(stmt) | ||
? { sql: stmt[0], args: stmt[1] || [] } | ||
: stmt; | ||
return executeStmt(db, normalizedStmt, this.#intMode); | ||
}); | ||
@@ -218,3 +223,6 @@ executeStmt(db, "COMMIT", this.#intMode); | ||
this.#checkNotClosed(); | ||
return executeStmt(this.#database, stmt, this.#intMode); | ||
const normalizedStmt = Array.isArray(stmt) | ||
? { sql: stmt[0], args: stmt[1] || [] } | ||
: stmt; | ||
return executeStmt(this.#database, normalizedStmt, this.#intMode); | ||
}); | ||
@@ -221,0 +229,0 @@ } |
@@ -143,3 +143,12 @@ "use strict"; | ||
try { | ||
const hranaStmts = stmts.map(hrana_js_1.stmtToHrana); | ||
const normalizedStmts = stmts.map((stmt) => { | ||
if (Array.isArray(stmt)) { | ||
return { | ||
sql: stmt[0], | ||
args: stmt[1] || [], | ||
}; | ||
} | ||
return stmt; | ||
}); | ||
const hranaStmts = normalizedStmts.map(hrana_js_1.stmtToHrana); | ||
const version = await streamState.conn.client.getVersion(); | ||
@@ -146,0 +155,0 @@ // Schedule all operations synchronously, so they will be pipelined and executed in a single |
import * as hrana from "@libsql/hrana-client"; | ||
import type { InStatement, ResultSet, Transaction, TransactionMode } from "@libsql/core/api"; | ||
import type { InStatement, ResultSet, Transaction, TransactionMode, InArgs } from "@libsql/core/api"; | ||
import type { SqlCache } from "./sql_cache.js"; | ||
@@ -21,4 +21,4 @@ export declare abstract class HranaTransaction implements Transaction { | ||
export declare function executeHranaBatch(mode: TransactionMode, version: hrana.ProtocolVersion, batch: hrana.Batch, hranaStmts: Array<hrana.Stmt>, disableForeignKeys?: boolean): Promise<Array<ResultSet>>; | ||
export declare function stmtToHrana(stmt: InStatement): hrana.Stmt; | ||
export declare function stmtToHrana(stmt: InStatement | [string, InArgs?]): hrana.Stmt; | ||
export declare function resultSetFromHrana(hranaRows: hrana.RowsResult): ResultSet; | ||
export declare function mapHranaError(e: unknown): unknown; |
@@ -241,13 +241,24 @@ import * as hrana from "@libsql/hrana-client"; | ||
export function stmtToHrana(stmt) { | ||
if (typeof stmt === "string") { | ||
return new hrana.Stmt(stmt); | ||
let sql; | ||
let args; | ||
if (Array.isArray(stmt)) { | ||
[sql, args] = stmt; | ||
} | ||
const hranaStmt = new hrana.Stmt(stmt.sql); | ||
if (Array.isArray(stmt.args)) { | ||
hranaStmt.bindIndexes(stmt.args); | ||
else if (typeof stmt === "string") { | ||
sql = stmt; | ||
} | ||
else { | ||
for (const [key, value] of Object.entries(stmt.args)) { | ||
hranaStmt.bindName(key, value); | ||
sql = stmt.sql; | ||
args = stmt.args; | ||
} | ||
const hranaStmt = new hrana.Stmt(sql); | ||
if (args) { | ||
if (Array.isArray(args)) { | ||
hranaStmt.bindIndexes(args); | ||
} | ||
else { | ||
for (const [key, value] of Object.entries(args)) { | ||
hranaStmt.bindName(key, value); | ||
} | ||
} | ||
} | ||
@@ -254,0 +265,0 @@ return hranaStmt; |
@@ -19,5 +19,4 @@ /// <reference types="node" /> | ||
private limit; | ||
execute(stmt: InStatement): Promise<ResultSet>; | ||
execute(sql: string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
execute(stmtOrSql: InStatement | string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement | [string, InArgs?]>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
migrate(stmts: Array<InStatement>): Promise<Array<ResultSet>>; | ||
@@ -24,0 +23,0 @@ transaction(mode?: TransactionMode): Promise<HttpTransaction>; |
@@ -83,3 +83,12 @@ import * as hrana from "@libsql/hrana-client"; | ||
try { | ||
const hranaStmts = stmts.map(stmtToHrana); | ||
const normalizedStmts = stmts.map((stmt) => { | ||
if (Array.isArray(stmt)) { | ||
return { | ||
sql: stmt[0], | ||
args: stmt[1] || [], | ||
}; | ||
} | ||
return stmt; | ||
}); | ||
const hranaStmts = normalizedStmts.map(stmtToHrana); | ||
const version = await this.#client.getVersion(); | ||
@@ -86,0 +95,0 @@ // Pipeline all operations, so `hrana.HttpClient` can open the stream, execute the batch and |
@@ -14,5 +14,4 @@ import Database from "libsql"; | ||
constructor(path: string, options: Database.Options, db: Database.Database, intMode: IntMode); | ||
execute(stmt: InStatement): Promise<ResultSet>; | ||
execute(sql: string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
execute(stmtOrSql: InStatement | string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement | [string, InArgs?]>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
migrate(stmts: Array<InStatement>): Promise<Array<ResultSet>>; | ||
@@ -30,3 +29,3 @@ transaction(mode?: TransactionMode): Promise<Transaction>; | ||
execute(sql: string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement>): Promise<Array<ResultSet>>; | ||
batch(stmts: Array<InStatement | [string, InArgs?]>): Promise<Array<ResultSet>>; | ||
executeMultiple(sql: string): Promise<void>; | ||
@@ -33,0 +32,0 @@ rollback(): Promise<void>; |
@@ -46,2 +46,4 @@ import Database from "libsql"; | ||
syncPeriod: config.syncInterval, | ||
readYourWrites: config.readYourWrites, | ||
offline: config.offline, | ||
}; | ||
@@ -91,3 +93,6 @@ const db = new Database(path, options); | ||
} | ||
return executeStmt(db, stmt, this.#intMode); | ||
const normalizedStmt = Array.isArray(stmt) | ||
? { sql: stmt[0], args: stmt[1] || [] } | ||
: stmt; | ||
return executeStmt(db, normalizedStmt, this.#intMode); | ||
}); | ||
@@ -195,3 +200,6 @@ executeStmt(db, "COMMIT", this.#intMode); | ||
this.#checkNotClosed(); | ||
return executeStmt(this.#database, stmt, this.#intMode); | ||
const normalizedStmt = Array.isArray(stmt) | ||
? { sql: stmt[0], args: stmt[1] || [] } | ||
: stmt; | ||
return executeStmt(this.#database, normalizedStmt, this.#intMode); | ||
}); | ||
@@ -198,0 +206,0 @@ } |
@@ -30,5 +30,4 @@ /// <reference types="node" /> | ||
private limit; | ||
execute(stmt: InStatement): Promise<ResultSet>; | ||
execute(sql: string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
execute(stmtOrSql: InStatement | string, args?: InArgs): Promise<ResultSet>; | ||
batch(stmts: Array<InStatement | [string, InArgs?]>, mode?: TransactionMode): Promise<Array<ResultSet>>; | ||
migrate(stmts: Array<InStatement>): Promise<Array<ResultSet>>; | ||
@@ -35,0 +34,0 @@ transaction(mode?: TransactionMode): Promise<WsTransaction>; |
@@ -109,3 +109,12 @@ import * as hrana from "@libsql/hrana-client"; | ||
try { | ||
const hranaStmts = stmts.map(stmtToHrana); | ||
const normalizedStmts = stmts.map((stmt) => { | ||
if (Array.isArray(stmt)) { | ||
return { | ||
sql: stmt[0], | ||
args: stmt[1] || [], | ||
}; | ||
} | ||
return stmt; | ||
}); | ||
const hranaStmts = normalizedStmts.map(stmtToHrana); | ||
const version = await streamState.conn.client.getVersion(); | ||
@@ -112,0 +121,0 @@ // Schedule all operations synchronously, so they will be pipelined and executed in a single |
{ | ||
"name": "@libsql/client", | ||
"version": "0.14.0", | ||
"version": "0.15.0-pre.1", | ||
"keywords": [ | ||
@@ -16,3 +16,4 @@ "libsql", | ||
"type": "git", | ||
"url": "https://github.com/libsql/libsql-client-ts" | ||
"url": "git+https://github.com/libsql/libsql-client-ts", | ||
"directory": "packages/libsql-client" | ||
}, | ||
@@ -98,2 +99,3 @@ "authors": [ | ||
"build:esm": "tsc -p tsconfig.build-esm.json", | ||
"format:check": "prettier --check .", | ||
"postbuild": "cp package-cjs.json ./lib-cjs/package.json", | ||
@@ -103,10 +105,9 @@ "test": "jest --runInBand", | ||
"typedoc": "rm -rf ./docs && typedoc", | ||
"prepare": "husky install", | ||
"lint-staged": "lint-staged" | ||
}, | ||
"dependencies": { | ||
"@libsql/core": "^0.14.0", | ||
"@libsql/core": "^0.15.0-pre.1", | ||
"@libsql/hrana-client": "^0.7.0", | ||
"js-base64": "^3.7.5", | ||
"libsql": "^0.4.4", | ||
"libsql": "^0.5.0-pre.2", | ||
"promise-limit": "^2.7.0" | ||
@@ -117,3 +118,2 @@ }, | ||
"@types/node": "^18.15.5", | ||
"husky": "^9.0.11", | ||
"jest": "^29.3.1", | ||
@@ -120,0 +120,0 @@ "lint-staged": "^15.2.2", |
128
README.md
<p align="center"> | ||
<a href="https://docs.turso.tech/sdk/ts/quickstart"> | ||
<img alt="Turso + TypeScript" src="https://github.com/tursodatabase/libsql-client-ts/assets/950181/5d3a2693-75f9-4c56-9107-8ccaa96785fd" width="1000"> | ||
<h3 align="center">Turso + TypeScript / JS</h3> | ||
<a href="https://tur.so/turso-ts"> | ||
<picture> | ||
<img src="/.github/cover.png" alt="libSQL TypeScript" /> | ||
</picture> | ||
</a> | ||
<h1 align="center">libSQL TypeScript</h1> | ||
</p> | ||
<p align="center"> | ||
SQLite for Production. Powered by <a href="https://turso.tech/libsql">libSQL</a>. | ||
Databases for all TypeScript and JS multi-tenant apps. | ||
</p> | ||
<p align="center"> | ||
<a href="https://turso.tech"><strong>Turso</strong></a> · | ||
<a href="https://docs.turso.tech/quickstart"><strong>Quickstart</strong></a> · | ||
<a href="/examples"><strong>Examples</strong></a> · | ||
<a href="https://tur.so/turso-ts"><strong>Turso</strong></a> · | ||
<a href="https://docs.turso.tech"><strong>Docs</strong></a> · | ||
<a href="https://discord.com/invite/4B5D7hYwub"><strong>Discord</strong></a> · | ||
<a href="https://blog.turso.tech/"><strong>Blog & Tutorials</strong></a> | ||
<a href="https://docs.turso.tech/sdk/ts/quickstart"><strong>Quickstart</strong></a> · | ||
<a href="https://docs.turso.tech/sdk/ts/reference"><strong>SDK Reference</strong></a> · | ||
<a href="https://turso.tech/blog"><strong>Blog & Tutorials</strong></a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/@libsql/client"> | ||
<img src="https://badge.fury.io/js/@libsql%2Fclient.svg" alt="npm version" title="npm version" /> | ||
<a href="LICENSE"> | ||
<picture> | ||
<img src="https://img.shields.io/github/license/tursodatabase/libsql-client-ts?color=0F624B" alt="MIT License" /> | ||
</picture> | ||
</a> | ||
<a href="https://discord.com/invite/4B5D7hYwub"> | ||
<img src="https://dcbadge.vercel.app/api/server/4B5D7hYwub?style=flat" alt="discord activity" title="join us on discord" /> | ||
<a href="https://tur.so/discord-ts"> | ||
<picture> | ||
<img src="https://img.shields.io/discord/933071162680958986?color=0F624B" alt="Discord" /> | ||
</picture> | ||
</a> | ||
<a href="https://www.phorm.ai/query?projectId=3c9a471f-4a47-469f-81f6-4ea1ff9ab418"><img src="https://img.shields.io/badge/Phorm-Ask_AI-%23F2777A.svg?&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNSIgaGVpZ2h0PSI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxwYXRoIGQ9Ik00LjQzIDEuODgyYTEuNDQgMS40NCAwIDAgMS0uMDk4LjQyNmMtLjA1LjEyMy0uMTE1LjIzLS4xOTIuMzIyLS4wNzUuMDktLjE2LjE2NS0uMjU1LjIyNmExLjM1MyAxLjM1MyAwIDAgMS0uNTk1LjIxMmMtLjA5OS4wMTItLjE5Mi4wMTQtLjI3OS4wMDZsLTEuNTkzLS4xNHYtLjQwNmgxLjY1OGMuMDkuMDAxLjE3LS4xNjkuMjQ2LS4xOTFhLjYwMy42MDMgMCAwIDAgLjItLjEwNi41MjkuNTI5IDAgMCAwIC4xMzgtLjE3LjY1NC42NTQgMCAwIDAgLjA2NS0uMjRsLjAyOC0uMzJhLjkzLjkzIDAgMCAwLS4wMzYtLjI0OS41NjcuNTY3IDAgMCAwLS4xMDMtLjIuNTAyLjUwMiAwIDAgMC0uMTY4LS4xMzguNjA4LjYwOCAwIDAgMC0uMjQtLjA2N0wyLjQzNy43MjkgMS42MjUuNjcxYS4zMjIuMzIyIDAgMCAwLS4yMzIuMDU4LjM3NS4zNzUgMCAwIDAtLjExNi4yMzJsLS4xMTYgMS40NS0uMDU4LjY5Ny0uMDU4Ljc1NEwuNzA1IDRs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A0Ny40MjMuMWExLjE3IDEuMTcgMCAwIDEgLjU0NS40NDhjLjA2MS4wOTUuMTA5LjE5My4xNDQuMjk1YTEuNDA2IDEuNDA2IDAgMCAxIC4wNzcuNTgzbC0uMDI4LjMyMloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=" alt="phorm.ai"> | ||
<a href="#contributors"> | ||
<picture> | ||
<img src="https://img.shields.io/github/contributors/tursodatabase/libsql-client-ts?color=0F624B" alt="Contributors" /> | ||
</picture> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@libsql/client"> | ||
<picture> | ||
<img src="https://img.shields.io/npm/dw/%40libsql%2Fclient?color=0F624B" alt="Weekly downloads" /> | ||
</picture> | ||
</a> | ||
<a href="/examples"> | ||
<picture> | ||
<img src="https://img.shields.io/badge/browse-examples-0F624B" alt="Examples" /> | ||
</picture> | ||
</a> | ||
</p> | ||
--- | ||
## Features | ||
- 🔌 Works offline with [Embedded Replicas](https://docs.turso.tech/features/embedded-replicas/introduction) | ||
- 🌎 Works with remote Turso databases | ||
- ✨ Works with Turso [AI & Vector Search](https://docs.turso.tech/features/ai-and-embeddings) | ||
- 🔐 Supports [encryption at rest](https://docs.turso.tech/libsql#encryption-at-rest) | ||
## Install | ||
```bash | ||
npm install @libsql/client | ||
``` | ||
## Quickstart | ||
The example below uses Embedded Replicas and syncs every minute from Turso. | ||
```ts | ||
import { createClient } from "@libsql/client"; | ||
export const turso = createClient({ | ||
url: "file:local.db", | ||
syncUrl: process.env.TURSO_DATABASE_URL, | ||
authToken: process.env.TURSO_AUTH_TOKEN, | ||
syncInterval: 60000, | ||
}); | ||
await turso.batch( | ||
[ | ||
"CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)", | ||
{ | ||
sql: "INSERT INTO users(name) VALUES (?)", | ||
args: ["Iku"], | ||
}, | ||
], | ||
"write", | ||
); | ||
await turso.execute({ | ||
sql: "SELECT * FROM users WHERE id = ?", | ||
args: [1], | ||
}); | ||
``` | ||
## Examples | ||
| Example | Description | | ||
| ------------------------------------- | --------------------------------------------------------------------------------------- | | ||
| [local](examples/local) | Uses libsql with a local SQLite file. Creates database, inserts data, and queries. | | ||
| [remote](examples/remote) | Connects to a remote database. Requires environment variables for URL and auth token. | | ||
| [sync](examples/sync) | Demonstrates synchronization between local and remote databases. | | ||
| [batch](examples/batch) | Executes multiple SQL statements in a single batch operation. | | ||
| [transactions](examples/transactions) | Shows transaction usage: starting, performing operations, and committing/rolling back. | | ||
| [memory](examples/memory) | Uses an in-memory SQLite database for temporary storage or fast access. | | ||
| [vector](examples/vector) | Works with vector embeddings, storing and querying for similarity search. | | ||
| [encryption](examples/encryption) | Creates and uses an encrypted SQLite database, demonstrating setup and data operations. | | ||
## Documentation | ||
1. [Turso Quickstart](https://docs.turso.tech/quickstart) — Learn how create and connect your first database. | ||
2. [SDK Quickstart](https://docs.turso.tech/sdk/ts/quickstart) — Learn how to install and execute queries using the libSQL client. | ||
3. [SDK Reference](https://docs.turso.tech/sdk/ts/reference) — Dive deeper with the libSQL SDK reference and examples. | ||
Visit our [official documentation](https://docs.turso.tech/sdk/ts). | ||
### What is Turso? | ||
## Support | ||
[Turso](https://turso.tech) is a SQLite-compatible database built on [libSQL](https://docs.turso.tech/libsql), the Open Contribution fork of SQLite. It enables scaling to hundreds of thousands of databases per organization and supports replication to any location, including your own servers, for microsecond-latency access. | ||
Join us [on Discord](https://tur.so/discord-ts) to get help using this SDK. Report security issues [via email](mailto:security@turso.tech). | ||
Learn more about what you can do with Turso: | ||
## Contributors | ||
- [Embedded Replicas](https://docs.turso.tech/features/embedded-replicas) | ||
- [Platform API](https://docs.turso.tech/features/platform-api) | ||
- [Data Edge](https://docs.turso.tech/features/data-edge) | ||
- [Branching](https://docs.turso.tech/features/branching) | ||
- [Point-in-Time Recovery](https://docs.turso.tech/features/point-in-time-recovery) | ||
- [Scale to Zero](https://docs.turso.tech/features/scale-to-zero) | ||
See the [contributing guide](CONTRIBUTING.md) to learn how to get involved. | ||
![Contributors](https://contrib.nn.ci/api?repo=tursodatabase/libsql-client-ts) | ||
<a href="https://github.com/tursodatabase/libsql-client-ts/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22"> | ||
<picture> | ||
<img src="https://img.shields.io/github/issues-search/tursodatabase/libsql-client-ts?label=good%20first%20issue&query=label%3A%22good%20first%20issue%22%20&color=0F624B" alt="good first issue" /> | ||
</picture> | ||
</a> |
126244
9
3048
126
+ Added@libsql/core@0.15.0-pre.3(transitive)
+ Added@libsql/darwin-arm64@0.5.0-pre.6(transitive)
+ Added@libsql/darwin-x64@0.5.0-pre.6(transitive)
+ Added@libsql/linux-arm64-gnu@0.5.0-pre.6(transitive)
+ Added@libsql/linux-arm64-musl@0.5.0-pre.6(transitive)
+ Added@libsql/linux-x64-gnu@0.5.0-pre.6(transitive)
+ Added@libsql/linux-x64-musl@0.5.0-pre.6(transitive)
+ Added@libsql/win32-x64-msvc@0.5.0-pre.6(transitive)
+ Addedlibsql@0.5.0-pre.6(transitive)
- Removed@libsql/core@0.14.0(transitive)
- Removed@libsql/darwin-arm64@0.4.7(transitive)
- Removed@libsql/darwin-x64@0.4.7(transitive)
- Removed@libsql/linux-arm64-gnu@0.4.7(transitive)
- Removed@libsql/linux-arm64-musl@0.4.7(transitive)
- Removed@libsql/linux-x64-gnu@0.4.7(transitive)
- Removed@libsql/linux-x64-musl@0.4.7(transitive)
- Removed@libsql/win32-x64-msvc@0.4.7(transitive)
- Removedlibsql@0.4.7(transitive)
Updated@libsql/core@^0.15.0-pre.1
Updatedlibsql@^0.5.0-pre.2