koa-session
Advanced tools
Comparing version 6.1.0 to 6.2.0
6.2.0 / 2021-03-30 | ||
================== | ||
**features** | ||
* [[`7cde341`](http://github.com/koajs/session/commit/7cde341db1691ee6885eb1b11ff3a3a3632fd5ce)] - feat: add session.externalKey (#207) (Yiyu He <<dead_horse@qq.com>>) | ||
6.1.0 / 2020-10-08 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -207,3 +207,3 @@ 'use strict'; | ||
if (this.store) this.externalKey = externalKey || this.opts.genid && this.opts.genid(this.ctx); | ||
this.session = new Session(this, val); | ||
this.session = new Session(this, val, this.externalKey); | ||
} | ||
@@ -210,0 +210,0 @@ |
@@ -7,2 +7,4 @@ 'use strict'; | ||
const inspect = Symbol.for('nodejs.util.inspect.custom'); | ||
class Session { | ||
@@ -16,5 +18,6 @@ /** | ||
constructor(sessionContext, obj) { | ||
constructor(sessionContext, obj, externalKey) { | ||
this._sessCtx = sessionContext; | ||
this._ctx = sessionContext.ctx; | ||
this._externalKey = externalKey; | ||
if (!obj) { | ||
@@ -57,3 +60,3 @@ this.isNew = true; | ||
inspect() { | ||
[inspect]() { | ||
return this.toJSON(); | ||
@@ -110,2 +113,10 @@ } | ||
/** | ||
* get session external key | ||
* only exist if opts.store present | ||
*/ | ||
get externalKey() { | ||
return this._externalKey; | ||
} | ||
/** | ||
* save this session no matter whether it is populated | ||
@@ -112,0 +123,0 @@ * |
@@ -5,3 +5,3 @@ { | ||
"repository": "koajs/session", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "koa", |
@@ -163,2 +163,6 @@ # koa-session | ||
### Session#externalKey | ||
Get session external key, only exist when external session store present. | ||
### Session#save() | ||
@@ -165,0 +169,0 @@ |
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
34685
567
186