@midwayjs/redis 3.0.0-beta.1 → 3.0.0-beta.13

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/CHANGELOG.md CHANGED
@@ -3,6 +3,108 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-beta.13](https://github.com/midwayjs/midway/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @midwayjs/redis
9
+
10
+
11
+
12
+
13
+
14
+ # [3.0.0-beta.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
15
+
16
+ **Note:** Version bump only for package @midwayjs/redis
17
+
18
+
19
+
20
+
21
+
22
+ # [3.0.0-beta.11](https://github.com/midwayjs/midway/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-12-21)
23
+
24
+ **Note:** Version bump only for package @midwayjs/redis
25
+
26
+
27
+
28
+
29
+
30
+ # [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
31
+
32
+ **Note:** Version bump only for package @midwayjs/redis
33
+
34
+
35
+
36
+
37
+
38
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
39
+
40
+ **Note:** Version bump only for package @midwayjs/redis
41
+
42
+
43
+
44
+
45
+
46
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * express routing middleware takes effect at the controller level ([#1364](https://github.com/midwayjs/midway/issues/1364)) ([b9272e0](https://github.com/midwayjs/midway/commit/b9272e0971003443304b0c53815be31a0061b4bd))
52
+
53
+
54
+
55
+
56
+
57
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
58
+
59
+ **Note:** Version bump only for package @midwayjs/redis
60
+
61
+
62
+
63
+
64
+
65
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
66
+
67
+ **Note:** Version bump only for package @midwayjs/redis
68
+
69
+
70
+
71
+
72
+
73
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
74
+
75
+ **Note:** Version bump only for package @midwayjs/redis
76
+
77
+
78
+
79
+
80
+
81
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
82
+
83
+ **Note:** Version bump only for package @midwayjs/redis
84
+
85
+
86
+
87
+
88
+
89
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
90
+
91
+
92
+ ### Features
93
+
94
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
95
+
96
+
97
+
98
+
99
+
100
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
101
+
102
+ **Note:** Version bump only for package @midwayjs/redis
103
+
104
+
105
+
106
+
107
+
6
108
  # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
7
109
 
8
110
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  this is a sub package for midway.
7
7
 
8
- Document: [https://midwayjs.org/midway](https://midwayjs.org/midway)
8
+ Document: [https://midwayjs.org](https://midwayjs.org)
9
9
 
10
10
  ## License
11
11
 
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.RedisConfiguration = void 0;
10
10
  const decorator_1 = require("@midwayjs/decorator");
11
- const path_1 = require("path");
12
11
  const manager_1 = require("./manager");
13
12
  let RedisConfiguration = class RedisConfiguration {
14
13
  async onReady(container) {
@@ -22,7 +21,13 @@ let RedisConfiguration = class RedisConfiguration {
22
21
  RedisConfiguration = __decorate([
23
22
  (0, decorator_1.Configuration)({
24
23
  namespace: 'redis',
25
- importConfigs: [(0, path_1.join)(__dirname, './config.default')],
24
+ importConfigs: [
25
+ {
26
+ default: {
27
+ redis: {},
28
+ },
29
+ },
30
+ ],
26
31
  })
27
32
  ], RedisConfiguration);
28
33
  exports.RedisConfiguration = RedisConfiguration;
package/dist/manager.js CHANGED
@@ -25,8 +25,7 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
25
25
  config.nodes.forEach(client => {
26
26
  assert(client.host &&
27
27
  client.port &&
28
- client.password !== undefined &&
29
- client.db !== undefined, `[@midwayjs/redis] 'host: ${client.host}', 'port: ${client.port}', 'password: ${client.password}', 'db: ${client.db}' are required on config`);
28
+ `[@midwayjs/redis] 'host: ${client.host}', 'port: ${client.port}' are required on config`);
30
29
  });
31
30
  this.logger.info('[@midwayjs/redis] cluster connecting');
32
31
  client = new Redis.Cluster(config.nodes, config);
@@ -36,16 +35,12 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
36
35
  config.sentinels.forEach(sentinel => {
37
36
  assert(sentinel.host && sentinel.port, `[@midwayjs/redis] 'host: ${sentinel.host}', 'port: ${sentinel.port}' are required on config`);
38
37
  });
39
- assert(config.name && config.password !== undefined && config.db !== undefined, `[@midwayjs/redis] 'name of master: ${config.name}', 'password: ${config.password}', 'db: ${config.db}' are required on config`);
40
38
  this.logger.info('[@midwayjs/redis] sentinel connecting start');
41
39
  client = new Redis(config);
42
40
  }
43
41
  else {
44
- assert(config.host &&
45
- config.port &&
46
- config.password !== undefined &&
47
- config.db !== undefined, `[@midwayjs/redis] 'host: ${config.host}', 'port: ${config.port}', 'password: ${config.password}', 'db: ${config.db}' are required on config`);
48
- this.logger.info('[@midwayjs/redis] server connecting redis://:***@%s:%s/%s', config.host, config.port, config.db);
42
+ assert(config.host && config.port, `[@midwayjs/redis] 'host: ${config.host}', 'port: ${config.port}' are required on config`);
43
+ this.logger.info('[@midwayjs/redis] server connecting redis://:***@%s:%s/%s', config.host, config.port);
49
44
  client = new Redis(config);
50
45
  }
51
46
  client.on('connect', () => {
package/index.d.ts ADDED
@@ -0,0 +1,62 @@
1
+ import { ClusterNode, ClusterOptions } from 'ioredis';
2
+
3
+ export * from './dist/index';
4
+
5
+ import * as Redis from 'ioredis';
6
+
7
+ // Single Redis
8
+ // client: {
9
+ // host: 'host',
10
+ // port: 'port',
11
+ // family: 'user',
12
+ // password: 'password',
13
+ // db: 'db',
14
+ // },
15
+
16
+ // Cluster Redis
17
+ // client: {
18
+ // cluster: true,
19
+ // nodes: [{
20
+ // host: 'host',
21
+ // port: 'port',
22
+ // family: 'user',
23
+ // password: 'password',
24
+ // db: 'db',
25
+ // },{
26
+ // host: 'host',
27
+ // port: 'port',
28
+ // family: 'user',
29
+ // password: 'password',
30
+ // db: 'db',
31
+ // },
32
+ // ]},
33
+
34
+ // Multi Redis
35
+ // clients: {
36
+ // instance1: {
37
+ // host: 'host',
38
+ // port: 'port',
39
+ // family: 'user',
40
+ // password: 'password',
41
+ // db: 'db',
42
+ // },
43
+ // instance2: {
44
+ // host: 'host',
45
+ // port: 'port',
46
+ // family: 'user',
47
+ // password: 'password',
48
+ // db: 'db',
49
+ // },
50
+ // },
51
+
52
+ declare module '@midwayjs/core/dist/interface' {
53
+ interface MidwayConfig {
54
+ redis?: ServiceFactoryConfigOption<
55
+ | Redis.RedisOptions
56
+ | ({
57
+ cluster?: boolean;
58
+ nodes?: ClusterNode[];
59
+ } & ClusterOptions)
60
+ >;
61
+ }
62
+ }
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@midwayjs/redis",
3
3
  "description": "midway redis component",
4
- "version": "3.0.0-beta.1",
4
+ "version": "3.0.0-beta.13",
5
5
  "main": "dist/index",
6
- "typings": "dist/index.d.ts",
6
+ "typings": "index.d.ts",
7
7
  "files": [
8
8
  "dist/**/*.js",
9
- "dist/**/*.d.ts"
9
+ "dist/**/*.d.ts",
10
+ "index.d.ts"
10
11
  ],
11
12
  "devDependencies": {
12
- "@midwayjs/core": "^3.0.0-beta.1",
13
- "@midwayjs/decorator": "^3.0.0-beta.1",
14
- "@midwayjs/mock": "^3.0.0-beta.1",
13
+ "@midwayjs/core": "^3.0.0-beta.13",
14
+ "@midwayjs/decorator": "^3.0.0-beta.13",
15
+ "@midwayjs/mock": "^3.0.0-beta.13",
15
16
  "@types/ioredis": "^4.27.1"
16
17
  },
17
18
  "dependencies": {
@@ -36,5 +37,5 @@
36
37
  "type": "git",
37
38
  "url": "https://github.com/midwayjs/midway.git"
38
39
  },
39
- "gitHead": "72e4d20c678e65a5440c4e9a6d3b70046daa497c"
40
+ "gitHead": "d3c47770fee9dce33a8d148882173fd7782864ad"
40
41
  }
@@ -1,5 +0,0 @@
1
- export declare const redis: {
2
- default: {};
3
- supportTimeCommand: boolean;
4
- };
5
- //# sourceMappingURL=config.default.d.ts.map
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.redis = void 0;
4
- exports.redis = {
5
- default: {},
6
- // redis client will try to use TIME command to detect client is ready or not
7
- // if your redis server not support TIME command, please set this config to false
8
- // see https://redis.io/commands/time
9
- supportTimeCommand: true,
10
- // Redis: require('ioredis'), // customize ioredis version, only set when you needed
11
- // Single Redis
12
- // client: {
13
- // host: 'host',
14
- // port: 'port',
15
- // family: 'user',
16
- // password: 'password',
17
- // db: 'db',
18
- // },
19
- // Cluster Redis
20
- // client: {
21
- // cluster: true,
22
- // nodes: [{
23
- // host: 'host',
24
- // port: 'port',
25
- // family: 'user',
26
- // password: 'password',
27
- // db: 'db',
28
- // },{
29
- // host: 'host',
30
- // port: 'port',
31
- // family: 'user',
32
- // password: 'password',
33
- // db: 'db',
34
- // },
35
- // ]},
36
- // Multi Redis
37
- // clients: {
38
- // instance1: {
39
- // host: 'host',
40
- // port: 'port',
41
- // family: 'user',
42
- // password: 'password',
43
- // db: 'db',
44
- // },
45
- // instance2: {
46
- // host: 'host',
47
- // port: 'port',
48
- // family: 'user',
49
- // password: 'password',
50
- // db: 'db',
51
- // },
52
- // },
53
- };
54
- //# sourceMappingURL=config.default.js.map