@adonisjs/session 6.2.3 → 6.3.0

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.
@@ -34,6 +34,11 @@ export declare class Session implements SessionContract {
34
34
  * A copy of previously set flash messages
35
35
  */
36
36
  flashMessages: Store;
37
+ /**
38
+ * Session id for the current request. It will be different
39
+ * from the "this.sessionId" when regenerate is called.
40
+ */
41
+ private currentSessionId;
37
42
  /**
38
43
  * A instance of store with values read from the driver. The store
39
44
  * in initiated inside the [[initiate]] method
@@ -43,7 +48,7 @@ export declare class Session implements SessionContract {
43
48
  * Whether or not to re-generate the session id before comitting
44
49
  * session values.
45
50
  */
46
- private regenerateSessionId;
51
+ private regeneratedSessionId;
47
52
  /**
48
53
  * A copy of flash messages. The `input` messages
49
54
  * are overwritten when any of the input related
@@ -46,11 +46,16 @@ class Session {
46
46
  * A copy of previously set flash messages
47
47
  */
48
48
  this.flashMessages = new Store_1.Store({});
49
+ /**
50
+ * Session id for the current request. It will be different
51
+ * from the "this.sessionId" when regenerate is called.
52
+ */
53
+ this.currentSessionId = this.sessionId;
49
54
  /**
50
55
  * Whether or not to re-generate the session id before comitting
51
56
  * session values.
52
57
  */
53
- this.regenerateSessionId = false;
58
+ this.regeneratedSessionId = false;
54
59
  /**
55
60
  * A copy of flash messages. The `input` messages
56
61
  * are overwritten when any of the input related
@@ -180,7 +185,8 @@ class Session {
180
185
  */
181
186
  regenerate() {
182
187
  this.ctx.logger.trace('explicitly re-generating session id');
183
- this.regenerateSessionId = true;
188
+ this.sessionId = (0, helpers_1.cuid)();
189
+ this.regeneratedSessionId = true;
184
190
  }
185
191
  /**
186
192
  * Set/update session value
@@ -331,9 +337,8 @@ class Session {
331
337
  /**
332
338
  * Cleanup old session and re-generate new session
333
339
  */
334
- if (this.regenerateSessionId) {
335
- await this.driver.destroy(this.sessionId);
336
- this.sessionId = (0, helpers_1.cuid)();
340
+ if (this.regeneratedSessionId) {
341
+ await this.driver.destroy(this.currentSessionId);
337
342
  }
338
343
  /**
339
344
  * Touch the session cookie to keep it alive.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/session",
3
- "version": "6.2.3",
3
+ "version": "6.3.0",
4
4
  "description": "Session provider for AdonisJS",
5
5
  "typings": "./build/adonis-typings/index.d.ts",
6
6
  "main": "build/providers/SessionProvider.js",
@@ -19,17 +19,17 @@
19
19
  "@adonisjs/core": "^5.5.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@adonisjs/core": "^5.7.6",
22
+ "@adonisjs/core": "^5.8.2",
23
23
  "@adonisjs/mrm-preset": "^5.0.3",
24
24
  "@adonisjs/redis": "^7.2.0",
25
25
  "@adonisjs/require-ts": "^2.0.11",
26
26
  "@japa/assert": "^1.3.4",
27
27
  "@japa/preset-adonis": "^1.0.15",
28
28
  "@japa/run-failed-tests": "^1.0.7",
29
- "@japa/runner": "^2.0.7",
29
+ "@japa/runner": "^2.0.8",
30
30
  "@japa/spec-reporter": "^1.1.12",
31
31
  "@poppinss/dev-utils": "^2.0.3",
32
- "@types/node": "^17.0.32",
32
+ "@types/node": "^17.0.34",
33
33
  "@types/supertest": "^2.0.12",
34
34
  "commitizen": "^4.2.4",
35
35
  "copyfiles": "^2.4.1",