@adonisjs/session 6.3.0 → 6.4.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.
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  import '@japa/api-client';
3
+ import { InspectOptions } from 'util';
2
4
  import { AllowedSessionValues, SessionClientContract } from '@ioc:Adonis/Addons/Session';
3
5
  declare module '@japa/api-client' {
4
6
  interface ApiRequest {
@@ -24,6 +26,10 @@ declare module '@japa/api-client' {
24
26
  * Get session data
25
27
  */
26
28
  session(): Record<string, any>;
29
+ /**
30
+ * Dump session
31
+ */
32
+ dumpSession(options?: InspectOptions): this;
27
33
  /**
28
34
  * Get flash messages set by the server
29
35
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @adonisjs/session
3
+ *
4
+ * (c) Harminder Virk <virk@adonisjs.com>
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { SessionConfig } from '@ioc:Adonis/Addons/Session';
10
+ /**
11
+ * Helper to define session config
12
+ */
13
+ export declare function sessionConfig<Config extends SessionConfig>(config: Config): Config;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @adonisjs/session
4
+ *
5
+ * (c) Harminder Virk <virk@adonisjs.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.sessionConfig = void 0;
12
+ /**
13
+ * Helper to define session config
14
+ */
15
+ function sessionConfig(config) {
16
+ return config;
17
+ }
18
+ exports.sessionConfig = sessionConfig;
@@ -9,6 +9,7 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.defineTestsBindings = void 0;
12
+ const util_1 = require("util");
12
13
  /**
13
14
  * Define test bindings
14
15
  */
@@ -89,6 +90,14 @@ function defineTestsBindings(ApiRequest, ApiResponse, ApiClient, SessionManager)
89
90
  this.ensureHasAssert();
90
91
  this.assert.notProperty(this.flashMessages(), name);
91
92
  });
93
+ /**
94
+ * Dump session to the console
95
+ */
96
+ ApiResponse.macro('dumpSession', function (options) {
97
+ const inspectOptions = { depth: 2, showHidden: false, colors: true, ...options };
98
+ console.log(`"session" => ${(0, util_1.inspect)(this.session(), inspectOptions)}`);
99
+ console.log(`"flashMessages" => ${(0, util_1.inspect)(this.flashMessages(), inspectOptions)}`);
100
+ });
92
101
  /**
93
102
  * Adding hooks directly on the request object moves the hooks to
94
103
  * the end of the queue (basically after the globally hooks)
@@ -7,9 +7,9 @@
7
7
 
8
8
  import Env from '@ioc:Adonis/Core/Env'
9
9
  import Application from '@ioc:Adonis/Core/Application'
10
- import { SessionConfig } from '@ioc:Adonis/Addons/Session'
10
+ import { sessionConfig } from '@adonisjs/session/build/config'
11
11
 
12
- const sessionConfig: SessionConfig = {
12
+ export default sessionConfig({
13
13
  /*
14
14
  |--------------------------------------------------------------------------
15
15
  | Enable/Disable sessions
@@ -113,6 +113,4 @@ const sessionConfig: SessionConfig = {
113
113
  |
114
114
  */
115
115
  redisConnection: 'local',
116
- }
117
-
118
- export default sessionConfig
116
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/session",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "Session provider for AdonisJS",
5
5
  "typings": "./build/adonis-typings/index.d.ts",
6
6
  "main": "build/providers/SessionProvider.js",
@@ -8,6 +8,8 @@
8
8
  "build/adonis-typings",
9
9
  "build/providers",
10
10
  "build/src",
11
+ "build/config.js",
12
+ "build/config.d.ts",
11
13
  "build/templates",
12
14
  "build/instructions.md"
13
15
  ],
@@ -16,12 +18,12 @@
16
18
  "fs-extra": "^10.1.0"
17
19
  },
18
20
  "peerDependencies": {
19
- "@adonisjs/core": "^5.5.0"
21
+ "@adonisjs/core": "^5.8.0"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@adonisjs/core": "^5.8.2",
23
25
  "@adonisjs/mrm-preset": "^5.0.3",
24
- "@adonisjs/redis": "^7.2.0",
26
+ "@adonisjs/redis": "^7.3.0",
25
27
  "@adonisjs/require-ts": "^2.0.11",
26
28
  "@japa/assert": "^1.3.4",
27
29
  "@japa/preset-adonis": "^1.0.15",