Socket
Socket
Sign inDemoInstall

node-vk-bot-api-session-redis

Package Overview
Dependencies
4
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

1

lib/redis.js

@@ -10,3 +10,4 @@ const redis = require('redis')

set: util.promisify(client.set).bind(client),
del: util.promisify(client.del).bind(client),
}
}

@@ -24,7 +24,14 @@ const createClient = require('./redis')

get: () => session,
set: value => (session = value),
set: (value) => {
session = value === null ? {} : value
},
})
await next()
await this.redis.set(key, JSON.stringify(session))
if (!Object.keys(session || {}).length) {
await this.redis.del(key)
} else {
await this.redis.set(key, JSON.stringify(session))
}
}

@@ -31,0 +38,0 @@ }

2

package.json
{
"name": "node-vk-bot-api-session-redis",
"version": "1.0.4",
"version": "1.0.5",
"description": "Redis session middleware for node-vk-bot-api",

@@ -5,0 +5,0 @@ "main": "lib/session.js",

@@ -17,2 +17,4 @@ const { expect } = require('chai')

bot.command('/set', (ctx) => {
expect(ctx.session).to.deep.equal({})
ctx.session.user = user

@@ -35,2 +37,5 @@

expect(ctx.session.user).to.deep.equal(user)
// clear session for set inital data
ctx.session = null
})

@@ -37,0 +42,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc