@keyv/sqlite
Advanced tools
Comparing version 3.5.0 to 3.5.1
{ | ||
"name": "@keyv/sqlite", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "SQLite storage adapter for Keyv", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "xo --fix && nyc ava", | ||
"test": "xo && nyc ava", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov", | ||
@@ -45,3 +45,4 @@ "clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov && rm -rf ./test/testdb.sqlite" | ||
"dependencies": { | ||
"sqlite3": "^5.0.3" | ||
"sqlite3": "^5.0.3", | ||
"pify": "^5.0.0" | ||
}, | ||
@@ -48,0 +49,0 @@ "devDependencies": { |
@@ -16,3 +16,3 @@ 'use strict'; | ||
options.db = options.uri.replace(/^sqlite:\/\//, ''); | ||
this.close = {}; | ||
options.connect = () => new Promise((resolve, reject) => { | ||
@@ -31,3 +31,3 @@ const db = new sqlite3.Database(options.db, error => { | ||
}) | ||
.then(db => pify(db.all).bind(db)); | ||
.then(db => ({query: pify(db.all).bind(db), close: pify(db.close).bind(db)})); | ||
@@ -42,7 +42,9 @@ this.opts = {table: 'keyv', | ||
const connected = this.opts.connect() | ||
.then(query => query(createTable).then(() => query)) | ||
.then(db => db.query(createTable).then(() => db)) | ||
.catch(error => this.emit('error', error)); | ||
this.query = (sqlString, ...parameter) => connected | ||
.then(query => query(sqlString, ...parameter)); | ||
.then(db => db.query(sqlString, ...parameter)); | ||
this.close = () => connected.then(db => db.close); | ||
} | ||
@@ -154,4 +156,8 @@ | ||
} | ||
disconnect() { | ||
return this.close().then(() => undefined); | ||
} | ||
} | ||
module.exports = KeyvSqlite; |
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
7396
154
2
+ Addedpify@^5.0.0
+ Addedpify@5.0.0(transitive)