next-session
Advanced tools
Comparing version 4.0.0 to 4.0.1
import { SessionData, SessionStore } from "./types"; | ||
export default class MemoryStore implements SessionStore { | ||
store: Map<string, string>; | ||
constructor(); | ||
get(sid: string): Promise<SessionData | null>; | ||
@@ -5,0 +6,0 @@ set(sid: string, sess: SessionData): Promise<void>; |
export default class MemoryStore { | ||
store = new Map(); | ||
constructor() { | ||
this.store = new Map(); | ||
} | ||
@@ -4,0 +6,0 @@ async get(sid) { |
@@ -5,3 +5,3 @@ import { IncomingMessage, ServerResponse } from "http"; | ||
session?: Session; | ||
}, res: ServerResponse) => Promise<Session | undefined>; | ||
}, res: ServerResponse) => Promise<Session>; | ||
export type { Options, SessionStore } from "./types"; |
@@ -21,6 +21,3 @@ import { parse } from "cookie"; | ||
commitHeader(res, name, this, encode); | ||
if (!session[isDestroyed]) { | ||
await store.set(this.id, this); | ||
} | ||
await store.set(this.id, this); | ||
} | ||
@@ -50,3 +47,3 @@ }, | ||
return async function sessionHandle(req, res) { | ||
if (req.session) return; | ||
if (req.session) return req.session; | ||
@@ -53,0 +50,0 @@ const _now = Date.now(); |
{ | ||
"type": "module", | ||
"name": "next-session", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Simple promise-based session for Next.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -9,3 +9,3 @@ # next-session | ||
Simple _promise-based_ session for [Next.js](https://github.com/zeit/next.js). Also works in [micro](https://github.com/zeit/micro) or [Node.js HTTP Server](https://nodejs.org/api/http.html), [Express](https://github.com/expressjs/express), and more. | ||
Lightweight _promise-based_ session middleware for [Next.js](https://github.com/zeit/next.js). Also works in [micro](https://github.com/zeit/micro) or [Node.js HTTP Server](https://nodejs.org/api/http.html), [Express](https://github.com/expressjs/express), and more. | ||
@@ -12,0 +12,0 @@ > Check out alternatives like [next-iron-session](https://github.com/vvo/next-iron-session) instead. Also check out [nextjs-mongodb-app](https://github.com/hoangvvo/nextjs-mongodb-app) to see this module in use. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
33823
515
0