@midwayjs/session 4.0.0-beta.11 → 4.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ export interface ISession {
16
16
  /**
17
17
  * get/set session maxAge
18
18
  */
19
- maxAge: SessionOptions["maxAge"];
19
+ maxAge: SessionOptions['maxAge'];
20
20
  /**
21
21
  * commit this session's headers if autoCommit is set to false.
22
22
  */
@@ -55,7 +55,7 @@ export interface SessionOptions extends Omit<CookieSetOptions, 'maxAge'> {
55
55
  * "session" will result in a cookie that expires when session/browser is closed
56
56
  * Warning: If a session cookie is stolen, this cookie will never expire
57
57
  */
58
- maxAge?: number | "session" | undefined;
58
+ maxAge?: number | 'session' | undefined;
59
59
  /**
60
60
  * custom encode method
61
61
  */
@@ -40,7 +40,12 @@ class ContextSession {
40
40
  if (session === false)
41
41
  return null;
42
42
  // create an empty session or init from cookie
43
- this.store ? this.create() : this.initFromCookie();
43
+ if (this.store) {
44
+ this.create();
45
+ }
46
+ else {
47
+ this.initFromCookie();
48
+ }
44
49
  return this.session;
45
50
  }
46
51
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/session",
3
3
  "description": "midway session component for koa and faas",
4
- "version": "4.0.0-beta.11",
4
+ "version": "4.0.0-beta.12",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -10,8 +10,8 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "devDependencies": {
13
- "@midwayjs/core": "^4.0.0-beta.11",
14
- "@midwayjs/mock": "^4.0.0-beta.11"
13
+ "@midwayjs/core": "^4.0.0-beta.12",
14
+ "@midwayjs/mock": "^4.0.0-beta.12"
15
15
  },
16
16
  "dependencies": {
17
17
  "@midwayjs/cookies": "^1.3.0"
@@ -39,5 +39,5 @@
39
39
  "type": "git",
40
40
  "url": "https://github.com/midwayjs/midway.git"
41
41
  },
42
- "gitHead": "6ef05719ca6e900f1ec34aff7a5c5a9614358c50"
42
+ "gitHead": "1c48179b7c827ba8ec9351e9b6c36ec1726d3e11"
43
43
  }