@midwayjs/express-session 3.19.2 → 4.0.0-alpha.1
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.
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.session = void 0;
|
|
4
4
|
exports.session = {
|
|
5
5
|
enable: true,
|
|
6
|
-
secret: undefined,
|
|
6
|
+
secret: undefined, // must be set in application
|
|
7
7
|
name: 'MW_SESS',
|
|
8
8
|
resave: true,
|
|
9
9
|
saveUninitialized: true,
|
|
10
10
|
cookie: {
|
|
11
|
-
maxAge: 24 * 3600 * 1000,
|
|
11
|
+
maxAge: 24 * 3600 * 1000, // ms
|
|
12
12
|
httpOnly: true,
|
|
13
13
|
// sameSite: null,
|
|
14
14
|
},
|
package/dist/configuration.js
CHANGED
|
@@ -20,11 +20,12 @@ let SessionConfiguration = class SessionConfiguration {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
exports.SessionConfiguration = SessionConfiguration;
|
|
23
24
|
__decorate([
|
|
24
25
|
(0, core_1.Inject)(),
|
|
25
26
|
__metadata("design:type", core_1.MidwayApplicationManager)
|
|
26
27
|
], SessionConfiguration.prototype, "applicationManager", void 0);
|
|
27
|
-
SessionConfiguration = __decorate([
|
|
28
|
+
exports.SessionConfiguration = SessionConfiguration = __decorate([
|
|
28
29
|
(0, core_1.Configuration)({
|
|
29
30
|
namespace: 'session',
|
|
30
31
|
importConfigs: [
|
|
@@ -34,5 +35,4 @@ SessionConfiguration = __decorate([
|
|
|
34
35
|
],
|
|
35
36
|
})
|
|
36
37
|
], SessionConfiguration);
|
|
37
|
-
exports.SessionConfiguration = SessionConfiguration;
|
|
38
38
|
//# sourceMappingURL=configuration.js.map
|
|
@@ -16,9 +16,10 @@ const cookieSession = require("cookie-session");
|
|
|
16
16
|
const store_1 = require("../store");
|
|
17
17
|
let SessionMiddleware = class SessionMiddleware {
|
|
18
18
|
resolve() {
|
|
19
|
-
var _a, _b;
|
|
20
19
|
if (this.sessionConfig.enable) {
|
|
21
|
-
const secret =
|
|
20
|
+
const secret = this.sessionConfig.secret ??
|
|
21
|
+
this.configService.getConfiguration('express.keys') ??
|
|
22
|
+
this.configService.getConfiguration('keys');
|
|
22
23
|
if (!secret) {
|
|
23
24
|
throw new core_1.MidwayConfigMissingError('config.session.secret');
|
|
24
25
|
}
|
|
@@ -45,6 +46,7 @@ let SessionMiddleware = class SessionMiddleware {
|
|
|
45
46
|
return 'session';
|
|
46
47
|
}
|
|
47
48
|
};
|
|
49
|
+
exports.SessionMiddleware = SessionMiddleware;
|
|
48
50
|
__decorate([
|
|
49
51
|
(0, core_1.Config)('session'),
|
|
50
52
|
__metadata("design:type", Object)
|
|
@@ -61,8 +63,7 @@ __decorate([
|
|
|
61
63
|
(0, core_1.Inject)(),
|
|
62
64
|
__metadata("design:type", core_1.MidwayConfigService)
|
|
63
65
|
], SessionMiddleware.prototype, "configService", void 0);
|
|
64
|
-
SessionMiddleware = __decorate([
|
|
66
|
+
exports.SessionMiddleware = SessionMiddleware = __decorate([
|
|
65
67
|
(0, core_1.Middleware)()
|
|
66
68
|
], SessionMiddleware);
|
|
67
|
-
exports.SessionMiddleware = SessionMiddleware;
|
|
68
69
|
//# sourceMappingURL=session.js.map
|
package/dist/store.js
CHANGED
|
@@ -29,9 +29,9 @@ let SessionStoreManager = class SessionStoreManager {
|
|
|
29
29
|
return this.sessionStore;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
SessionStoreManager =
|
|
32
|
+
exports.SessionStoreManager = SessionStoreManager;
|
|
33
|
+
exports.SessionStoreManager = SessionStoreManager = __decorate([
|
|
33
34
|
(0, core_1.Provide)(),
|
|
34
35
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
35
36
|
], SessionStoreManager);
|
|
36
|
-
exports.SessionStoreManager = SessionStoreManager;
|
|
37
37
|
//# sourceMappingURL=store.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/express-session",
|
|
3
3
|
"description": "midway session component for express",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-alpha.1",
|
|
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": "^
|
|
14
|
-
"@midwayjs/mock": "^
|
|
13
|
+
"@midwayjs/core": "^4.0.0-alpha.1",
|
|
14
|
+
"@midwayjs/mock": "^4.0.0-alpha.1",
|
|
15
15
|
"@types/express-session": "1.18.1",
|
|
16
16
|
"memorystore": "1.6.7"
|
|
17
17
|
},
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc",
|
|
32
|
-
"test": "node
|
|
33
|
-
"cov": "node
|
|
32
|
+
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
|
|
33
|
+
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
|
|
34
34
|
"ci": "npm run test",
|
|
35
35
|
"lint": "mwts check"
|
|
36
36
|
},
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"type": "git",
|
|
42
42
|
"url": "https://github.com/midwayjs/midway.git"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
|
|
45
45
|
}
|