@midwayjs/consul 3.0.0-alpha.9 → 3.0.0-beta.4
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 +35 -0
- package/dist/configuration.d.ts +1 -1
- package/dist/configuration.js +17 -13
- package/dist/controller/consul.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interface.d.ts +8 -2
- package/dist/service/balancer.js +4 -4
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
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.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @midwayjs/consul
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @midwayjs/consul
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @midwayjs/consul
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package @midwayjs/consul
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILifeCycle, IMidwayApplication, IMidwayContainer } from '@midwayjs/core';
|
|
2
2
|
import { IConsulProviderInfoOptions, IConsulRegisterInfoOptions } from './interface';
|
|
3
3
|
import { ConsulProvider } from './lib/provider';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class ConsulConfiguration implements ILifeCycle {
|
|
5
5
|
/**
|
|
6
6
|
* 有关 consul server 的配置
|
|
7
7
|
*/
|
package/dist/configuration.js
CHANGED
|
@@ -9,11 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.ConsulConfiguration = void 0;
|
|
13
13
|
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
-
const path_1 = require("path");
|
|
15
14
|
const provider_1 = require("./lib/provider");
|
|
16
|
-
|
|
15
|
+
const DefaultConfig = require("./config/config.default");
|
|
16
|
+
let ConsulConfiguration = class ConsulConfiguration {
|
|
17
17
|
get consulProvider() {
|
|
18
18
|
const symbol = Symbol('consulProvider');
|
|
19
19
|
this[symbol] =
|
|
@@ -54,7 +54,7 @@ let AutoConfiguration = class AutoConfiguration {
|
|
|
54
54
|
});
|
|
55
55
|
Object.assign(this.consulRegisterConfig, config);
|
|
56
56
|
// 把原始的 consul 对象注入到容器
|
|
57
|
-
container.registerObject('consul', this.consulProvider.getConsul());
|
|
57
|
+
container.registerObject('consul:consul', this.consulProvider.getConsul());
|
|
58
58
|
await this.consulProvider.registerService(this.consulRegisterConfig);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -70,18 +70,22 @@ let AutoConfiguration = class AutoConfiguration {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
__decorate([
|
|
73
|
-
decorator_1.Config('consul.provider'),
|
|
73
|
+
(0, decorator_1.Config)('consul.provider'),
|
|
74
74
|
__metadata("design:type", Object)
|
|
75
|
-
],
|
|
75
|
+
], ConsulConfiguration.prototype, "consulProviderConfig", void 0);
|
|
76
76
|
__decorate([
|
|
77
|
-
decorator_1.Config('consul.service'),
|
|
77
|
+
(0, decorator_1.Config)('consul.service'),
|
|
78
78
|
__metadata("design:type", Object)
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
decorator_1.Configuration({
|
|
79
|
+
], ConsulConfiguration.prototype, "consulRegisterConfig", void 0);
|
|
80
|
+
ConsulConfiguration = __decorate([
|
|
81
|
+
(0, decorator_1.Configuration)({
|
|
82
82
|
namespace: 'consul',
|
|
83
|
-
importConfigs: [
|
|
83
|
+
importConfigs: [
|
|
84
|
+
{
|
|
85
|
+
default: DefaultConfig,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
84
88
|
})
|
|
85
|
-
],
|
|
86
|
-
exports.
|
|
89
|
+
], ConsulConfiguration);
|
|
90
|
+
exports.ConsulConfiguration = ConsulConfiguration;
|
|
87
91
|
//# sourceMappingURL=configuration.js.map
|
|
@@ -19,14 +19,14 @@ let ConsulController = class ConsulController {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
__decorate([
|
|
22
|
-
decorator_1.Get('/health/self/check'),
|
|
22
|
+
(0, decorator_1.Get)('/health/self/check'),
|
|
23
23
|
__metadata("design:type", Function),
|
|
24
24
|
__metadata("design:paramtypes", []),
|
|
25
25
|
__metadata("design:returntype", Promise)
|
|
26
26
|
], ConsulController.prototype, "healthCheck", null);
|
|
27
27
|
ConsulController = __decorate([
|
|
28
|
-
decorator_1.Provide(),
|
|
29
|
-
decorator_1.Controller('/consul')
|
|
28
|
+
(0, decorator_1.Provide)(),
|
|
29
|
+
(0, decorator_1.Controller)('/consul')
|
|
30
30
|
], ConsulController);
|
|
31
31
|
exports.ConsulController = ConsulController;
|
|
32
32
|
//# sourceMappingURL=consul.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.Configuration = void 0;
|
|
14
14
|
var configuration_1 = require("./configuration");
|
|
15
|
-
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.
|
|
15
|
+
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.ConsulConfiguration; } });
|
|
16
16
|
__exportStar(require("./controller/consul"), exports);
|
|
17
17
|
__exportStar(require("./service/balancer"), exports);
|
|
18
18
|
__exportStar(require("./interface"), exports);
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Consul from
|
|
2
|
-
import { ConsulOptions } from
|
|
1
|
+
import * as Consul from 'consul';
|
|
2
|
+
import { ConsulOptions } from 'consul';
|
|
3
3
|
import RegisterOptions = Consul.Agent.Service.RegisterOptions;
|
|
4
4
|
export interface IServiceBalancer {
|
|
5
5
|
/**
|
|
@@ -65,4 +65,10 @@ export interface IConsulRegisterInfoOptions extends RegisterOptions {
|
|
|
65
65
|
status?: string;
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
+
declare module '@midwayjs/core/dist/interface' {
|
|
69
|
+
interface MidwayConfig {
|
|
70
|
+
consul?: IConsulProviderInfoOptions;
|
|
71
|
+
service?: IConsulRegisterInfoOptions;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
68
74
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/service/balancer.js
CHANGED
|
@@ -22,18 +22,18 @@ let BalancerService = class BalancerService {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
__decorate([
|
|
25
|
-
decorator_1.Inject(),
|
|
25
|
+
(0, decorator_1.Inject)('consul:consul'),
|
|
26
26
|
__metadata("design:type", Object)
|
|
27
27
|
], BalancerService.prototype, "consul", void 0);
|
|
28
28
|
__decorate([
|
|
29
|
-
decorator_1.Init(),
|
|
29
|
+
(0, decorator_1.Init)(),
|
|
30
30
|
__metadata("design:type", Function),
|
|
31
31
|
__metadata("design:paramtypes", []),
|
|
32
32
|
__metadata("design:returntype", void 0)
|
|
33
33
|
], BalancerService.prototype, "init", null);
|
|
34
34
|
BalancerService = __decorate([
|
|
35
|
-
decorator_1.Provide(),
|
|
36
|
-
decorator_1.Scope(decorator_1.ScopeEnum.Singleton)
|
|
35
|
+
(0, decorator_1.Provide)(),
|
|
36
|
+
(0, decorator_1.Scope)(decorator_1.ScopeEnum.Singleton)
|
|
37
37
|
], BalancerService);
|
|
38
38
|
exports.BalancerService = BalancerService;
|
|
39
39
|
//# sourceMappingURL=balancer.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/consul",
|
|
3
3
|
"description": "midway consul",
|
|
4
|
-
"version": "3.0.0-
|
|
4
|
+
"version": "3.0.0-beta.4",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"dist/**/*.d.ts"
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@midwayjs/core": "^3.0.0-
|
|
13
|
-
"@midwayjs/decorator": "^3.0.0-
|
|
14
|
-
"@midwayjs/koa": "^3.0.0-
|
|
15
|
-
"@midwayjs/mock": "^3.0.0-
|
|
12
|
+
"@midwayjs/core": "^3.0.0-beta.4",
|
|
13
|
+
"@midwayjs/decorator": "^3.0.0-beta.4",
|
|
14
|
+
"@midwayjs/koa": "^3.0.0-beta.4",
|
|
15
|
+
"@midwayjs/mock": "^3.0.0-beta.4",
|
|
16
16
|
"@types/consul": "^0.23.34",
|
|
17
17
|
"@types/sinon": "^10.0.2",
|
|
18
18
|
"nock": "^13.0.11"
|
|
@@ -32,9 +32,12 @@
|
|
|
32
32
|
"ci": "npm run test",
|
|
33
33
|
"lint": "mwts check"
|
|
34
34
|
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=12"
|
|
37
|
+
},
|
|
35
38
|
"repository": {
|
|
36
39
|
"type": "git",
|
|
37
40
|
"url": "https://github.com/midwayjs/midway.git"
|
|
38
41
|
},
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "02e2144e302f807770b512b0d89da3145b1cbf2e"
|
|
40
43
|
}
|