@loopback/health 0.6.2 → 0.7.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.
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
|
+
## [0.7.1](https://github.com/strongloop/loopback-next/compare/@loopback/health@0.7.0...@loopback/health@0.7.1) (2021-04-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/health
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.7.0](https://github.com/strongloop/loopback-next/compare/@loopback/health@0.6.4...@loopback/health@0.7.0) (2021-03-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* update package-lock.json to v2 consistently ([dfc3fbd](https://github.com/strongloop/loopback-next/commit/dfc3fbdae0c9ca9f34c64154a471bef22d5ac6b7))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.6.4](https://github.com/strongloop/loopback-next/compare/@loopback/health@0.6.3...@loopback/health@0.6.4) (2021-02-09)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @loopback/health
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [0.6.3](https://github.com/strongloop/loopback-next/compare/@loopback/health@0.6.2...@loopback/health@0.6.3) (2021-01-21)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @loopback/health
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [0.6.2](https://github.com/strongloop/loopback-next/compare/@loopback/health@0.6.1...@loopback/health@0.6.2) (2020-12-07)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package @loopback/health
|
package/README.md
CHANGED
|
@@ -11,8 +11,6 @@ npm install --save @loopback/health
|
|
|
11
11
|
|
|
12
12
|
## Basic use
|
|
13
13
|
|
|
14
|
-
{% include note.html content="*this.configure()* must be called before *this.component()* to take effect. This is a [known limitation](https://github.com/strongloop/loopback-next/issues/4289#issuecomment-564617263)." %}
|
|
15
|
-
|
|
16
14
|
The component should be loaded in the constructor of your custom Application
|
|
17
15
|
class.
|
|
18
16
|
|
|
@@ -44,6 +42,11 @@ this.configure(HealthBindings.COMPONENT).to({
|
|
|
44
42
|
});
|
|
45
43
|
```
|
|
46
44
|
|
|
45
|
+
{% include note.html content="*this.configure()* must be called before
|
|
46
|
+
*this.component()* to take effect. This is a
|
|
47
|
+
[known limitation](https://github.com/strongloop/loopback-next/issues/4289#issuecomment-564617263)
|
|
48
|
+
." %}
|
|
49
|
+
|
|
47
50
|
http://localhost:3000/health returns health in JSON format, such as:
|
|
48
51
|
|
|
49
52
|
```json
|
|
@@ -15,7 +15,7 @@ function getHealthResponseObject() {
|
|
|
15
15
|
/**
|
|
16
16
|
* OpenAPI definition of health response schema
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const HEALTH_RESPONSE_SCHEMA = {
|
|
19
19
|
type: 'object',
|
|
20
20
|
properties: {
|
|
21
21
|
status: { type: 'string' },
|
|
@@ -40,20 +40,20 @@ function getHealthResponseObject() {
|
|
|
40
40
|
/**
|
|
41
41
|
* OpenAPI definition of health response
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
43
|
+
const HEALTH_RESPONSE = {
|
|
44
44
|
description: 'Health Response',
|
|
45
45
|
content: {
|
|
46
46
|
'application/json': {
|
|
47
|
-
schema:
|
|
47
|
+
schema: HEALTH_RESPONSE_SCHEMA,
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return HEALTH_RESPONSE;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* OpenAPI spec for health endpoints
|
|
55
55
|
*/
|
|
56
|
-
const
|
|
56
|
+
const HEALTH_SPEC = {
|
|
57
57
|
// response object needs to be cloned because the oas-validator throws an
|
|
58
58
|
// error if the same object is referenced twice
|
|
59
59
|
responses: {
|
|
@@ -65,7 +65,7 @@ const healthSpec = {
|
|
|
65
65
|
/**
|
|
66
66
|
* OpenAPI spec to hide endpoints
|
|
67
67
|
*/
|
|
68
|
-
const
|
|
68
|
+
const HIDDEN_SPEC = {
|
|
69
69
|
responses: {},
|
|
70
70
|
'x-visibility': 'undocumented',
|
|
71
71
|
};
|
|
@@ -77,7 +77,7 @@ const hiddenSpec = {
|
|
|
77
77
|
* @param options - Options for health endpoints
|
|
78
78
|
*/
|
|
79
79
|
function createHealthController(options = types_1.DEFAULT_HEALTH_OPTIONS) {
|
|
80
|
-
const spec = options.openApiSpec ?
|
|
80
|
+
const spec = options.openApiSpec ? HEALTH_SPEC : HIDDEN_SPEC;
|
|
81
81
|
/**
|
|
82
82
|
* Controller for health endpoints
|
|
83
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../src/controllers/health.controller.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,gCAAgC;AAChC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,gDAAuE;AACvE,yCAA6E;AAC7E,yCAOwB;AACxB,kCAAuC;AACvC,oCAA+D;AAE/D,SAAS,uBAAuB;IAC9B;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../src/controllers/health.controller.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,gCAAgC;AAChC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,gDAAuE;AACvE,yCAA6E;AAC7E,yCAOwB;AACxB,kCAAuC;AACvC,oCAA+D;AAE/D,SAAS,uBAAuB;IAC9B;;OAEG;IACH,MAAM,sBA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C;AAED;;;;;GAKG;AACH,SAAS,YAAY,CACnB,QAAkB,EAClB,MAAoB,EACpB,cAAyB,GAAG;IAE5B,IAAI,UAAU,GAAG,GAAG,CAAC;IACrB,QAAQ,MAAM,CAAC,MAAM,EAAE;QACrB,KAAK,cAAK,CAAC,QAAQ;YACjB,UAAU,GAAG,GAAG,CAAC;YACjB,MAAM;QACR,KAAK,cAAK,CAAC,EAAE;YACX,UAAU,GAAG,GAAG,CAAC;YACjB,MAAM;QACR,KAAK,cAAK,CAAC,IAAI;YACb,UAAU,GAAG,WAAW,CAAC;YACzB,MAAM;QACR,KAAK,cAAK,CAAC,QAAQ;YACjB,UAAU,GAAG,GAAG,CAAC;YACjB,MAAM;QACR,KAAK,cAAK,CAAC,OAAO;YAChB,UAAU,GAAG,GAAG,CAAC;YACjB,MAAM;KACT;IACD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/health",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "An extension exposes health check related endpoints with LoopBack 4",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^10.16 || 12 || 14"
|
|
8
|
+
"node": "^10.16 || 12 || 14 || 15"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "lb-tsc",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@loopback/core": "^2.
|
|
26
|
-
"@loopback/rest": "^9.
|
|
25
|
+
"@loopback/core": "^2.15.1",
|
|
26
|
+
"@loopback/rest": "^9.2.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@cloudnative/health": "^2.1.2",
|
|
30
|
-
"tslib": "^2.0
|
|
30
|
+
"tslib": "^2.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@loopback/build": "^6.
|
|
34
|
-
"@loopback/core": "^2.
|
|
35
|
-
"@loopback/eslint-config": "^10.
|
|
36
|
-
"@loopback/rest": "^9.
|
|
37
|
-
"@loopback/testlab": "^3.
|
|
38
|
-
"@types/node": "^10.17.
|
|
33
|
+
"@loopback/build": "^6.3.1",
|
|
34
|
+
"@loopback/core": "^2.15.1",
|
|
35
|
+
"@loopback/eslint-config": "^10.1.1",
|
|
36
|
+
"@loopback/rest": "^9.2.1",
|
|
37
|
+
"@loopback/testlab": "^3.3.1",
|
|
38
|
+
"@types/node": "^10.17.56"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"LoopBack",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"url": "https://github.com/strongloop/loopback-next.git",
|
|
54
54
|
"directory": "extensions/health"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "156ca0fcf8fa246ca380ab28b44b3708896be2b6"
|
|
57
57
|
}
|
|
@@ -20,7 +20,7 @@ function getHealthResponseObject() {
|
|
|
20
20
|
/**
|
|
21
21
|
* OpenAPI definition of health response schema
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const HEALTH_RESPONSE_SCHEMA: SchemaObject = {
|
|
24
24
|
type: 'object',
|
|
25
25
|
properties: {
|
|
26
26
|
status: {type: 'string'},
|
|
@@ -46,22 +46,22 @@ function getHealthResponseObject() {
|
|
|
46
46
|
/**
|
|
47
47
|
* OpenAPI definition of health response
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
49
|
+
const HEALTH_RESPONSE: ResponseObject = {
|
|
50
50
|
description: 'Health Response',
|
|
51
51
|
content: {
|
|
52
52
|
'application/json': {
|
|
53
|
-
schema:
|
|
53
|
+
schema: HEALTH_RESPONSE_SCHEMA,
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
return
|
|
58
|
+
return HEALTH_RESPONSE;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* OpenAPI spec for health endpoints
|
|
63
63
|
*/
|
|
64
|
-
const
|
|
64
|
+
const HEALTH_SPEC: OperationObject = {
|
|
65
65
|
// response object needs to be cloned because the oas-validator throws an
|
|
66
66
|
// error if the same object is referenced twice
|
|
67
67
|
responses: {
|
|
@@ -74,7 +74,7 @@ const healthSpec: OperationObject = {
|
|
|
74
74
|
/**
|
|
75
75
|
* OpenAPI spec to hide endpoints
|
|
76
76
|
*/
|
|
77
|
-
const
|
|
77
|
+
const HIDDEN_SPEC: OperationObject = {
|
|
78
78
|
responses: {},
|
|
79
79
|
'x-visibility': 'undocumented',
|
|
80
80
|
};
|
|
@@ -89,7 +89,7 @@ const hiddenSpec: OperationObject = {
|
|
|
89
89
|
export function createHealthController(
|
|
90
90
|
options: HealthOptions = DEFAULT_HEALTH_OPTIONS,
|
|
91
91
|
): Constructor<unknown> {
|
|
92
|
-
const spec = options.openApiSpec ?
|
|
92
|
+
const spec = options.openApiSpec ? HEALTH_SPEC : HIDDEN_SPEC;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Controller for health endpoints
|