Socket
Socket
Sign inDemoInstall

express-session-sqlite

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-session-sqlite - npm Package Compare versions

Comparing version 2.0.10 to 2.1.1

10

build/SqliteStore.d.ts

@@ -1,16 +0,16 @@

/// <reference types="express-session" />
import session from 'express-session';
import { SqliteStoreParams } from './SqliteStoreBase';
interface ISqliteStore {
new (config: SqliteStoreParams): any;
get: (sid: string, callback: (err: any, session?: Express.SessionData | null) => void) => void;
set: (sid: string, session: Express.SessionData, callback?: (err?: any) => void) => void;
get: (sid: string, callback: (err: any, session?: session.SessionData | null) => void) => void;
set: (sid: string, session: session.SessionData, callback?: (err?: any) => void) => void;
destroy: (sid: string, callback?: (err?: any) => void) => void;
all: (callback: (err: any, obj?: {
[sid: string]: Express.SessionData;
[sid: string]: session.SessionData;
} | null) => void) => void;
length: (callback: (err: any, length?: number | null) => void) => void;
clear: (callback?: (err?: any) => void) => void;
touch: (sid: string, session: Express.SessionData, callback?: (err?: any) => void) => void;
touch: (sid: string, session: session.SessionData, callback?: (err?: any) => void) => void;
}
export default function sqliteStoreFactory(session: any): ISqliteStore;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const SqliteStoreBase_1 = require("./SqliteStoreBase");
const util_1 = require("util");
function sqliteStoreFactory(session) {
const Store = session.Store;
// Cannot do extends Store from express-session
// doing so would mean would have to include express-session as a
// dependency for this package
class SqliteStore {
class SqliteStore extends Store {
constructor(config) {
this.get = (sid, callback) => {
this.sqliteStore
.get(sid)
.then(data => {
callback(null, data);
})
.catch(callback);
};
this.set = (sid, session, callback) => {
this.sqliteStore
.set(sid, session)
.then(callback)
.catch(callback);
};
this.destroy = (sid, callback) => {
this.sqliteStore
.destroy(sid)
.then(callback)
.catch(callback);
};
// @ts-ignore
this.all = (callback) => {
this.sqliteStore
.all()
.then(data => {
callback(null, data);
})
.catch(callback);
};
this.length = (callback) => {
this.sqliteStore
.length()
.then(length => {
callback(null, length);
})
.catch(callback);
};
this.clear = (callback) => {
this.sqliteStore
.clear()
.then(callback)
.catch(callback);
};
this.touch = (sid, session, callback) => {
this.sqliteStore
.touch(sid, session)
.then(callback)
.catch(callback);
};
Store.call(this, config);
super(config);
this.sqliteStore = new SqliteStoreBase_1.SqliteStoreBase(config);

@@ -73,4 +20,52 @@ this.cleanupTimer = setInterval(async () => {

}
get(sid, callback) {
this.sqliteStore
.get(sid)
.then(data => {
callback(null, data);
})
.catch(callback);
}
set(sid, session, callback) {
this.sqliteStore
.set(sid, session)
.then(callback)
.catch(callback);
}
destroy(sid, callback) {
this.sqliteStore
.destroy(sid)
.then(callback)
.catch(callback);
}
// @ts-ignore
all(callback) {
this.sqliteStore
.all()
.then(data => {
callback(null, data);
})
.catch(callback);
}
length(callback) {
this.sqliteStore
.length()
.then(length => {
callback(null, length);
})
.catch(callback);
}
clear(callback) {
this.sqliteStore
.clear()
.then(callback)
.catch(callback);
}
touch(sid, session, callback) {
this.sqliteStore
.touch(sid, session)
.then(callback)
.catch(callback);
}
}
util_1.inherits(SqliteStore, Store);
// @ts-ignore

@@ -77,0 +72,0 @@ return SqliteStore;

@@ -1,2 +0,2 @@

/// <reference types="express-session" />
import session from 'express-session';
import { Database } from 'sqlite';

@@ -27,4 +27,4 @@ export interface SqliteStoreParams {

}
export declare type AllSessionsResult = Express.SessionData[] | {
[sid: string]: Express.SessionData;
export declare type AllSessionsResult = session.SessionData[] | {
[sid: string]: session.SessionData;
} | null;

@@ -39,4 +39,4 @@ export declare class SqliteStoreBase {

init(): Promise<void>;
get(sid: string): Promise<Express.SessionData | null>;
set(sid: string, session: Express.SessionData): Promise<void>;
get(sid: string): Promise<session.SessionData | null>;
set(sid: string, session: session.SessionData): Promise<void>;
destroy(sid: string): Promise<void>;

@@ -46,3 +46,3 @@ all(): Promise<AllSessionsResult>;

clear(): Promise<void>;
touch(sid: string, session: Express.SessionData): Promise<void>;
touch(sid: string, session: session.SessionData): Promise<void>;
/**

@@ -49,0 +49,0 @@ * Have to manually call this to remove stale entries

@@ -27,3 +27,3 @@ "use strict";

debug('Opening sqlite database');
this.db = await sqlite_1.open({
this.db = await (0, sqlite_1.open)({
filename: this.config.path,

@@ -34,3 +34,3 @@ driver: this.config.driver

await this.db.migrate({
migrationsPath: path_1.join(__dirname, 'migrations')
migrationsPath: (0, path_1.join)(__dirname, 'migrations')
});

@@ -37,0 +37,0 @@ this.hasInit = true;

@@ -1,3 +0,11 @@

## 2.0.10 - Sun May 09 2021 19:58:40
## 2.1.1 - Fri May 27 2022 11:43:11
**Contributor:** [Theo Gravity](https://github.com/Theo Gravity)
- Update dependencies, remove deprecated inherits (#16)
This is a slight optimization update.
## 2.0.10 - Sun May 09 2021 19:58:39
**Contributor:** [dependabot[bot]](https://github.com/dependabot[bot])

@@ -4,0 +12,0 @@

@@ -15,3 +15,3 @@ module.exports = {

"statements": 94,
"branches": 75,
"branches": 62,
"functions": 95,

@@ -18,0 +18,0 @@ "lines": 90

{
"name": "express-session-sqlite",
"version": "2.0.10",
"version": "2.1.1",
"description": "SQLite-backed session store for express-session written in Typescript",

@@ -50,32 +50,32 @@ "main": "build/index.js",

"dependencies": {
"debug": "^4.2.0",
"debug": "^4.3.4",
"sql-template-strings": "^2.2.2",
"sqlite": "^4.0.14"
"sqlite": "^4.1.1"
},
"devDependencies": {
"@theo.gravity/changelog-version": "2.1.10",
"@theo.gravity/version-bump": "2.0.10",
"@types/express-session": "^1.17.0",
"@types/jest": "26.0.14",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"@theo.gravity/changelog-version": "2.1.11",
"@theo.gravity/version-bump": "2.0.14",
"@types/express-session": "^1.17.4",
"@types/jest": "27.5.1",
"@types/node": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"cpx": "^1.5.0",
"eslint": "7.9.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"git-commit-stamper": "^1.0.9",
"jest": "26.4.2",
"jest-cli": "26.4.2",
"eslint": "8.16.0",
"express": "^4.18.1",
"express-session": "^1.17.3",
"git-commit-stamper": "^1.0.10",
"jest": "28.1.0",
"jest-cli": "28.1.0",
"jest-junit-reporter": "1.1.0",
"lint-staged": "10.4.0",
"lint-staged": "12.4.2",
"pre-commit": "1.2.2",
"prettier-standard": "16.4.1",
"sqlite3": "^5.0.0",
"standardx": "^5.0.0",
"toc-md-alt": "^0.4.1",
"ts-jest": "26.4.0",
"ts-node": "9.0.0",
"ts-node-dev": "1.0.0-pre.63",
"typescript": "4.0.3",
"sqlite3": "^5.0.8",
"standardx": "^7.0.0",
"toc-md-alt": "^0.4.6",
"ts-jest": "28.0.3",
"ts-node": "10.8.0",
"ts-node-dev": "2.0.0",
"typescript": "4.7.2",
"version-bump-plugin-git": "^2.0.1"

@@ -82,0 +82,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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