@midwayjs/session 3.5.3 → 3.6.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/dist/configuration.js +5 -6
- package/dist/lib/store.js +3 -3
- package/dist/middleware/session.js +16 -16
- package/package.json +4 -5
package/dist/configuration.js
CHANGED
|
@@ -10,10 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SessionConfiguration = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const DefaultConfig = require("./config/config.default");
|
|
15
15
|
const session_1 = require("./middleware/session");
|
|
16
|
-
const core_1 = require("@midwayjs/core");
|
|
17
16
|
let SessionConfiguration = class SessionConfiguration {
|
|
18
17
|
async onReady() {
|
|
19
18
|
if (this.sessionConfig.enable) {
|
|
@@ -36,19 +35,19 @@ let SessionConfiguration = class SessionConfiguration {
|
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
__decorate([
|
|
39
|
-
(0,
|
|
38
|
+
(0, core_1.Inject)(),
|
|
40
39
|
__metadata("design:type", core_1.MidwayApplicationManager)
|
|
41
40
|
], SessionConfiguration.prototype, "applicationManager", void 0);
|
|
42
41
|
__decorate([
|
|
43
|
-
(0,
|
|
42
|
+
(0, core_1.Logger)('coreLogger'),
|
|
44
43
|
__metadata("design:type", Object)
|
|
45
44
|
], SessionConfiguration.prototype, "logger", void 0);
|
|
46
45
|
__decorate([
|
|
47
|
-
(0,
|
|
46
|
+
(0, core_1.Config)('session'),
|
|
48
47
|
__metadata("design:type", Object)
|
|
49
48
|
], SessionConfiguration.prototype, "sessionConfig", void 0);
|
|
50
49
|
SessionConfiguration = __decorate([
|
|
51
|
-
(0,
|
|
50
|
+
(0, core_1.Configuration)({
|
|
52
51
|
namespace: 'session',
|
|
53
52
|
importConfigs: [
|
|
54
53
|
{
|
package/dist/lib/store.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.SessionStoreManager = void 0;
|
|
10
|
-
const
|
|
10
|
+
const core_1 = require("@midwayjs/core");
|
|
11
11
|
let SessionStoreManager = class SessionStoreManager {
|
|
12
12
|
setSessionStore(sessionStore) {
|
|
13
13
|
this.sessionStore = sessionStore;
|
|
@@ -17,8 +17,8 @@ let SessionStoreManager = class SessionStoreManager {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
SessionStoreManager = __decorate([
|
|
20
|
-
(0,
|
|
21
|
-
(0,
|
|
20
|
+
(0, core_1.Provide)(),
|
|
21
|
+
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
22
22
|
], SessionStoreManager);
|
|
23
23
|
exports.SessionStoreManager = SessionStoreManager;
|
|
24
24
|
//# sourceMappingURL=store.js.map
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SessionMiddleware = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const store_1 = require("../lib/store");
|
|
15
15
|
const util_1 = require("../lib/util");
|
|
16
16
|
const assert = require("assert");
|
|
@@ -52,28 +52,28 @@ function formatOpts(opts) {
|
|
|
52
52
|
}
|
|
53
53
|
const store = opts.store;
|
|
54
54
|
if (store) {
|
|
55
|
-
assert(
|
|
56
|
-
assert(
|
|
57
|
-
assert(
|
|
55
|
+
assert(core_1.Types.isFunction(store.get), 'store.get must be function');
|
|
56
|
+
assert(core_1.Types.isFunction(store.set), 'store.set must be function');
|
|
57
|
+
assert(core_1.Types.isFunction(store.destroy), 'store.destroy must be function');
|
|
58
58
|
}
|
|
59
59
|
const externalKey = opts.externalKey;
|
|
60
60
|
if (externalKey) {
|
|
61
|
-
assert(
|
|
62
|
-
assert(
|
|
61
|
+
assert(core_1.Types.isFunction(externalKey.get), 'externalKey.get must be function');
|
|
62
|
+
assert(core_1.Types.isFunction(externalKey.set), 'externalKey.set must be function');
|
|
63
63
|
}
|
|
64
64
|
const ContextStore = opts.ContextStore;
|
|
65
65
|
if (ContextStore) {
|
|
66
|
-
assert(
|
|
67
|
-
assert(
|
|
68
|
-
assert(
|
|
69
|
-
assert(
|
|
66
|
+
assert(core_1.Types.isClass(ContextStore), 'ContextStore must be a class');
|
|
67
|
+
assert(core_1.Types.isFunction(ContextStore.prototype.get), 'ContextStore.prototype.get must be function');
|
|
68
|
+
assert(core_1.Types.isFunction(ContextStore.prototype.set), 'ContextStore.prototype.set must be function');
|
|
69
|
+
assert(core_1.Types.isFunction(ContextStore.prototype.destroy), 'ContextStore.prototype.destroy must be function');
|
|
70
70
|
}
|
|
71
71
|
if (!opts.genid) {
|
|
72
72
|
if (opts.prefix) {
|
|
73
|
-
opts.genid = () => `${opts.prefix}${
|
|
73
|
+
opts.genid = () => `${opts.prefix}${core_1.Utils.randomUUID()}`;
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
opts.genid =
|
|
76
|
+
opts.genid = core_1.Utils.randomUUID;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
return opts;
|
|
@@ -148,19 +148,19 @@ let SessionMiddleware = class SessionMiddleware {
|
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
__decorate([
|
|
151
|
-
(0,
|
|
151
|
+
(0, core_1.Config)('session'),
|
|
152
152
|
__metadata("design:type", Object)
|
|
153
153
|
], SessionMiddleware.prototype, "sessionConfig", void 0);
|
|
154
154
|
__decorate([
|
|
155
|
-
(0,
|
|
155
|
+
(0, core_1.Logger)(),
|
|
156
156
|
__metadata("design:type", Object)
|
|
157
157
|
], SessionMiddleware.prototype, "logger", void 0);
|
|
158
158
|
__decorate([
|
|
159
|
-
(0,
|
|
159
|
+
(0, core_1.Inject)(),
|
|
160
160
|
__metadata("design:type", store_1.SessionStoreManager)
|
|
161
161
|
], SessionMiddleware.prototype, "sessionStoreManager", void 0);
|
|
162
162
|
SessionMiddleware = __decorate([
|
|
163
|
-
(0,
|
|
163
|
+
(0, core_1.Middleware)()
|
|
164
164
|
], SessionMiddleware);
|
|
165
165
|
exports.SessionMiddleware = SessionMiddleware;
|
|
166
166
|
//# sourceMappingURL=session.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/session",
|
|
3
3
|
"description": "midway session component for koa and faas",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.0",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.
|
|
14
|
-
"@midwayjs/
|
|
15
|
-
"@midwayjs/mock": "^3.5.3"
|
|
13
|
+
"@midwayjs/core": "^3.6.0",
|
|
14
|
+
"@midwayjs/mock": "^3.6.0"
|
|
16
15
|
},
|
|
17
16
|
"dependencies": {
|
|
18
17
|
"@midwayjs/cookies": "^1.0.2"
|
|
@@ -40,5 +39,5 @@
|
|
|
40
39
|
"type": "git",
|
|
41
40
|
"url": "https://github.com/midwayjs/midway.git"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "22643b0e8519766bb7c68b975930199fc136336e"
|
|
44
43
|
}
|