@adonisjs/session 6.4.0 → 7.0.0-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.
- package/build/configure.d.ts +5 -0
- package/build/configure.js +18 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +12 -0
- package/build/providers/session_provider.d.ts +13 -0
- package/build/providers/session_provider.js +43 -0
- package/build/src/bindings/api_client.d.ts +2 -0
- package/build/src/{Bindings/Tests.js → bindings/api_client.js} +8 -13
- package/build/src/bindings/http_context.d.ts +5 -0
- package/build/src/bindings/http_context.js +17 -0
- package/build/{adonis-typings/tests.d.ts → src/bindings/types.d.ts} +26 -5
- package/build/{adonis-typings/session.js → src/bindings/types.js} +2 -1
- package/build/src/{Client/index.d.ts → client.d.ts} +7 -15
- package/build/src/client.js +100 -0
- package/build/src/define_config.d.ts +5 -0
- package/build/src/define_config.js +13 -0
- package/build/src/{Drivers/Cookie.d.ts → drivers/cookie.d.ts} +4 -6
- package/build/src/{Drivers/Cookie.js → drivers/cookie.js} +10 -12
- package/build/src/{Drivers/File.d.ts → drivers/file.d.ts} +3 -8
- package/build/src/{Drivers/File.js → drivers/file.js} +20 -23
- package/build/src/{Drivers/Memory.d.ts → drivers/memory.d.ts} +2 -3
- package/build/src/{Drivers/Memory.js → drivers/memory.js} +3 -7
- package/build/src/{Drivers/Redis.d.ts → drivers/redis.d.ts} +5 -15
- package/build/src/drivers/redis.js +74 -0
- package/build/src/{Session/index.d.ts → session.d.ts} +6 -67
- package/build/src/session.js +373 -0
- package/build/src/session_manager.d.ts +38 -0
- package/build/src/session_manager.js +149 -0
- package/build/src/session_middleware.d.ts +5 -0
- package/build/src/session_middleware.js +20 -0
- package/build/src/{Store/index.d.ts → store.d.ts} +3 -7
- package/build/src/{Store/index.js → store.js} +18 -18
- package/build/src/types.d.ts +61 -0
- package/build/src/types.js +1 -0
- package/build/{templates/session.txt → stubs/config.stub} +12 -15
- package/build/stubs/main.d.ts +1 -0
- package/build/{adonis-typings/tests.js → stubs/main.js} +2 -3
- package/package.json +96 -134
- package/build/adonis-typings/container.d.ts +0 -14
- package/build/adonis-typings/container.js +0 -8
- package/build/adonis-typings/context.d.ts +0 -14
- package/build/adonis-typings/context.js +0 -8
- package/build/adonis-typings/index.d.ts +0 -4
- package/build/adonis-typings/index.js +0 -12
- package/build/adonis-typings/session.d.ts +0 -265
- package/build/config.d.ts +0 -13
- package/build/config.js +0 -18
- package/build/instructions.md +0 -10
- package/build/providers/SessionProvider.d.ts +0 -31
- package/build/providers/SessionProvider.js +0 -56
- package/build/src/Bindings/Server.d.ts +0 -10
- package/build/src/Bindings/Server.js +0 -42
- package/build/src/Bindings/Tests.d.ts +0 -7
- package/build/src/Client/index.js +0 -93
- package/build/src/Drivers/Redis.js +0 -73
- package/build/src/Session/index.js +0 -352
- package/build/src/SessionManager/index.d.ts +0 -78
- package/build/src/SessionManager/index.js +0 -148
package/package.json
CHANGED
|
@@ -1,167 +1,129 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/session",
|
|
3
|
-
"version": "6.4.0",
|
|
4
3
|
"description": "Session provider for AdonisJS",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"version": "7.0.0-0",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18.16.0"
|
|
7
|
+
},
|
|
8
|
+
"main": "build/index.js",
|
|
9
|
+
"type": "module",
|
|
7
10
|
"files": [
|
|
8
|
-
"build/adonis-typings",
|
|
9
|
-
"build/providers",
|
|
10
11
|
"build/src",
|
|
11
|
-
"build/
|
|
12
|
-
"build/
|
|
13
|
-
"build/
|
|
14
|
-
"build/
|
|
12
|
+
"build/stubs",
|
|
13
|
+
"build/providers",
|
|
14
|
+
"build/index.d.ts",
|
|
15
|
+
"build/index.js",
|
|
16
|
+
"build/configure.d.ts",
|
|
17
|
+
"build/configure.js"
|
|
15
18
|
],
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"@adonisjs/core": "^5.8.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@adonisjs/core": "^5.8.2",
|
|
25
|
-
"@adonisjs/mrm-preset": "^5.0.3",
|
|
26
|
-
"@adonisjs/redis": "^7.3.0",
|
|
27
|
-
"@adonisjs/require-ts": "^2.0.11",
|
|
28
|
-
"@japa/assert": "^1.3.4",
|
|
29
|
-
"@japa/preset-adonis": "^1.0.15",
|
|
30
|
-
"@japa/run-failed-tests": "^1.0.7",
|
|
31
|
-
"@japa/runner": "^2.0.8",
|
|
32
|
-
"@japa/spec-reporter": "^1.1.12",
|
|
33
|
-
"@poppinss/dev-utils": "^2.0.3",
|
|
34
|
-
"@types/node": "^17.0.34",
|
|
35
|
-
"@types/supertest": "^2.0.12",
|
|
36
|
-
"commitizen": "^4.2.4",
|
|
37
|
-
"copyfiles": "^2.4.1",
|
|
38
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
39
|
-
"del-cli": "^4.0.1",
|
|
40
|
-
"eslint": "^8.15.0",
|
|
41
|
-
"eslint-config-prettier": "^8.5.0",
|
|
42
|
-
"eslint-plugin-adonis": "^2.1.0",
|
|
43
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
44
|
-
"github-label-sync": "^2.2.0",
|
|
45
|
-
"husky": "^8.0.1",
|
|
46
|
-
"mrm": "^4.0.0",
|
|
47
|
-
"np": "^7.6.1",
|
|
48
|
-
"prettier": "^2.6.2",
|
|
49
|
-
"set-cookie-parser": "^2.4.8",
|
|
50
|
-
"supertest": "^6.2.3",
|
|
51
|
-
"typescript": "^4.6.4"
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./build/index.js",
|
|
21
|
+
"./session_provider": "./build/providers/session_provider.js",
|
|
22
|
+
"./session_middleware": "./build/src/session_middleware.js",
|
|
23
|
+
"./types": "./build/src/types.js"
|
|
52
24
|
},
|
|
53
25
|
"scripts": {
|
|
54
|
-
"mrm": "mrm --preset=@adonisjs/mrm-preset",
|
|
55
26
|
"pretest": "npm run lint",
|
|
56
|
-
"test": "
|
|
57
|
-
"clean": "del build",
|
|
27
|
+
"test": "c8 npm run quick:test",
|
|
28
|
+
"clean": "del-cli build",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
|
|
58
31
|
"compile": "npm run lint && npm run clean && tsc",
|
|
59
|
-
"
|
|
60
|
-
"build": "npm run compile && npm run copyfiles",
|
|
61
|
-
"commit": "git-cz",
|
|
62
|
-
"release": "np --message=\"chore(release): %s\"",
|
|
63
|
-
"version": "npm run build",
|
|
32
|
+
"build": "npm run compile && npm run copy:templates",
|
|
64
33
|
"prepublishOnly": "npm run build",
|
|
65
34
|
"lint": "eslint . --ext=.ts",
|
|
66
35
|
"format": "prettier --write .",
|
|
67
|
-
"
|
|
36
|
+
"release": "np",
|
|
37
|
+
"version": "npm run build",
|
|
38
|
+
"sync-labels": "github-label-sync --labels .github/labels.json adonisjs/ally",
|
|
39
|
+
"quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@adonisjs/application": "7.1.2-8",
|
|
43
|
+
"@adonisjs/core": "6.1.5-8",
|
|
44
|
+
"@adonisjs/eslint-config": "^1.1.8",
|
|
45
|
+
"@adonisjs/prettier-config": "^1.1.8",
|
|
46
|
+
"@adonisjs/redis": "8.0.0-1",
|
|
47
|
+
"@adonisjs/tsconfig": "^1.1.8",
|
|
48
|
+
"@adonisjs/view": "7.0.0-4",
|
|
49
|
+
"@japa/api-client": "2.0.0-0",
|
|
50
|
+
"@japa/assert": "2.0.0-1",
|
|
51
|
+
"@japa/file-system": "2.0.0-1",
|
|
52
|
+
"@japa/plugin-adonisjs": "2.0.0-1",
|
|
53
|
+
"@japa/runner": "3.0.0-6",
|
|
54
|
+
"@poppinss/dev-utils": "^2.0.3",
|
|
55
|
+
"@swc/core": "^1.3.70",
|
|
56
|
+
"@types/fs-extra": "^11.0.1",
|
|
57
|
+
"@types/node": "^20.4.2",
|
|
58
|
+
"@types/set-cookie-parser": "^2.4.3",
|
|
59
|
+
"@types/supertest": "^2.0.12",
|
|
60
|
+
"c8": "^8.0.0",
|
|
61
|
+
"copyfiles": "^2.4.1",
|
|
62
|
+
"del-cli": "^5.0.0",
|
|
63
|
+
"eslint": "^8.45.0",
|
|
64
|
+
"github-label-sync": "^2.3.1",
|
|
65
|
+
"husky": "^8.0.3",
|
|
66
|
+
"np": "^8.0.4",
|
|
67
|
+
"prettier": "^3.0.0",
|
|
68
|
+
"set-cookie-parser": "^2.6.0",
|
|
69
|
+
"supertest": "^6.3.3",
|
|
70
|
+
"ts-node": "^10.9.1",
|
|
71
|
+
"typescript": "^5.1.6"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@poppinss/utils": "6.5.0-3",
|
|
75
|
+
"fs-extra": "^11.1.1"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"@adonisjs/core": "6.1.5-8",
|
|
79
|
+
"@adonisjs/redis": "8.0.0-1"
|
|
80
|
+
},
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"@adonisjs/redis": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
68
85
|
},
|
|
86
|
+
"author": "virk,adonisjs",
|
|
87
|
+
"license": "MIT",
|
|
88
|
+
"homepage": "https://github.com/adonisjs/adonis-session#readme",
|
|
69
89
|
"repository": {
|
|
70
90
|
"type": "git",
|
|
71
91
|
"url": "git+https://github.com/adonisjs/adonis-session.git"
|
|
72
92
|
},
|
|
93
|
+
"bugs": {
|
|
94
|
+
"url": "https://github.com/adonisjs/adonis-session/issues"
|
|
95
|
+
},
|
|
73
96
|
"keywords": [
|
|
74
97
|
"session",
|
|
75
98
|
"adonisjs"
|
|
76
99
|
],
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"bugs": {
|
|
80
|
-
"url": "https://github.com/adonisjs/adonis-session/issues"
|
|
100
|
+
"eslintConfig": {
|
|
101
|
+
"extends": "@adonisjs/eslint-config/package"
|
|
81
102
|
},
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
],
|
|
87
|
-
"extension": [
|
|
88
|
-
".ts"
|
|
103
|
+
"prettier": "@adonisjs/prettier-config",
|
|
104
|
+
"commitlint": {
|
|
105
|
+
"extends": [
|
|
106
|
+
"@commitlint/config-conventional"
|
|
89
107
|
]
|
|
90
108
|
},
|
|
91
|
-
"husky": {
|
|
92
|
-
"hooks": {
|
|
93
|
-
"commit-msg": "node ./node_modules/@adonisjs/mrm-preset/validateCommit/conventional/validate.js"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"config": {
|
|
97
|
-
"commitizen": {
|
|
98
|
-
"path": "cz-conventional-changelog"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
109
|
"publishConfig": {
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
},
|
|
105
|
-
"adonisjs": {
|
|
106
|
-
"instructionsMd": "./build/instructions.md",
|
|
107
|
-
"templates": {
|
|
108
|
-
"config": [
|
|
109
|
-
"session.txt"
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
"env": {
|
|
113
|
-
"SESSION_DRIVER": "cookie"
|
|
114
|
-
},
|
|
115
|
-
"types": "@adonisjs/session",
|
|
116
|
-
"providers": [
|
|
117
|
-
"@adonisjs/session"
|
|
118
|
-
]
|
|
110
|
+
"access": "public",
|
|
111
|
+
"tag": "next"
|
|
119
112
|
},
|
|
120
113
|
"np": {
|
|
121
|
-
"
|
|
114
|
+
"message": "chore(release): %s",
|
|
115
|
+
"tag": "next",
|
|
116
|
+
"branch": "main",
|
|
122
117
|
"anyBranch": false
|
|
123
118
|
},
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"github-actions"
|
|
129
|
-
],
|
|
130
|
-
"minNodeVersion": "14.15.4",
|
|
131
|
-
"probotApps": [
|
|
132
|
-
"stale",
|
|
133
|
-
"lock"
|
|
134
|
-
],
|
|
135
|
-
"runGhActionsOnWindows": false
|
|
136
|
-
},
|
|
137
|
-
"eslintConfig": {
|
|
138
|
-
"extends": [
|
|
139
|
-
"plugin:adonis/typescriptPackage",
|
|
140
|
-
"prettier"
|
|
141
|
-
],
|
|
142
|
-
"plugins": [
|
|
143
|
-
"prettier"
|
|
119
|
+
"c8": {
|
|
120
|
+
"reporter": [
|
|
121
|
+
"text",
|
|
122
|
+
"html"
|
|
144
123
|
],
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"endOfLine": "auto"
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
"eslintIgnore": [
|
|
155
|
-
"build"
|
|
156
|
-
],
|
|
157
|
-
"prettier": {
|
|
158
|
-
"trailingComma": "es5",
|
|
159
|
-
"semi": false,
|
|
160
|
-
"singleQuote": true,
|
|
161
|
-
"useTabs": false,
|
|
162
|
-
"quoteProps": "consistent",
|
|
163
|
-
"bracketSpacing": true,
|
|
164
|
-
"arrowParens": "always",
|
|
165
|
-
"printWidth": 100
|
|
124
|
+
"exclude": [
|
|
125
|
+
"tests/**",
|
|
126
|
+
"stubs/**"
|
|
127
|
+
]
|
|
166
128
|
}
|
|
167
129
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
declare module '@ioc:Adonis/Core/Application' {
|
|
10
|
-
import { SessionManagerContract } from '@ioc:Adonis/Addons/Session';
|
|
11
|
-
interface ContainerBindings {
|
|
12
|
-
'Adonis/Addons/Session': SessionManagerContract;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
declare module '@ioc:Adonis/Core/HttpContext' {
|
|
10
|
-
import { SessionContract } from '@ioc:Adonis/Addons/Session';
|
|
11
|
-
interface HttpContextContract {
|
|
12
|
-
session: SessionContract;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
/// <reference path="./session.ts" />
|
|
10
|
-
/// <reference path="./context.ts" />
|
|
11
|
-
/// <reference path="./container.ts" />
|
|
12
|
-
/// <reference path="./tests.ts" />
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/// <reference types="@adonisjs/http-server/build/adonis-typings" />
|
|
2
|
-
/// <reference types="@adonisjs/application/build/adonis-typings" />
|
|
3
|
-
declare module '@ioc:Adonis/Addons/Session' {
|
|
4
|
-
import { CookieOptions } from '@ioc:Adonis/Core/Response';
|
|
5
|
-
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
6
|
-
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
|
|
7
|
-
/**
|
|
8
|
-
* Shape of session config.
|
|
9
|
-
*/
|
|
10
|
-
export interface SessionConfig {
|
|
11
|
-
/**
|
|
12
|
-
* Enable/disable session for the entire application lifecycle
|
|
13
|
-
*/
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The driver in play
|
|
17
|
-
*/
|
|
18
|
-
driver: string;
|
|
19
|
-
/**
|
|
20
|
-
* Cookie name.
|
|
21
|
-
*/
|
|
22
|
-
cookieName: string;
|
|
23
|
-
/**
|
|
24
|
-
* Clear session when browser closes
|
|
25
|
-
*/
|
|
26
|
-
clearWithBrowser: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Age of session cookie
|
|
29
|
-
*/
|
|
30
|
-
age: string | number;
|
|
31
|
-
/**
|
|
32
|
-
* Config for the cookie driver and also the session id
|
|
33
|
-
* cookie
|
|
34
|
-
*/
|
|
35
|
-
cookie: Omit<Partial<CookieOptions>, 'maxAge' | 'expires'>;
|
|
36
|
-
/**
|
|
37
|
-
* Config for the file driver
|
|
38
|
-
*/
|
|
39
|
-
file?: {
|
|
40
|
-
location: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The redis connection to use from the `config/redis` file
|
|
44
|
-
*/
|
|
45
|
-
redisConnection?: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Shape of a driver that every session driver must have
|
|
49
|
-
*/
|
|
50
|
-
export interface SessionDriverContract {
|
|
51
|
-
read(sessionId: string): Promise<Record<string, any> | null> | Record<string, any> | null;
|
|
52
|
-
write(sessionId: string, values: Record<string, any>): Promise<void> | void;
|
|
53
|
-
destroy(sessionId: string): Promise<void> | void;
|
|
54
|
-
touch(sessionId: string): Promise<void> | void;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* The callback to be passed to the `extend` method. It is invoked
|
|
58
|
-
* for each request (if extended driver is in use).
|
|
59
|
-
*/
|
|
60
|
-
export type ExtendCallback = (manager: SessionManagerContract, config: SessionConfig, ctx: HttpContextContract) => SessionDriverContract;
|
|
61
|
-
/**
|
|
62
|
-
* The values allowed by the `session.put` method
|
|
63
|
-
*/
|
|
64
|
-
export type AllowedSessionValues = string | boolean | number | object | Date | Array<any>;
|
|
65
|
-
/**
|
|
66
|
-
* Store used for storing session values + flash messages
|
|
67
|
-
*/
|
|
68
|
-
export interface StoreContract {
|
|
69
|
-
/**
|
|
70
|
-
* A boolean to know if store is empty
|
|
71
|
-
*/
|
|
72
|
-
isEmpty: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Set value for a key
|
|
75
|
-
*/
|
|
76
|
-
set(key: string, value: AllowedSessionValues): void;
|
|
77
|
-
/**
|
|
78
|
-
* Increment value for a key. An exception is raised when existing
|
|
79
|
-
* value is not a number
|
|
80
|
-
*/
|
|
81
|
-
increment(key: string, steps?: number): void;
|
|
82
|
-
/**
|
|
83
|
-
* Decrement value for a key. An exception is raised when existing
|
|
84
|
-
* value is not a number
|
|
85
|
-
*/
|
|
86
|
-
decrement(key: string, steps?: number): void;
|
|
87
|
-
/**
|
|
88
|
-
* Replace existing values with new ones
|
|
89
|
-
*/
|
|
90
|
-
update(values: Record<string, any>): void;
|
|
91
|
-
/**
|
|
92
|
-
* Merge values with existing ones
|
|
93
|
-
*/
|
|
94
|
-
merge(values: Record<string, any>): any;
|
|
95
|
-
/**
|
|
96
|
-
* Get all values
|
|
97
|
-
*/
|
|
98
|
-
all(): any;
|
|
99
|
-
/**
|
|
100
|
-
* Get value for a given key or use the default value
|
|
101
|
-
*/
|
|
102
|
-
get(key: string, defaultValue?: any): any;
|
|
103
|
-
/**
|
|
104
|
-
* Find if a value exists. Optionally you can also check arrays
|
|
105
|
-
* to have length too
|
|
106
|
-
*/
|
|
107
|
-
has(key: string, checkForArraysLength?: boolean): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Unset value
|
|
110
|
-
*/
|
|
111
|
-
unset(key: string): void;
|
|
112
|
-
/**
|
|
113
|
-
* Clear all values
|
|
114
|
-
*/
|
|
115
|
-
clear(): void;
|
|
116
|
-
/**
|
|
117
|
-
* Read value and then unset it at the same time
|
|
118
|
-
*/
|
|
119
|
-
pull(key: string, defaultValue?: any): any;
|
|
120
|
-
/**
|
|
121
|
-
* Convert store values toObject
|
|
122
|
-
*/
|
|
123
|
-
toObject(): any;
|
|
124
|
-
/**
|
|
125
|
-
* Convert store values to toJSON
|
|
126
|
-
*/
|
|
127
|
-
toJSON(): any;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Shape of the actual session store
|
|
131
|
-
*/
|
|
132
|
-
export interface SessionContract {
|
|
133
|
-
/**
|
|
134
|
-
* Has the store being initiated
|
|
135
|
-
*/
|
|
136
|
-
initiated: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Is session store readonly. Will be during Websockets
|
|
139
|
-
* request
|
|
140
|
-
*/
|
|
141
|
-
readonly: boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Is session just created or we read received the
|
|
144
|
-
* session id from the request
|
|
145
|
-
*/
|
|
146
|
-
fresh: boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Session id
|
|
149
|
-
*/
|
|
150
|
-
sessionId: string;
|
|
151
|
-
/**
|
|
152
|
-
* Previous request flash messages
|
|
153
|
-
*/
|
|
154
|
-
flashMessages: StoreContract;
|
|
155
|
-
/**
|
|
156
|
-
* Flash messages that will be sent in the current
|
|
157
|
-
* request response
|
|
158
|
-
*/
|
|
159
|
-
responseFlashMessages: StoreContract;
|
|
160
|
-
/**
|
|
161
|
-
* Initiate session store
|
|
162
|
-
*/
|
|
163
|
-
initiate(readonly: boolean): Promise<void>;
|
|
164
|
-
/**
|
|
165
|
-
* Commit session mutations
|
|
166
|
-
*/
|
|
167
|
-
commit(): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Re-generate session id. This help avoid session
|
|
170
|
-
* replay attacks.
|
|
171
|
-
*/
|
|
172
|
-
regenerate(): void;
|
|
173
|
-
/**
|
|
174
|
-
* Store API
|
|
175
|
-
*/
|
|
176
|
-
has(key: string): boolean;
|
|
177
|
-
put(key: string, value: AllowedSessionValues): void;
|
|
178
|
-
get(key: string, defaultValue?: any): any;
|
|
179
|
-
all(): any;
|
|
180
|
-
forget(key: string): void;
|
|
181
|
-
pull(key: string, defaultValue?: any): any;
|
|
182
|
-
increment(key: string, steps?: number): any;
|
|
183
|
-
decrement(key: string, steps?: number): any;
|
|
184
|
-
clear(): void;
|
|
185
|
-
/**
|
|
186
|
-
* Flash a key-value pair
|
|
187
|
-
*/
|
|
188
|
-
flash(values: {
|
|
189
|
-
[key: string]: AllowedSessionValues;
|
|
190
|
-
}): void;
|
|
191
|
-
flash(key: string, value: AllowedSessionValues): void;
|
|
192
|
-
/**
|
|
193
|
-
* Flash request body
|
|
194
|
-
*/
|
|
195
|
-
flashAll(): void;
|
|
196
|
-
/**
|
|
197
|
-
* Flash selected keys from the request body
|
|
198
|
-
*/
|
|
199
|
-
flashOnly(keys: string[]): void;
|
|
200
|
-
/**
|
|
201
|
-
* Omit selected keys from the request data and flash
|
|
202
|
-
* the rest of values
|
|
203
|
-
*/
|
|
204
|
-
flashExcept(keys: string[]): void;
|
|
205
|
-
/**
|
|
206
|
-
* Reflash existing flash messages
|
|
207
|
-
*/
|
|
208
|
-
reflash(): void;
|
|
209
|
-
/**
|
|
210
|
-
* Reflash selected keys from the existing flash messages
|
|
211
|
-
*/
|
|
212
|
-
reflashOnly(keys: string[]): void;
|
|
213
|
-
/**
|
|
214
|
-
* Omit selected keys from the existing flash messages
|
|
215
|
-
* and flash the rest of values
|
|
216
|
-
*/
|
|
217
|
-
reflashExcept(keys: string[]): void;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* SessionClient exposes the API to set session data as a client
|
|
221
|
-
*/
|
|
222
|
-
export interface SessionClientContract extends StoreContract {
|
|
223
|
-
/**
|
|
224
|
-
* Find if the sessions are enabled
|
|
225
|
-
*/
|
|
226
|
-
isEnabled(): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Flash messages store to set flash messages
|
|
229
|
-
*/
|
|
230
|
-
flashMessages: StoreContract;
|
|
231
|
-
/**
|
|
232
|
-
* Load session data from the driver
|
|
233
|
-
*/
|
|
234
|
-
load(cookies: Record<string, any>): Promise<{
|
|
235
|
-
session: Record<string, any>;
|
|
236
|
-
flashMessages: Record<string, any> | null;
|
|
237
|
-
}>;
|
|
238
|
-
/**
|
|
239
|
-
* Commits the session data to the session store and returns
|
|
240
|
-
* the session id and cookie name for it to be accessible
|
|
241
|
-
* by the server
|
|
242
|
-
*/
|
|
243
|
-
commit(): Promise<{
|
|
244
|
-
cookieName: string;
|
|
245
|
-
sessionId: string;
|
|
246
|
-
signedSessionId: string;
|
|
247
|
-
}>;
|
|
248
|
-
/**
|
|
249
|
-
* Forget the session data.
|
|
250
|
-
*/
|
|
251
|
-
forget(): Promise<void>;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Session manager shape
|
|
255
|
-
*/
|
|
256
|
-
export interface SessionManagerContract {
|
|
257
|
-
isEnabled(): boolean;
|
|
258
|
-
application: ApplicationContract;
|
|
259
|
-
client(): SessionClientContract;
|
|
260
|
-
create(ctx: HttpContextContract): SessionContract;
|
|
261
|
-
extend(driver: string, callback: ExtendCallback): void;
|
|
262
|
-
}
|
|
263
|
-
const Session: SessionManagerContract;
|
|
264
|
-
export default Session;
|
|
265
|
-
}
|
package/build/config.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
package/build/config.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
package/build/instructions.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
The package has been configured successfully. The session configuration stored inside `config/session.ts` file relies on the following environment variables and hence we recommend validating them.
|
|
2
|
-
|
|
3
|
-
Open the `env.ts` file and paste the following code inside the `Env.rules` object.
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
SESSION_DRIVER: Env.schema.string()
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
- Here we expect the `SESSION_DRIVER` environment variable to be always present
|
|
10
|
-
- And should be a valid string
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
/// <reference types="@adonisjs/application/build/adonis-typings" />
|
|
10
|
-
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
|
|
11
|
-
/**
|
|
12
|
-
* Session provider for AdonisJS
|
|
13
|
-
*/
|
|
14
|
-
export default class SessionProvider {
|
|
15
|
-
protected app: ApplicationContract;
|
|
16
|
-
constructor(app: ApplicationContract);
|
|
17
|
-
static needsApplication: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Register Session Manager
|
|
20
|
-
*/
|
|
21
|
-
register(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Register bindings for tests
|
|
24
|
-
*/
|
|
25
|
-
protected registerTestsBindings(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Register server bindings
|
|
28
|
-
*/
|
|
29
|
-
protected registerServerBindings(): void;
|
|
30
|
-
boot(): void;
|
|
31
|
-
}
|