
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
koa-generic-session-sequelize
Advanced tools
a Sequelize session store compatible with koa-generic-session
Store Koa sessions in a database using Sequelize.
Sequelize 4.12.0 or higher is supported.
Notice: This is an older module that works best with koa-generic-session
. However, most Koa apps today use the more modern koa-session library. Unfortunately, this module is not designed to work with that.
This session storage provider works with koa-generic-session (session middleware for Koa). It also works with koa-session-minimal, but koa-generic-session is recommended.
It stores session data in a database defined by you, using the Sequelize ORM.
It has been tested with SQLite, MySQL, PostgreSQL, and Microsoft SQL Server.
npm install --save koa-generic-session-sequelize
Full example in examples/basic_sqlite.js.
const SequelizeStore = require('koa-generic-session-sequelize');
// set up Sequelize in the usual manner
// for a quick example using the sqlite3 module:
const sequelize = new Sequelize({
logging: false,
dialect: 'sqlite',
storage: __dirname + '/example.db'
});
app.use(session({
store: new SequelizeStore(
sequelize, // pass your sequelize object as the first arg
{} // pass any config options for sequelizeStore as the second arg (see below)
)
}));
tableName
- Name of the session table in the db (default: Sessions
)modelName
- Name of the session model to be registered with Sequelize (default: Session
)sync
- Create the sessions table if it doesn’t exist (default: true
)syncTimeout
- If sync
is true
, how long to wait, in ms, for the sync to complete (default: 3000
)gcFrequency
- Do garbage collection after approximately this many requests. This deletes expired session data from the table. Set to 0
to never do garbage collection. (default: 10000
, or approximately every 10,000 requests)timestamps
- If true, the table will have updatedAt
and createdAt
columns. (default: false
)browserSessionLifetime
- How long, in ms, to remember sessions without a TTL: sessions that only last until the browser is closed. Some session managers, including koa-session-minimal
, will ignore this and use a reasonable default. (default: 86400000
)Sequelize supports replication (configured as options.replication
). This lets you use one server for writes and another server, or a group of servers, for reads.
However, if there is any lag between the time a write is committed and when it becomes visible on your read servers, you should not use that configuration for session data. Create a separate Sequelize instance for the session data that does not use replication.
To run the test suite, clone this repository and run npm install
in the checkout directory. Then run npm test
. This will exercise the library against SQLite.
To test against MySQL, PostgreSQL, or SQL Server, edit test/config.js
. Uncomment sections referencing those servers and enter your credentials. The table _sess_test
will be created during testing.
FAQs
a Sequelize session store compatible with koa-generic-session
The npm package koa-generic-session-sequelize receives a total of 0 weekly downloads. As such, koa-generic-session-sequelize popularity was classified as not popular.
We found that koa-generic-session-sequelize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.