connect-session-knex
Advanced tools
Comparing version 4.0.0 to 4.0.1
/* eslint-disable func-names */ | ||
const Bluebird = require('bluebird'); | ||
const asCallback = require('ascallback'); | ||
const knexFactory = require('knex').knex; // https://github.com/knex/knex/blob/master/UPGRADING.md#upgrading-to-version-0950 | ||
const { resolve } = Bluebird; | ||
const util = require('util'); | ||
@@ -156,3 +154,3 @@ const { | ||
const condition = expiredCondition(self.knex); | ||
return resolve(self.knex | ||
return asCallback(self.knex | ||
.select('sess') | ||
@@ -171,4 +169,3 @@ .from(self.tablename) | ||
return ret; | ||
})) | ||
.asCallback(fn); | ||
}), fn); | ||
}); | ||
@@ -196,3 +193,3 @@ }; | ||
// sqlite optimized query | ||
return self.ready.then(() => resolve(self.knex | ||
return self.ready.then(() => asCallback(self.knex | ||
.raw(getSqliteFastQuery(self.tablename, self.sidfieldname), [ | ||
@@ -203,4 +200,3 @@ sid, | ||
]) | ||
.then(() => [1])) | ||
.asCallback(fn)); | ||
.then(() => [1]), fn)); | ||
} | ||
@@ -212,3 +208,3 @@ if ( | ||
// postgresql optimized query | ||
return self.ready.then(() => resolve(self.knex | ||
return self.ready.then(() => asCallback(self.knex | ||
.raw(getPostgresFastQuery(self.tablename, self.sidfieldname), [ | ||
@@ -218,8 +214,7 @@ sid, | ||
sess, | ||
])) | ||
.asCallback(fn)); | ||
]), fn)); | ||
} | ||
if (isMySQL(self.knex)) { | ||
// mysql/mariaDB optimized query | ||
return self.ready.then(() => resolve(self.knex | ||
return self.ready.then(() => asCallback(self.knex | ||
.raw(getMysqlFastQuery(self.tablename, self.sidfieldname), [ | ||
@@ -229,8 +224,7 @@ sid, | ||
sess, | ||
])) | ||
.asCallback(fn)); | ||
]), fn)); | ||
} | ||
if (isMSSQL(self.knex)) { | ||
// mssql optimized query | ||
return self.ready.then(() => resolve(self.knex | ||
return self.ready.then(() => asCallback(self.knex | ||
.raw(getMssqlFastQuery(self.tablename, self.sidfieldname), [ | ||
@@ -240,6 +234,5 @@ sid, | ||
sess, | ||
])) | ||
.asCallback(fn)); | ||
]), fn)); | ||
} | ||
return self.ready.then(() => resolve(self.knex | ||
return self.ready.then(() => asCallback(self.knex | ||
.transaction((trx) => trx | ||
@@ -264,4 +257,3 @@ .select('*') | ||
}); | ||
}))) | ||
.asCallback(fn)); | ||
})), fn)); | ||
}; | ||
@@ -281,3 +273,3 @@ | ||
return resolve(this.knex(this.tablename) | ||
return asCallback(this.knex(this.tablename) | ||
.where(this.sidfieldname, '=', sid) | ||
@@ -287,4 +279,3 @@ .andWhereRaw(condition, dateAsISO(this.knex)) | ||
expired: dateAsISO(this.knex, sess.cookie.expires), | ||
})) | ||
.asCallback(fn); | ||
}), fn); | ||
} | ||
@@ -304,7 +295,6 @@ | ||
const self = this; | ||
return self.ready.then(() => resolve(self.knex | ||
return asCallback(self.ready.then(() => self.knex | ||
.del() | ||
.from(self.tablename) | ||
.where(self.sidfieldname, '=', sid)) | ||
.asCallback(fn)); | ||
.where(self.sidfieldname, '=', sid), fn)); | ||
}; | ||
@@ -320,8 +310,7 @@ | ||
const self = this; | ||
return self.ready.then(() => resolve(self.knex | ||
return asCallback(self.ready.then(() => self.knex | ||
.count(`${self.sidfieldname} as count`) | ||
.from(self.tablename) | ||
// eslint-disable-next-line no-bitwise | ||
.then((response) => response[0].count | 0)) | ||
.asCallback(fn)); | ||
.then((response) => response[0].count | 0), fn)); | ||
}; | ||
@@ -337,6 +326,5 @@ | ||
const self = this; | ||
return self.ready.then(() => resolve(self.knex | ||
return asCallback(self.ready.then(() => self.knex | ||
.del() | ||
.from(self.tablename)) | ||
.asCallback(fn)); | ||
.from(self.tablename)), fn); | ||
}; | ||
@@ -371,3 +359,3 @@ | ||
const condition = expiredCondition(self.knex); | ||
return resolve(self.knex | ||
return asCallback((self.knex | ||
.select('sess') | ||
@@ -382,4 +370,3 @@ .from(self.tablename) | ||
return row.sess; | ||
}))) | ||
.asCallback(fn); | ||
})), fn)); | ||
}); | ||
@@ -386,0 +373,0 @@ }; |
{ | ||
"name": "connect-session-knex", | ||
"description": "A knex.js session store for Express and Connect", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"main": "lib/index.js", | ||
@@ -29,3 +29,3 @@ "typings": "typings/index.d.ts", | ||
"dependencies": { | ||
"bluebird": "^3.7.2", | ||
"ascallback": "^1.1.1", | ||
"knex": "3" | ||
@@ -32,0 +32,0 @@ }, |
@@ -18,4 +18,6 @@ import { Knex } from 'knex'; | ||
} | ||
function initFunction(session: typeof expressSession): StoreFactory; | ||
export = initFunction | ||
} | ||
export default function initFunction(session: typeof expressSession): StoreFactory; |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
21702
580
1
+ Addedascallback@^1.1.1
+ Addedascallback@1.1.1(transitive)
- Removedbluebird@^3.7.2
- Removedbluebird@3.7.2(transitive)