@sellout/service 0.0.280 → 0.0.281
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/.dist/BaseService.d.ts +2 -1
- package/.dist/BaseService.js +16 -4
- package/.dist/BaseService.js.map +1 -1
- package/package.json +4 -4
- package/src/BaseService.ts +5 -3
package/.dist/BaseService.d.ts
CHANGED
package/.dist/BaseService.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const Prometheus = require("prom-client");
|
|
4
13
|
const express = require("express");
|
|
@@ -43,14 +52,14 @@ class BaseService {
|
|
|
43
52
|
res.set('Content-Type', Prometheus.register.contentType);
|
|
44
53
|
res.send(Prometheus.register.metrics());
|
|
45
54
|
});
|
|
46
|
-
app.get('/readiness', (req, res) => {
|
|
47
|
-
if (this.isReady()) {
|
|
55
|
+
app.get('/readiness', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
if (yield this.isReady()) {
|
|
48
57
|
res.status(200).send('OK');
|
|
49
58
|
}
|
|
50
59
|
else {
|
|
51
60
|
res.status(500).send('Not ready');
|
|
52
61
|
}
|
|
53
|
-
});
|
|
62
|
+
}));
|
|
54
63
|
// as long as the event loop is running this should run
|
|
55
64
|
app.get('/liveness', (req, res) => {
|
|
56
65
|
res.status(200).send('OK');
|
|
@@ -61,7 +70,10 @@ class BaseService {
|
|
|
61
70
|
}
|
|
62
71
|
// override to have derived classes declare non-readiness to k8s
|
|
63
72
|
isReady() {
|
|
64
|
-
return
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
console.log("Ready is here +++++>>> ");
|
|
75
|
+
return true;
|
|
76
|
+
});
|
|
65
77
|
}
|
|
66
78
|
/**
|
|
67
79
|
* Register message listeners here.
|
package/.dist/BaseService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../src/BaseService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../src/BaseService.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,0CAA0C;AAC1C,mCAAmC;AACnC,+BAKe;AACf,uCAAuC;AACvC,uCAAgC;AAEhC;;GAEG;AACH,MAAM,WAAW;IAUf,YAAY,IAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,0BAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9D;;WAEG;QACH,IAAI,gBAAU,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YAC1E,MAAM,CAAC,IAAI,CAAC;gBACV,GAAG,EAAE,gBAAU;gBACf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,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,WAAW,4CAA4C,WAAW,GAAG,CAAC,CAAC,CAAC;SACzI;IACH,CAAC;IAED,gEAAgE;IACnD,OAAO;;YAClB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;OAEG;IACI,QAAQ;QACb,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAEM,GAAG;QACR,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;CACF;AAED,kBAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sellout/service",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.281",
|
|
4
4
|
"description": "Sellout.io base service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"author": "samheutmaker@gmail.com",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@sellout/models": "^0.0.
|
|
19
|
-
"@sellout/utils": "^0.0.
|
|
18
|
+
"@sellout/models": "^0.0.281",
|
|
19
|
+
"@sellout/utils": "^0.0.281",
|
|
20
20
|
"@sentry/node": "^5.30.0",
|
|
21
21
|
"analytics-node": "^3.5.0",
|
|
22
22
|
"express": "^4.18.2",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"nodemon": "^2.0.22",
|
|
32
32
|
"typescript": "^4.4.2"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6aab854a2854dfbc818b62a4915cc7192a2c4756"
|
|
35
35
|
}
|
package/src/BaseService.ts
CHANGED
|
@@ -21,6 +21,7 @@ class BaseService {
|
|
|
21
21
|
public storage;
|
|
22
22
|
public segment: Segment;
|
|
23
23
|
public collectDefaultMetrics;
|
|
24
|
+
public ready: any
|
|
24
25
|
|
|
25
26
|
constructor(opts: IServiceOpts) {
|
|
26
27
|
this.opts = opts;
|
|
@@ -60,8 +61,8 @@ class BaseService {
|
|
|
60
61
|
res.send(Prometheus.register.metrics())
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
app.get('/readiness', (req, res) => {
|
|
64
|
-
if (this.isReady()) {
|
|
64
|
+
app.get('/readiness', async (req, res) => {
|
|
65
|
+
if (await this.isReady()) {
|
|
65
66
|
res.status(200).send('OK');
|
|
66
67
|
} else {
|
|
67
68
|
res.status(500).send('Not ready');
|
|
@@ -79,7 +80,8 @@ class BaseService {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
// override to have derived classes declare non-readiness to k8s
|
|
82
|
-
public isReady() : boolean {
|
|
83
|
+
public async isReady() : Promise<boolean> {
|
|
84
|
+
console.log("Ready is here +++++>>> ");
|
|
83
85
|
return true;
|
|
84
86
|
}
|
|
85
87
|
|