🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

libsql

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libsql - npm Package Compare versions

Comparing version
0.6.0-pre.29
to
0.6.0-pre.30
+1
-1
compat.d.ts

@@ -47,3 +47,3 @@ export = Database;

*/
exec(sql: string): void;
exec(sql: string, queryOptions: any): void;
/**

@@ -50,0 +50,0 @@ * Interrupts the database connection.

@@ -31,2 +31,22 @@ "use strict";

function isQueryOptions(value) {
return value != null
&& typeof value === "object"
&& !Array.isArray(value)
&& Object.prototype.hasOwnProperty.call(value, "queryTimeout");
}
function splitBindParameters(bindParameters) {
if (bindParameters.length === 0) {
return { params: undefined, queryOptions: undefined };
}
if (bindParameters.length > 1 && isQueryOptions(bindParameters[bindParameters.length - 1])) {
return {
params: bindParameters.length === 2 ? bindParameters[0] : bindParameters.slice(0, -1),
queryOptions: bindParameters[bindParameters.length - 1],
};
}
return { params: bindParameters.length === 1 ? bindParameters[0] : bindParameters, queryOptions: undefined };
}
/**

@@ -180,5 +200,5 @@ * Database represents a connection that can prepare and execute SQL statements.

*/
exec(sql) {
exec(sql, queryOptions) {
try {
databaseExecSync(this.db, sql);
databaseExecSync(this.db, sql, queryOptions);
} catch (err) {

@@ -268,3 +288,4 @@ throw convertError(err);

try {
return statementRunSync(this.stmt, ...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
return statementRunSync(this.stmt, params, queryOptions);
} catch (err) {

@@ -282,3 +303,4 @@ throw convertError(err);

try {
return statementGetSync(this.stmt, ...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
return statementGetSync(this.stmt, params, queryOptions);
} catch (err) {

@@ -296,3 +318,4 @@ throw convertError(err);

try {
const it = statementIterateSync(this.stmt, ...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
const it = statementIterateSync(this.stmt, params, queryOptions);
return {

@@ -299,0 +322,0 @@ next: () => iteratorNextSync(it),

@@ -16,3 +16,8 @@ /* tslint:disable */

remoteEncryptionKey?: string
defaultQueryTimeout?: number
}
/** Per-query execution options. */
export interface QueryOptions {
queryTimeout?: number
}
export declare function connect(path: string, opts?: Options | undefined | null): Promise<Database>

@@ -31,8 +36,8 @@ /** Result of a database sync operation. */

/** Executes SQL in blocking mode. */
export declare function databaseExecSync(db: Database, sql: string): void
export declare function databaseExecSync(db: Database, sql: string, queryOptions?: QueryOptions | undefined | null): void
/** Gets first row from statement in blocking mode. */
export declare function statementGetSync(stmt: Statement, params?: unknown | undefined | null): unknown
export declare function statementGetSync(stmt: Statement, params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): unknown
/** Runs a statement in blocking mode. */
export declare function statementRunSync(stmt: Statement, params?: unknown | undefined | null): RunResult
export declare function statementIterateSync(stmt: Statement, params?: unknown | undefined | null): RowsIterator
export declare function statementRunSync(stmt: Statement, params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): RunResult
export declare function statementIterateSync(stmt: Statement, params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): RowsIterator
/** SQLite `run()` result object */

@@ -121,3 +126,3 @@ export interface RunResult {

*/
exec(sql: string): Promise<void>
exec(sql: string, queryOptions?: QueryOptions | undefined | null): Promise<void>
/**

@@ -159,3 +164,3 @@ * Syncs the database.

*/
run(params?: unknown | undefined | null): RunResult
run(params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): object
/**

@@ -169,3 +174,3 @@ * Executes a SQL statement and returns the first row.

*/
get(params?: unknown | undefined | null): object
get(params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): object
/**

@@ -179,3 +184,3 @@ * Create an iterator over the rows of a statement.

*/
iterate(params?: unknown | undefined | null): object
iterate(params?: unknown | undefined | null, queryOptions?: QueryOptions | undefined | null): object
raw(raw?: boolean | undefined | null): this

@@ -182,0 +187,0 @@ pluck(pluck?: boolean | undefined | null): this

{
"name": "libsql",
"version": "0.6.0-pre.29",
"version": "0.6.0-pre.30",
"repository": {

@@ -78,10 +78,10 @@ "type": "git",

"optionalDependencies": {
"libsql-win32-x64-msvc": "0.6.0-pre.29",
"libsql-darwin-x64": "0.6.0-pre.29",
"libsql-linux-x64-gnu": "0.6.0-pre.29",
"libsql-darwin-arm64": "0.6.0-pre.29",
"libsql-linux-arm64-gnu": "0.6.0-pre.29",
"libsql-linux-arm64-musl": "0.6.0-pre.29",
"libsql-linux-x64-musl": "0.6.0-pre.29"
"libsql-win32-x64-msvc": "0.6.0-pre.30",
"libsql-darwin-x64": "0.6.0-pre.30",
"libsql-linux-x64-gnu": "0.6.0-pre.30",
"libsql-darwin-arm64": "0.6.0-pre.30",
"libsql-linux-arm64-gnu": "0.6.0-pre.30",
"libsql-linux-arm64-musl": "0.6.0-pre.30",
"libsql-linux-x64-musl": "0.6.0-pre.30"
}
}

@@ -77,3 +77,3 @@ /**

*/
exec(sql: string): Promise<void>;
exec(sql: string, queryOptions: any): Promise<void>;
/**

@@ -126,3 +126,3 @@ * Interrupts the database connection.

*/
run(...bindParameters: any[]): Promise<import("./index.js").RunResult>;
run(...bindParameters: any[]): Promise<object>;
/**

@@ -129,0 +129,0 @@ * Executes the SQL statement and returns the first row.

@@ -44,2 +44,22 @@ "use strict";

function isQueryOptions(value) {
return value != null
&& typeof value === "object"
&& !Array.isArray(value)
&& Object.prototype.hasOwnProperty.call(value, "queryTimeout");
}
function splitBindParameters(bindParameters) {
if (bindParameters.length === 0) {
return { params: undefined, queryOptions: undefined };
}
if (bindParameters.length > 1 && isQueryOptions(bindParameters[bindParameters.length - 1])) {
return {
params: bindParameters.length === 2 ? bindParameters[0] : bindParameters.slice(0, -1),
queryOptions: bindParameters[bindParameters.length - 1],
};
}
return { params: bindParameters.length === 1 ? bindParameters[0] : bindParameters, queryOptions: undefined };
}
/**

@@ -221,5 +241,5 @@ * Creates a new database connection.

*/
async exec(sql) {
async exec(sql, queryOptions) {
try {
await this.db.exec(sql);
await this.db.exec(sql, queryOptions);
} catch (err) {

@@ -313,3 +333,4 @@ throw convertError(err);

try {
return await this.stmt.run(...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
return await this.stmt.run(params, queryOptions);
} catch (err) {

@@ -327,3 +348,4 @@ throw convertError(err);

try {
return await this.stmt.get(...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
return await this.stmt.get(params, queryOptions);
} catch (err) {

@@ -341,3 +363,4 @@ throw convertError(err);

try {
const it = await this.stmt.iterate(...bindParameters);
const { params, queryOptions } = splitBindParameters(bindParameters);
const it = await this.stmt.iterate(params, queryOptions);
return {

@@ -344,0 +367,0 @@ next() {

@@ -6,2 +6,4 @@ # libSQL API for JavaScript/TypeScript

> **Looking for Turso?** Check out [Turso](https://github.com/tursodatabase/turso) ([npm](https://www.npmjs.com/package/@tursodatabase/database)), which is currently in beta. Turso will be a drop-in replacement for libSQL with concurrent writes and built-in sync support.
[libSQL](https://github.com/libsql/libsql) is an open source, open contribution fork of SQLite.

@@ -8,0 +10,0 @@ This source repository contains libSQL API bindings for Node, which aims to be compatible with [better-sqlite3](https://github.com/WiseLibs/better-sqlite3/), but with opt-in promise API.