@adonisjs/session 6.1.0 → 6.1.3
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/LICENSE.md +1 -1
- package/build/src/Client/index.js +1 -1
- package/build/src/Drivers/File.js +5 -5
- package/build/src/Session/index.js +2 -2
- package/package.json +70 -25
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright 2022 Harminder Virk, contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@ class SessionClient extends Store_1.Store {
|
|
|
25
25
|
* Each instance of client works on a single session id. Generate
|
|
26
26
|
* multiple client instances for a different session id
|
|
27
27
|
*/
|
|
28
|
-
this.sessionId = helpers_1.cuid();
|
|
28
|
+
this.sessionId = (0, helpers_1.cuid)();
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Commits the session data to the session store and returns
|
|
@@ -28,7 +28,7 @@ class FileDriver {
|
|
|
28
28
|
* Returns complete path to the session file
|
|
29
29
|
*/
|
|
30
30
|
getFilePath(sessionId) {
|
|
31
|
-
return path_1.join(this.config.file.location, `${sessionId}.txt`);
|
|
31
|
+
return (0, path_1.join)(this.config.file.location, `${sessionId}.txt`);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Returns file contents. A new file will be created if it's
|
|
@@ -36,8 +36,8 @@ class FileDriver {
|
|
|
36
36
|
*/
|
|
37
37
|
async read(sessionId) {
|
|
38
38
|
const filePath = this.getFilePath(sessionId);
|
|
39
|
-
await fs_extra_1.ensureFile(filePath);
|
|
40
|
-
const contents = await fs_extra_1.readFile(filePath, 'utf-8');
|
|
39
|
+
await (0, fs_extra_1.ensureFile)(filePath);
|
|
40
|
+
const contents = await (0, fs_extra_1.readFile)(filePath, 'utf-8');
|
|
41
41
|
if (!contents.trim()) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
@@ -58,13 +58,13 @@ class FileDriver {
|
|
|
58
58
|
throw new Error('Session file driver expects an object of values');
|
|
59
59
|
}
|
|
60
60
|
const message = new helpers_1.MessageBuilder().build(values, undefined, sessionId);
|
|
61
|
-
await fs_extra_1.outputFile(this.getFilePath(sessionId), message);
|
|
61
|
+
await (0, fs_extra_1.outputFile)(this.getFilePath(sessionId), message);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Cleanup session file by removing it
|
|
65
65
|
*/
|
|
66
66
|
async destroy(sessionId) {
|
|
67
|
-
await fs_extra_1.remove(this.getFilePath(sessionId));
|
|
67
|
+
await (0, fs_extra_1.remove)(this.getFilePath(sessionId));
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Writes the value by reading it from the store
|
|
@@ -86,7 +86,7 @@ class Session {
|
|
|
86
86
|
}
|
|
87
87
|
this.fresh = true;
|
|
88
88
|
this.ctx.logger.trace('generating new session id');
|
|
89
|
-
return helpers_1.cuid();
|
|
89
|
+
return (0, helpers_1.cuid)();
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Ensures the session store is initialized
|
|
@@ -333,7 +333,7 @@ class Session {
|
|
|
333
333
|
*/
|
|
334
334
|
if (this.regenerateSessionId) {
|
|
335
335
|
await this.driver.destroy(this.sessionId);
|
|
336
|
-
this.sessionId = helpers_1.cuid();
|
|
336
|
+
this.sessionId = (0, helpers_1.cuid)();
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
339
339
|
* 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.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"description": "Session provider for AdonisJS",
|
|
5
5
|
"typings": "./build/adonis-typings/index.d.ts",
|
|
6
6
|
"main": "build/providers/SessionProvider.js",
|
|
@@ -12,45 +12,47 @@
|
|
|
12
12
|
"build/instructions.md"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@poppinss/utils": "^
|
|
16
|
-
"fs-extra": "^10.0.
|
|
15
|
+
"@poppinss/utils": "^4.0.2",
|
|
16
|
+
"fs-extra": "^10.0.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@adonisjs/core": "^5.
|
|
19
|
+
"@adonisjs/core": "^5.5.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@adonisjs/core": "^5.
|
|
23
|
-
"@adonisjs/mrm-preset": "^
|
|
24
|
-
"@adonisjs/redis": "^7.
|
|
25
|
-
"@adonisjs/require-ts": "^2.0.
|
|
26
|
-
"@poppinss/dev-utils": "^
|
|
27
|
-
"@types/node": "^
|
|
22
|
+
"@adonisjs/core": "^5.5.0",
|
|
23
|
+
"@adonisjs/mrm-preset": "^5.0.2",
|
|
24
|
+
"@adonisjs/redis": "^7.1.1",
|
|
25
|
+
"@adonisjs/require-ts": "^2.0.10",
|
|
26
|
+
"@poppinss/dev-utils": "^2.0.2",
|
|
27
|
+
"@types/node": "^17.0.21",
|
|
28
28
|
"@types/supertest": "^2.0.11",
|
|
29
|
+
"commitizen": "^4.2.4",
|
|
29
30
|
"copyfiles": "^2.4.1",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"eslint
|
|
33
|
-
"eslint-
|
|
34
|
-
"eslint-plugin-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
31
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
32
|
+
"del-cli": "^4.0.1",
|
|
33
|
+
"eslint": "^8.10.0",
|
|
34
|
+
"eslint-config-prettier": "^8.4.0",
|
|
35
|
+
"eslint-plugin-adonis": "^2.1.0",
|
|
36
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
37
|
+
"github-label-sync": "^2.0.2",
|
|
38
|
+
"husky": "^7.0.4",
|
|
39
|
+
"japa": "^4.0.0",
|
|
40
|
+
"mrm": "^3.0.10",
|
|
41
|
+
"np": "^7.6.0",
|
|
42
|
+
"prettier": "^2.5.1",
|
|
43
|
+
"supertest": "^6.2.2",
|
|
44
|
+
"typescript": "^4.5.5"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
45
47
|
"mrm": "mrm --preset=@adonisjs/mrm-preset",
|
|
46
48
|
"pretest": "npm run lint",
|
|
47
|
-
"test": "node
|
|
49
|
+
"test": "node .bin/test.js",
|
|
48
50
|
"clean": "del build",
|
|
49
51
|
"compile": "npm run lint && npm run clean && tsc",
|
|
50
52
|
"copyfiles": "copyfiles \"templates/**/*.txt\" \"instructions.md\" build",
|
|
51
53
|
"build": "npm run compile && npm run copyfiles",
|
|
52
54
|
"commit": "git-cz",
|
|
53
|
-
"release": "np",
|
|
55
|
+
"release": "np --message=\"chore(release): %s\"",
|
|
54
56
|
"version": "npm run build",
|
|
55
57
|
"prepublishOnly": "npm run build",
|
|
56
58
|
"lint": "eslint . --ext=.ts",
|
|
@@ -111,5 +113,48 @@
|
|
|
111
113
|
"np": {
|
|
112
114
|
"contents": ".",
|
|
113
115
|
"anyBranch": false
|
|
116
|
+
},
|
|
117
|
+
"mrmConfig": {
|
|
118
|
+
"core": true,
|
|
119
|
+
"license": "MIT",
|
|
120
|
+
"services": [
|
|
121
|
+
"github-actions"
|
|
122
|
+
],
|
|
123
|
+
"minNodeVersion": "14.15.4",
|
|
124
|
+
"probotApps": [
|
|
125
|
+
"stale",
|
|
126
|
+
"lock"
|
|
127
|
+
],
|
|
128
|
+
"runGhActionsOnWindows": false
|
|
129
|
+
},
|
|
130
|
+
"eslintConfig": {
|
|
131
|
+
"extends": [
|
|
132
|
+
"plugin:adonis/typescriptPackage",
|
|
133
|
+
"prettier"
|
|
134
|
+
],
|
|
135
|
+
"plugins": [
|
|
136
|
+
"prettier"
|
|
137
|
+
],
|
|
138
|
+
"rules": {
|
|
139
|
+
"prettier/prettier": [
|
|
140
|
+
"error",
|
|
141
|
+
{
|
|
142
|
+
"endOfLine": "auto"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"eslintIgnore": [
|
|
148
|
+
"build"
|
|
149
|
+
],
|
|
150
|
+
"prettier": {
|
|
151
|
+
"trailingComma": "es5",
|
|
152
|
+
"semi": false,
|
|
153
|
+
"singleQuote": true,
|
|
154
|
+
"useTabs": false,
|
|
155
|
+
"quoteProps": "consistent",
|
|
156
|
+
"bracketSpacing": true,
|
|
157
|
+
"arrowParens": "always",
|
|
158
|
+
"printWidth": 100
|
|
114
159
|
}
|
|
115
160
|
}
|