@vroskus/library-health 1.0.0
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/index.js +38 -0
- package/package.json +41 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.healthRoute = void 0;
|
|
16
|
+
const os_1 = __importDefault(require("os"));
|
|
17
|
+
const node_os_utils_1 = __importDefault(require("node-os-utils"));
|
|
18
|
+
const getSystemValues = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const load = yield node_os_utils_1.default.cpu.loadavg();
|
|
20
|
+
const disk = yield node_os_utils_1.default.drive.info();
|
|
21
|
+
const mem = yield node_os_utils_1.default.mem.info();
|
|
22
|
+
const uptime = {
|
|
23
|
+
container: process.uptime(),
|
|
24
|
+
os: os_1.default.uptime(),
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
disk,
|
|
28
|
+
load,
|
|
29
|
+
mem,
|
|
30
|
+
uptime,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const healthRoute = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
const output = yield getSystemValues();
|
|
35
|
+
res.json(output);
|
|
36
|
+
});
|
|
37
|
+
exports.healthRoute = healthRoute;
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vroskus/library-health",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Health",
|
|
5
|
+
"author": "Vilius Roškus <vilius@regattas.eu>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/vroskus/library-health.git"
|
|
10
|
+
},
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/index.js"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"postinstall": "npm run build",
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"test": "npm run test:eslint && npm run test:e2e",
|
|
19
|
+
"test:eslint": "eslint src --fix",
|
|
20
|
+
"test:e2e": "echo 'No tests'"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"express": "4.18.2",
|
|
24
|
+
"node-os-utils": "1.3.7"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/jest": "29.5.0",
|
|
28
|
+
"@types/node": "18.15.11",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "5.53.0",
|
|
30
|
+
"@typescript-eslint/parser": "5.53.0",
|
|
31
|
+
"eslint": "8.34.0",
|
|
32
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
33
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
34
|
+
"eslint-plugin-import": "2.27.5",
|
|
35
|
+
"eslint-plugin-import-newlines": "1.3.1",
|
|
36
|
+
"eslint-plugin-react": "7.32.2",
|
|
37
|
+
"eslint-plugin-sort": "2.4.0",
|
|
38
|
+
"npm-check": "6.0.1",
|
|
39
|
+
"typescript": "4.9.5"
|
|
40
|
+
}
|
|
41
|
+
}
|