@libsql/client
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18362
364
5
+ Addedbetter-sqlite3@^8.0.1
+ Addedbetter-sqlite3@8.7.0(transitive)
- Removedsqlite3@^5.1.2
- Removed@gar/promisify@1.1.3(transitive)
- Removed@npmcli/fs@1.1.1(transitive)
- Removed@npmcli/move-file@1.1.2(transitive)
- Removed@tootallnate/once@1.1.2(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedagentkeepalive@4.5.0(transitive)
- Removedaggregate-error@3.1.0(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@3.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcacache@15.3.0(transitive)
- Removedchownr@2.0.0(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddelegates@1.0.0(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedenv-paths@2.2.1(transitive)
- Removederr-code@2.0.3(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@4.0.4(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp-proxy-agent@4.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedhumanize-ms@1.2.1(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedinfer-owner@1.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedip-address@9.0.5(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-lambda@1.0.1(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjsbn@1.1.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmake-fetch-happen@9.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminipass-collect@1.0.2(transitive)
- Removedminipass-fetch@1.4.1(transitive)
- Removedminipass-flush@1.0.5(transitive)
- Removedminipass-pipeline@1.2.4(transitive)
- Removedminipass-sized@1.0.3(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednegotiator@0.6.4(transitive)
- Removednode-addon-api@7.1.1(transitive)
- Removednode-gyp@8.4.1(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@6.0.2(transitive)
- Removedp-map@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpromise-inflight@1.0.1(transitive)
- Removedpromise-retry@2.0.1(transitive)
- Removedretry@0.12.0(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsmart-buffer@4.2.0(transitive)
- Removedsocks@2.8.3(transitive)
- Removedsocks-proxy-agent@6.2.1(transitive)
- Removedsprintf-js@1.1.3(transitive)
- Removedsqlite3@5.1.7(transitive)
- Removedssri@8.0.1(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedunique-filename@1.1.1(transitive)
- Removedunique-slug@2.0.2(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedyallist@4.0.0(transitive)