@minimaltech/node-infra 0.5.9-6 → 0.5.9-7

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.
@@ -1,5 +1,6 @@
1
1
  export * from './../../boot';
2
2
  export * from './../../core';
3
+ export * from './../../health-check';
3
4
  export * from './../../http-server';
4
5
  export * from './../../metadata';
5
6
  export * from './../../security';
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./../../boot"), exports);
18
18
  __exportStar(require("./../../core"), exports);
19
+ __exportStar(require("./../../health-check"), exports);
19
20
  __exportStar(require("./../../http-server"), exports);
20
21
  __exportStar(require("./../../metadata"), exports);
21
22
  __exportStar(require("./../../security"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/base/loopback/@lb/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,sDAAoC;AACpC,mDAAiC;AACjC,mDAAiC;AACjC,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/base/loopback/@lb/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,uDAAqC;AACrC,sDAAoC;AACpC,mDAAiC;AACjC,mDAAiC;AACjC,wDAAsC"}
@@ -0,0 +1,2 @@
1
+ export * from '@loopback/health';
2
+ export type * from '@loopback/health';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@loopback/health"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/loopback/health-check/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
@@ -0,0 +1,6 @@
1
+ import { BaseApplication, BaseComponent } from '@minimaltech/node-infra';
2
+ export declare class HealthcheckComponent extends BaseComponent {
3
+ protected application: BaseApplication;
4
+ constructor(application: BaseApplication);
5
+ binding(): void;
6
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var HealthcheckComponent_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.HealthcheckComponent = void 0;
17
+ const health_1 = require("@loopback/health");
18
+ const node_infra_1 = require("@minimaltech/node-infra");
19
+ const lb_core_1 = require("@minimaltech/node-infra/lb-core");
20
+ const lb_repo_1 = require("@minimaltech/node-infra/lb-repo");
21
+ let HealthcheckComponent = HealthcheckComponent_1 = class HealthcheckComponent extends node_infra_1.BaseComponent {
22
+ constructor(application) {
23
+ super({ scope: HealthcheckComponent_1.name });
24
+ this.application = application;
25
+ this.binding();
26
+ }
27
+ binding() {
28
+ const t = performance.now();
29
+ this.logger.info('[binding] START | Binding application/datasource healthcheck...!');
30
+ this.application.configure(health_1.HealthBindings.COMPONENT).to({
31
+ healthPath: '/health',
32
+ livePath: '/live',
33
+ readyPath: '/ready',
34
+ openApiSpec: true,
35
+ });
36
+ this.application.component(health_1.HealthComponent);
37
+ const dsBindings = this.application.findByTag(lb_repo_1.RepositoryTags.DATASOURCE);
38
+ for (const dsBinding of dsBindings) {
39
+ const bindingKey = dsBinding.key;
40
+ const datasource = dsBinding.getValue(this.application);
41
+ this.application
42
+ .bind(`health.${bindingKey}`)
43
+ .to(() => {
44
+ return datasource.ping();
45
+ })
46
+ .tag(health_1.HealthTags.READY_CHECK);
47
+ }
48
+ this.logger.info('[binding] DONE | Binding application/datasource healthcheck | Took: %sms', performance.now() - t);
49
+ }
50
+ };
51
+ exports.HealthcheckComponent = HealthcheckComponent;
52
+ exports.HealthcheckComponent = HealthcheckComponent = HealthcheckComponent_1 = __decorate([
53
+ __param(0, (0, lb_core_1.inject)(lb_core_1.CoreBindings.APPLICATION_INSTANCE)),
54
+ __metadata("design:paramtypes", [node_infra_1.BaseApplication])
55
+ ], HealthcheckComponent);
56
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/health-check/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA+E;AAC/E,wDAAyE;AACzE,6DAAuE;AACvE,6DAA6E;AAE7E,IAAa,oBAAoB,4BAAjC,MAAa,oBAAqB,SAAQ,0BAAa;IACrD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BAAM,EAAC,sBAAY,CAAC,oBAAoB,CAAC,CAAA;qCACnB,4BAAe;GAH7B,oBAAoB,CAuChC"}
@@ -0,0 +1 @@
1
+ export * from './component';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./component"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/health-check/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
@@ -1,7 +1,8 @@
1
1
  export * from './authenticate';
2
2
  export * from './authorize';
3
3
  export * from './crash-report';
4
+ export * from './grpc';
5
+ export * from './health-check';
4
6
  export * from './migration';
5
7
  export * from './socket-io';
6
8
  export * from './static-asset';
7
- export * from './grpc';
@@ -17,8 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./authenticate"), exports);
18
18
  __exportStar(require("./authorize"), exports);
19
19
  __exportStar(require("./crash-report"), exports);
20
+ __exportStar(require("./grpc"), exports);
21
+ __exportStar(require("./health-check"), exports);
20
22
  __exportStar(require("./migration"), exports);
21
23
  __exportStar(require("./socket-io"), exports);
22
24
  __exportStar(require("./static-asset"), exports);
23
- __exportStar(require("./grpc"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,iDAA+B;AAC/B,8CAA4B;AAC5B,8CAA4B;AAC5B,iDAA+B;AAC/B,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,iDAA+B;AAC/B,yCAAuB;AACvB,iDAA+B;AAC/B,8CAA4B;AAC5B,8CAA4B;AAC5B,iDAA+B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minimaltech/node-infra",
3
- "version": "0.5.9-6",
3
+ "version": "0.5.9-7",
4
4
  "description": "Minimal Technology - NodeJS Infrastructure - Loopback 4 Framework",
5
5
  "keywords": [
6
6
  "web",
@@ -97,6 +97,7 @@
97
97
  "@loopback/boot": "^8.0.5",
98
98
  "@loopback/core": "^7.0.4",
99
99
  "@loopback/filter": "^6.0.4",
100
+ "@loopback/health": "^0.15.5",
100
101
  "@loopback/http-server": "^7.0.4",
101
102
  "@loopback/metadata": "^8.0.4",
102
103
  "@loopback/repository": "^8.0.4",