Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libsql/client

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libsql/client - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

13

lib/lib/driver/HttpDriver.js

@@ -38,5 +38,8 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpDriver = void 0;
var cross_fetch_1 = require("cross-fetch");
var cross_fetch_1 = __importDefault(require("cross-fetch"));
var HttpDriver = /** @class */ (function () {

@@ -65,9 +68,3 @@ function HttpDriver(url) {

return [2 /*return*/, results.map(function (rs) {
return {
results: rs,
success: true,
meta: {
duration: 0,
},
};
return rs.results;
})];

@@ -74,0 +71,0 @@ }

@@ -1,6 +0,6 @@

import * as sqlite3 from "sqlite3";
import { Database } from "better-sqlite3";
import { ResultSet } from "../libsql-js";
import { Driver } from "./Driver";
export declare class SqliteDriver implements Driver {
db: sqlite3.Database;
db: Database;
constructor(url: string);

@@ -7,0 +7,0 @@ transaction(sqls: string[]): Promise<ResultSet[]>;

@@ -38,8 +38,11 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SqliteDriver = void 0;
var sqlite3 = require("sqlite3");
var better_sqlite3_1 = __importDefault(require("better-sqlite3"));
var SqliteDriver = /** @class */ (function () {
function SqliteDriver(url) {
this.db = new sqlite3.Database(url, sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE | sqlite3.OPEN_FULLMUTEX | sqlite3.OPEN_URI);
this.db = new better_sqlite3_1.default(url.substring(5));
}

@@ -77,13 +80,26 @@ SqliteDriver.prototype.transaction = function (sqls) {

case 0: return [4 /*yield*/, new Promise(function (resolve) {
_this.db.all(sql, function (err, rows) {
// FIXME: error handling
var rs = {
results: rows,
success: true,
meta: {
duration: 0,
},
};
resolve(rs);
});
var stmt = _this.db.prepare(sql);
var columns;
var rows;
if (stmt.reader) {
columns = stmt.columns().map(function (c) { return c.name; });
rows = stmt.all().map(function (row) {
return columns.map(function (column) { return row[column]; });
});
}
else {
columns = [];
rows = [];
stmt.run();
}
// FIXME: error handling
var rs = {
columns: columns,
rows: rows,
success: true,
meta: {
duration: 0,
},
};
resolve(rs);
})];

@@ -90,0 +106,0 @@ case 1: return [2 /*return*/, _a.sent()];

@@ -14,5 +14,9 @@ import { Driver } from "./driver/Driver";

/**
* Query result columns.
*/
columns: string[] | null;
/**
* Query results.
*/
results: Row[] | null;
rows: Row[] | null;
/**

@@ -19,0 +23,0 @@ * Was the query successful?

{
"name": "@libsql/client",
"version": "0.0.2",
"version": "0.0.3",
"keywords": [

@@ -31,2 +31,3 @@ "libsql",

"devDependencies": {
"@types/better-sqlite3": "^7.6.3",
"@types/jest": "^29.2.5",

@@ -38,5 +39,5 @@ "jest": "^29.3.1",

"dependencies": {
"cross-fetch": "^3.1.5",
"sqlite3": "^5.1.2"
"better-sqlite3": "^8.0.1",
"cross-fetch": "^3.1.5"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc