@midwayjs/session 3.19.0 → 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,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.session = void 0;
4
4
  exports.session = {
5
5
  enable: true,
6
- maxAge: 24 * 3600 * 1000,
6
+ maxAge: 24 * 3600 * 1000, // ms
7
7
  key: 'MW_SESS',
8
8
  httpOnly: true,
9
9
  // sameSite: null,
@@ -34,6 +34,7 @@ let SessionConfiguration = class SessionConfiguration {
34
34
  }
35
35
  }
36
36
  };
37
+ exports.SessionConfiguration = SessionConfiguration;
37
38
  __decorate([
38
39
  (0, core_1.Inject)(),
39
40
  __metadata("design:type", core_1.MidwayApplicationManager)
@@ -46,7 +47,7 @@ __decorate([
46
47
  (0, core_1.Config)('session'),
47
48
  __metadata("design:type", Object)
48
49
  ], SessionConfiguration.prototype, "sessionConfig", void 0);
49
- SessionConfiguration = __decorate([
50
+ exports.SessionConfiguration = SessionConfiguration = __decorate([
50
51
  (0, core_1.Configuration)({
51
52
  namespace: 'session',
52
53
  importConfigs: [
@@ -56,5 +57,4 @@ SessionConfiguration = __decorate([
56
57
  ],
57
58
  })
58
59
  ], SessionConfiguration);
59
- exports.SessionConfiguration = SessionConfiguration;
60
60
  //# sourceMappingURL=configuration.js.map
package/dist/lib/store.js CHANGED
@@ -16,9 +16,9 @@ let SessionStoreManager = class SessionStoreManager {
16
16
  return this.sessionStore;
17
17
  }
18
18
  };
19
- SessionStoreManager = __decorate([
19
+ exports.SessionStoreManager = SessionStoreManager;
20
+ exports.SessionStoreManager = SessionStoreManager = __decorate([
20
21
  (0, core_1.Provide)(),
21
22
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
22
23
  ], SessionStoreManager);
23
- exports.SessionStoreManager = SessionStoreManager;
24
24
  //# sourceMappingURL=store.js.map
@@ -52,21 +52,21 @@ function formatOpts(opts) {
52
52
  }
53
53
  const store = opts.store;
54
54
  if (store) {
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');
55
+ assert.ok(core_1.Types.isFunction(store.get), 'store.get must be function');
56
+ assert.ok(core_1.Types.isFunction(store.set), 'store.set must be function');
57
+ assert.ok(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(core_1.Types.isFunction(externalKey.get), 'externalKey.get must be function');
62
- assert(core_1.Types.isFunction(externalKey.set), 'externalKey.set must be function');
61
+ assert.ok(core_1.Types.isFunction(externalKey.get), 'externalKey.get must be function');
62
+ assert.ok(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(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');
66
+ assert.ok(core_1.Types.isClass(ContextStore), 'ContextStore must be a class');
67
+ assert.ok(core_1.Types.isFunction(ContextStore.prototype.get), 'ContextStore.prototype.get must be function');
68
+ assert.ok(core_1.Types.isFunction(ContextStore.prototype.set), 'ContextStore.prototype.set must be function');
69
+ assert.ok(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) {
@@ -147,6 +147,7 @@ let SessionMiddleware = class SessionMiddleware {
147
147
  return 'session';
148
148
  }
149
149
  };
150
+ exports.SessionMiddleware = SessionMiddleware;
150
151
  __decorate([
151
152
  (0, core_1.Config)('session'),
152
153
  __metadata("design:type", Object)
@@ -159,8 +160,7 @@ __decorate([
159
160
  (0, core_1.Inject)(),
160
161
  __metadata("design:type", store_1.SessionStoreManager)
161
162
  ], SessionMiddleware.prototype, "sessionStoreManager", void 0);
162
- SessionMiddleware = __decorate([
163
+ exports.SessionMiddleware = SessionMiddleware = __decorate([
163
164
  (0, core_1.Middleware)()
164
165
  ], SessionMiddleware);
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.19.0",
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": "^3.19.0",
14
- "@midwayjs/mock": "^3.19.0"
13
+ "@midwayjs/core": "^4.0.0-alpha.1",
14
+ "@midwayjs/mock": "^4.0.0-alpha.1"
15
15
  },
16
16
  "dependencies": {
17
17
  "@midwayjs/cookies": "^1.0.2"
@@ -27,8 +27,8 @@
27
27
  "license": "MIT",
28
28
  "scripts": {
29
29
  "build": "tsc",
30
- "test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
31
- "cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
30
+ "test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
31
+ "cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
32
32
  "ci": "npm run test",
33
33
  "lint": "mwts check"
34
34
  },
@@ -39,5 +39,5 @@
39
39
  "type": "git",
40
40
  "url": "https://github.com/midwayjs/midway.git"
41
41
  },
42
- "gitHead": "437e92d9375b0e375f83aa363f3e6a60187c7109"
42
+ "gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
43
43
  }