@abyss-project/monitor 1.0.2 → 1.0.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/dist/api/application-cron-task.admin.api.d.ts +10 -10
- package/dist/api/application-cron-task.admin.api.js +40 -40
- package/dist/api/application-cron-task.api.d.ts +10 -10
- package/dist/api/application-cron-task.api.js +40 -40
- package/dist/api/application-log.admin.api.d.ts +3 -3
- package/dist/api/application-log.admin.api.js +12 -12
- package/dist/api/application-log.api.d.ts +4 -4
- package/dist/api/application-log.api.js +16 -16
- package/dist/api/application-stats.admin.api.d.ts +3 -3
- package/dist/api/application-stats.admin.api.js +12 -12
- package/dist/api/application-stats.api.d.ts +4 -4
- package/dist/api/application-stats.api.js +16 -16
- package/dist/api/application-store.admin.api.d.ts +6 -6
- package/dist/api/application-store.admin.api.js +24 -24
- package/dist/api/application-store.api.d.ts +6 -6
- package/dist/api/application-store.api.js +24 -24
- package/dist/api/application-store.public.api.d.ts +3 -3
- package/dist/api/application-store.public.api.js +12 -12
- package/dist/api/application.admin.api.d.ts +7 -7
- package/dist/api/application.admin.api.js +28 -28
- package/dist/api/application.api.d.ts +10 -9
- package/dist/api/application.api.js +40 -36
- package/dist/api/index.d.ts +12 -12
- package/dist/api/index.js +28 -24
- package/dist/api/monitor.api.d.ts +2 -2
- package/dist/api/monitor.api.js +8 -8
- package/dist/frameworks/express/decorators.d.ts +52 -52
- package/dist/frameworks/express/decorators.js +163 -163
- package/dist/frameworks/express/index.d.ts +16 -16
- package/dist/frameworks/express/index.js +170 -166
- package/dist/frameworks/express/metadata.d.ts +9 -9
- package/dist/frameworks/express/metadata.js +12 -12
- package/dist/frameworks/index.d.ts +1 -1
- package/dist/frameworks/index.js +17 -13
- package/dist/index.d.ts +46 -46
- package/dist/index.js +105 -101
- package/dist/middlewares/context.middleware.d.ts +12 -12
- package/dist/middlewares/context.middleware.js +39 -39
- package/dist/middlewares/index.d.ts +3 -3
- package/dist/middlewares/index.js +19 -15
- package/dist/middlewares/logger-endpoint.middleware.d.ts +5 -5
- package/dist/middlewares/logger-endpoint.middleware.js +75 -75
- package/dist/middlewares/logger-setup.middleware.d.ts +5 -5
- package/dist/middlewares/logger-setup.middleware.js +16 -16
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +17 -13
- package/dist/models/logger.model.d.ts +55 -55
- package/dist/models/logger.model.js +201 -201
- package/dist/models/stats-publisher.model.d.ts +20 -20
- package/dist/models/stats-publisher.model.js +113 -113
- package/dist/types/enum/api-error.enum.d.ts +20 -20
- package/dist/types/enum/api-error.enum.js +25 -25
- package/dist/types/enum/api-method.enum.d.ts +7 -7
- package/dist/types/enum/api-method.enum.js +11 -11
- package/dist/types/enum/application-alert-type.enum.d.ts +5 -5
- package/dist/types/enum/application-alert-type.enum.js +9 -9
- package/dist/types/enum/application-stats-type.enum.d.ts +5 -5
- package/dist/types/enum/application-stats-type.enum.js +9 -9
- package/dist/types/enum/index.d.ts +7 -7
- package/dist/types/enum/index.js +23 -19
- package/dist/types/enum/log-level.enum.d.ts +6 -6
- package/dist/types/enum/log-level.enum.js +10 -10
- package/dist/types/enum/log-scenario.enum.d.ts +5 -5
- package/dist/types/enum/log-scenario.enum.js +9 -9
- package/dist/types/enum/webhook-type.enum.d.ts +3 -3
- package/dist/types/enum/webhook-type.enum.js +7 -7
- package/dist/types/index.d.ts +18 -18
- package/dist/types/index.js +18 -14
- package/dist/types/interface/api/index.d.ts +27 -27
- package/dist/types/interface/api/index.js +43 -39
- package/dist/types/interface/api/requests/application-cron-task.admin.request.d.ts +50 -51
- package/dist/types/interface/api/requests/application-cron-task.admin.request.js +2 -2
- package/dist/types/interface/api/requests/application-cron-task.request.d.ts +61 -62
- package/dist/types/interface/api/requests/application-cron-task.request.js +2 -2
- package/dist/types/interface/api/requests/application-log.admin.request.d.ts +19 -20
- package/dist/types/interface/api/requests/application-log.admin.request.js +2 -2
- package/dist/types/interface/api/requests/application-log.request.d.ts +53 -54
- package/dist/types/interface/api/requests/application-log.request.js +2 -2
- package/dist/types/interface/api/requests/application-stats.admin.request.d.ts +13 -14
- package/dist/types/interface/api/requests/application-stats.admin.request.js +2 -2
- package/dist/types/interface/api/requests/application-stats.request.d.ts +31 -32
- package/dist/types/interface/api/requests/application-stats.request.js +2 -2
- package/dist/types/interface/api/requests/application-store.admin.request.d.ts +34 -35
- package/dist/types/interface/api/requests/application-store.admin.request.js +2 -2
- package/dist/types/interface/api/requests/application-store.public.request.d.ts +8 -9
- package/dist/types/interface/api/requests/application-store.public.request.js +2 -2
- package/dist/types/interface/api/requests/application-store.request.d.ts +39 -40
- package/dist/types/interface/api/requests/application-store.request.js +2 -2
- package/dist/types/interface/api/requests/application.admin.request.d.ts +18 -19
- package/dist/types/interface/api/requests/application.admin.request.js +2 -2
- package/dist/types/interface/api/requests/application.request.d.ts +35 -33
- package/dist/types/interface/api/requests/application.request.js +2 -2
- package/dist/types/interface/api/responses/application-cron-task.admin.response.d.ts +30 -30
- package/dist/types/interface/api/responses/application-cron-task.admin.response.js +2 -2
- package/dist/types/interface/api/responses/application-cron-task.response.d.ts +30 -30
- package/dist/types/interface/api/responses/application-cron-task.response.js +2 -2
- package/dist/types/interface/api/responses/application-log.admin.response.d.ts +10 -10
- package/dist/types/interface/api/responses/application-log.admin.response.js +2 -2
- package/dist/types/interface/api/responses/application-log.response.d.ts +10 -10
- package/dist/types/interface/api/responses/application-log.response.js +2 -2
- package/dist/types/interface/api/responses/application-stats.admin.response.d.ts +6 -6
- package/dist/types/interface/api/responses/application-stats.admin.response.js +2 -2
- package/dist/types/interface/api/responses/application-stats.response.d.ts +10 -10
- package/dist/types/interface/api/responses/application-stats.response.js +2 -2
- package/dist/types/interface/api/responses/application-store.admin.response.d.ts +17 -17
- package/dist/types/interface/api/responses/application-store.admin.response.js +2 -2
- package/dist/types/interface/api/responses/application-store.public.response.d.ts +21 -21
- package/dist/types/interface/api/responses/application-store.public.response.js +2 -2
- package/dist/types/interface/api/responses/application-store.response.d.ts +17 -17
- package/dist/types/interface/api/responses/application-store.response.js +2 -2
- package/dist/types/interface/api/responses/application.admin.response.d.ts +33 -33
- package/dist/types/interface/api/responses/application.admin.response.js +2 -2
- package/dist/types/interface/api/responses/application.response.d.ts +129 -121
- package/dist/types/interface/api/responses/application.response.js +2 -2
- package/dist/types/interface/api/responses/monitor.response.d.ts +7 -7
- package/dist/types/interface/api/responses/monitor.response.js +2 -2
- package/dist/types/interface/api/type-message/api-error.d.ts +8 -8
- package/dist/types/interface/api/type-message/api-error.js +2 -2
- package/dist/types/interface/api/type-message/base-order.d.ts +4 -4
- package/dist/types/interface/api/type-message/base-order.js +2 -2
- package/dist/types/interface/api/type-message/base-paginate.d.ts +10 -10
- package/dist/types/interface/api/type-message/base-paginate.js +2 -2
- package/dist/types/interface/api/type-message/response.d.ts +5 -5
- package/dist/types/interface/api/type-message/response.js +2 -2
- package/dist/types/interface/index.d.ts +9 -8
- package/dist/types/interface/index.js +25 -20
- package/dist/types/interface/models/application-cron-task-history.model.d.ts +11 -11
- package/dist/types/interface/models/application-cron-task-history.model.js +2 -2
- package/dist/types/interface/models/application-cron-task.model.d.ts +14 -14
- package/dist/types/interface/models/application-cron-task.model.js +2 -2
- package/dist/types/interface/models/application-event.model.d.ts +18 -0
- package/dist/types/interface/{api/requests/abyss.admin.request.js → models/application-event.model.js} +2 -2
- package/dist/types/interface/models/application-log-endpoint.model.d.ts +20 -20
- package/dist/types/interface/models/application-log-endpoint.model.js +2 -2
- package/dist/types/interface/models/application-log.model.d.ts +23 -21
- package/dist/types/interface/models/application-log.model.js +2 -2
- package/dist/types/interface/models/application-stats.model.d.ts +14 -14
- package/dist/types/interface/models/application-stats.model.js +2 -2
- package/dist/types/interface/models/application-store-entry.model.d.ts +14 -14
- package/dist/types/interface/models/application-store-entry.model.js +2 -2
- package/dist/types/interface/models/application.model.d.ts +17 -15
- package/dist/types/interface/models/application.model.js +2 -2
- package/dist/utils/alert.utils.d.ts +35 -35
- package/dist/utils/alert.utils.js +138 -134
- package/dist/utils/discord-webhook-log-formatter.utils.d.ts +42 -42
- package/dist/utils/discord-webhook-log-formatter.utils.js +319 -319
- package/dist/utils/error.utils.d.ts +15 -15
- package/dist/utils/error.utils.js +24 -24
- package/dist/utils/import.utils.d.ts +1 -1
- package/dist/utils/import.utils.js +7 -7
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +21 -17
- package/dist/utils/json.utils.d.ts +1 -1
- package/dist/utils/json.utils.js +13 -13
- package/dist/utils/non-blocking-promise.utils.d.ts +2 -2
- package/dist/utils/non-blocking-promise.utils.js +11 -11
- package/package.json +5 -5
- package/dist/api/abyss.admin.api.d.ts +0 -2
- package/dist/api/abyss.admin.api.js +0 -8
- package/dist/api/application-store-entry.admin.api.d.ts +0 -6
- package/dist/api/application-store-entry.admin.api.js +0 -24
- package/dist/api/application-store-entry.api.d.ts +0 -6
- package/dist/api/application-store-entry.api.js +0 -24
- package/dist/api/application-store-entry.public.api.d.ts +0 -3
- package/dist/api/application-store-entry.public.api.js +0 -12
- package/dist/api/logger.admin.api.d.ts +0 -3
- package/dist/api/logger.admin.api.js +0 -14
- package/dist/api/user-application-alert.admin.api.d.ts +0 -7
- package/dist/api/user-application-alert.admin.api.js +0 -28
- package/dist/api/user-application-alert.api.d.ts +0 -7
- package/dist/api/user-application-alert.api.js +0 -28
- package/dist/api/user-application-cron-task.admin.api.d.ts +0 -9
- package/dist/api/user-application-cron-task.admin.api.js +0 -36
- package/dist/api/user-application-cron-task.api.d.ts +0 -9
- package/dist/api/user-application-cron-task.api.js +0 -36
- package/dist/api/user-application-log.admin.api.d.ts +0 -3
- package/dist/api/user-application-log.admin.api.js +0 -12
- package/dist/api/user-application-log.api.d.ts +0 -4
- package/dist/api/user-application-log.api.js +0 -16
- package/dist/api/user-application-stats.admin.api.d.ts +0 -3
- package/dist/api/user-application-stats.admin.api.js +0 -12
- package/dist/api/user-application-stats.api.d.ts +0 -4
- package/dist/api/user-application-stats.api.js +0 -16
- package/dist/api/user-application.admin.api.d.ts +0 -6
- package/dist/api/user-application.admin.api.js +0 -24
- package/dist/api/user-application.api.d.ts +0 -10
- package/dist/api/user-application.api.js +0 -40
- package/dist/api/user.admin.api.d.ts +0 -5
- package/dist/api/user.admin.api.js +0 -23
- package/dist/api/user.api.d.ts +0 -4
- package/dist/api/user.api.js +0 -17
- package/dist/consts.d.ts +0 -2
- package/dist/consts.js +0 -5
- package/dist/types/enum/log-type.enum.d.ts +0 -6
- package/dist/types/enum/log-type.enum.js +0 -10
- package/dist/types/enum/user-application-alert-type.enum.d.ts +0 -5
- package/dist/types/enum/user-application-alert-type.enum.js +0 -9
- package/dist/types/enum/user-application-stats-type.enum.d.ts +0 -5
- package/dist/types/enum/user-application-stats-type.enum.js +0 -9
- package/dist/types/interface/api/requests/abyss.admin.request.d.ts +0 -4
- package/dist/types/interface/api/requests/logger.admin.request.d.ts +0 -8
- package/dist/types/interface/api/requests/logger.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-alert.admin.request.d.ts +0 -44
- package/dist/types/interface/api/requests/user-application-alert.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-alert.request.d.ts +0 -50
- package/dist/types/interface/api/requests/user-application-alert.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-cron-task.admin.request.d.ts +0 -48
- package/dist/types/interface/api/requests/user-application-cron-task.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-cron-task.request.d.ts +0 -58
- package/dist/types/interface/api/requests/user-application-cron-task.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-log.admin.request.d.ts +0 -20
- package/dist/types/interface/api/requests/user-application-log.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-log.request.d.ts +0 -51
- package/dist/types/interface/api/requests/user-application-log.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-stats.admin.request.d.ts +0 -14
- package/dist/types/interface/api/requests/user-application-stats.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application-stats.request.d.ts +0 -29
- package/dist/types/interface/api/requests/user-application-stats.request.js +0 -2
- package/dist/types/interface/api/requests/user-application.admin.request.d.ts +0 -15
- package/dist/types/interface/api/requests/user-application.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user-application.request.d.ts +0 -35
- package/dist/types/interface/api/requests/user-application.request.js +0 -2
- package/dist/types/interface/api/requests/user.admin.request.d.ts +0 -18
- package/dist/types/interface/api/requests/user.admin.request.js +0 -2
- package/dist/types/interface/api/requests/user.request.d.ts +0 -3
- package/dist/types/interface/api/requests/user.request.js +0 -2
- package/dist/types/interface/api/responses/abyss.admin.response.d.ts +0 -6
- package/dist/types/interface/api/responses/abyss.admin.response.js +0 -2
- package/dist/types/interface/api/responses/logger.admin.response.d.ts +0 -7
- package/dist/types/interface/api/responses/logger.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-alert.admin.response.d.ts +0 -22
- package/dist/types/interface/api/responses/user-application-alert.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-alert.response.d.ts +0 -22
- package/dist/types/interface/api/responses/user-application-alert.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-cron-task.admin.response.d.ts +0 -27
- package/dist/types/interface/api/responses/user-application-cron-task.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-cron-task.response.d.ts +0 -27
- package/dist/types/interface/api/responses/user-application-cron-task.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-log.admin.response.d.ts +0 -11
- package/dist/types/interface/api/responses/user-application-log.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-log.response.d.ts +0 -11
- package/dist/types/interface/api/responses/user-application-log.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-stats.admin.response.d.ts +0 -7
- package/dist/types/interface/api/responses/user-application-stats.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application-stats.response.d.ts +0 -11
- package/dist/types/interface/api/responses/user-application-stats.response.js +0 -2
- package/dist/types/interface/api/responses/user-application.admin.response.d.ts +0 -17
- package/dist/types/interface/api/responses/user-application.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user-application.response.d.ts +0 -120
- package/dist/types/interface/api/responses/user-application.response.js +0 -2
- package/dist/types/interface/api/responses/user.admin.response.d.ts +0 -15
- package/dist/types/interface/api/responses/user.admin.response.js +0 -2
- package/dist/types/interface/api/responses/user.response.d.ts +0 -13
- package/dist/types/interface/api/responses/user.response.js +0 -2
- package/dist/types/interface/models/cron-task-history.model.d.ts +0 -12
- package/dist/types/interface/models/cron-task-history.model.js +0 -2
- package/dist/types/interface/models/cron-task.model.d.ts +0 -13
- package/dist/types/interface/models/cron-task.model.js +0 -2
- package/dist/types/interface/models/log-console.model.d.ts +0 -17
- package/dist/types/interface/models/log-console.model.js +0 -2
- package/dist/types/interface/models/log-endpoint.model.d.ts +0 -22
- package/dist/types/interface/models/log-endpoint.model.js +0 -2
- package/dist/types/interface/models/user-application-alert.model.d.ts +0 -44
- package/dist/types/interface/models/user-application-alert.model.js +0 -2
- package/dist/types/interface/models/user-application-cron-task-history.model.d.ts +0 -11
- package/dist/types/interface/models/user-application-cron-task-history.model.js +0 -2
- package/dist/types/interface/models/user-application-cron-task.model.d.ts +0 -14
- package/dist/types/interface/models/user-application-cron-task.model.js +0 -2
- package/dist/types/interface/models/user-application-log-endpoint.model.d.ts +0 -20
- package/dist/types/interface/models/user-application-log-endpoint.model.js +0 -2
- package/dist/types/interface/models/user-application-log.model.d.ts +0 -21
- package/dist/types/interface/models/user-application-log.model.js +0 -2
- package/dist/types/interface/models/user-application-stats.model.d.ts +0 -14
- package/dist/types/interface/models/user-application-stats.model.js +0 -2
- package/dist/types/interface/models/user-application.model.d.ts +0 -15
- package/dist/types/interface/models/user-application.model.js +0 -2
- package/dist/types/interface/models/user.model.d.ts +0 -8
- package/dist/types/interface/models/user.model.js +0 -2
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StatsPublisher = void 0;
|
|
7
|
-
const axios_1 = require("axios");
|
|
8
|
-
const __1 = require("..");
|
|
9
|
-
const node_os_utils_1 = __importDefault(require("node-os-utils"));
|
|
10
|
-
const INTERVAL_BETWEEN_STATS_PUBLISH = 30000;
|
|
11
|
-
class StatsPublisher {
|
|
12
|
-
static start(options) {
|
|
13
|
-
if (typeof window !== 'undefined') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const si = require('systeminformation');
|
|
17
|
-
const checkDiskSpace = require('check-disk-space').default;
|
|
18
|
-
const interval = setInterval(async () => {
|
|
19
|
-
var _a, _b, _c, _d, _e;
|
|
20
|
-
try {
|
|
21
|
-
const devices = await si.blockDevices();
|
|
22
|
-
const dateValue = new Date();
|
|
23
|
-
const [cpuUsage, cpuSpeed, cpu, { usedMemMb, totalMemMb }, ...devicesSpace] = await Promise.all([
|
|
24
|
-
node_os_utils_1.default.cpu.usage(),
|
|
25
|
-
si.cpuCurrentSpeed(),
|
|
26
|
-
si.cpu(),
|
|
27
|
-
node_os_utils_1.default.mem.used(),
|
|
28
|
-
...devices.map((device) => checkDiskSpace(device.mount)),
|
|
29
|
-
]);
|
|
30
|
-
const totalDisk = devicesSpace.reduce((acc, drive) => acc + drive.size, 0);
|
|
31
|
-
const totalDiskFree = devicesSpace.reduce((acc, drive) => acc + drive.free, 0);
|
|
32
|
-
const totalDiskUSage = totalDisk - totalDiskFree;
|
|
33
|
-
const totalDiskUSagePerCent = (totalDiskUSage / totalDisk) * 100 || 0;
|
|
34
|
-
const payload = {
|
|
35
|
-
cpuUsage: (cpuSpeed.avg * (cpu.cores || 1) * 1000 * 1000 * 1000 * cpuUsage) / 100,
|
|
36
|
-
cpuPercentUsage: cpuUsage,
|
|
37
|
-
ramUsage: usedMemMb * 1024 * 1024,
|
|
38
|
-
ramPercentUsage: ((usedMemMb * 1024 * 1024) / (totalMemMb * 1024 * 1024)) * 100,
|
|
39
|
-
diskUsage: totalDiskUSage,
|
|
40
|
-
diskPercentUsage: totalDiskUSagePerCent,
|
|
41
|
-
};
|
|
42
|
-
const stats = [
|
|
43
|
-
{
|
|
44
|
-
type: __1.ApplicationStatsType.CPU_USAGE,
|
|
45
|
-
dateValue,
|
|
46
|
-
value: payload.cpuUsage,
|
|
47
|
-
percentValue: payload.cpuPercentUsage,
|
|
48
|
-
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: __1.ApplicationStatsType.RAM_USAGE,
|
|
52
|
-
dateValue,
|
|
53
|
-
value: payload.ramUsage,
|
|
54
|
-
percentValue: payload.ramPercentUsage,
|
|
55
|
-
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
type: __1.ApplicationStatsType.DISK_USAGE,
|
|
59
|
-
dateValue,
|
|
60
|
-
value: payload.diskUsage,
|
|
61
|
-
percentValue: payload.diskPercentUsage,
|
|
62
|
-
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
if (options === null || options === void 0 ? void 0 : options.customCallback) {
|
|
66
|
-
await options.customCallback(stats);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const applicationId = __1.AbyssMonitorCore.getConfig().applicationId;
|
|
70
|
-
const secretPublishToken = __1.AbyssMonitorCore.getConfig().secretPublishToken;
|
|
71
|
-
if (!applicationId) {
|
|
72
|
-
(_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.warn(`No applicationId provided on AbyssMonitorCore. Skipping publish stats`);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (!secretPublishToken) {
|
|
76
|
-
(_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.warn(`No secretPublishToken provided on AbyssMonitorCore. Skipping publish stats`);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
await (0, __1.createApplicationStats)({ applicationId }, { token: secretPublishToken }, { stats: stats });
|
|
80
|
-
await (0, __1.sendStatsAlert)({
|
|
81
|
-
...payload,
|
|
82
|
-
logger: options === null || options === void 0 ? void 0 : options.logger,
|
|
83
|
-
statsData: {
|
|
84
|
-
cpu: { percentValue: payload.cpuPercentUsage, value: payload.cpuUsage },
|
|
85
|
-
ram: { percentValue: payload.ramPercentUsage, value: payload.ramUsage },
|
|
86
|
-
disk: { percentValue: payload.diskPercentUsage, value: payload.diskUsage },
|
|
87
|
-
},
|
|
88
|
-
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
89
|
-
dateValue,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
console.log(error);
|
|
95
|
-
(_c = options === null || options === void 0 ? void 0 : options.logger) === null || _c === void 0 ? void 0 : _c.error(`Failed to publish stats. Error ${error}`, { data: { error } });
|
|
96
|
-
if ((0, axios_1.isAxiosError)(error) && ((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 401) {
|
|
97
|
-
(_e = options === null || options === void 0 ? void 0 : options.logger) === null || _e === void 0 ? void 0 : _e.warn(`Unauthorized to publish stats, disabling stats publisher.`);
|
|
98
|
-
this.stop();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}, (options === null || options === void 0 ? void 0 : options.interval) && (options === null || options === void 0 ? void 0 : options.interval) >= INTERVAL_BETWEEN_STATS_PUBLISH
|
|
102
|
-
? options === null || options === void 0 ? void 0 : options.interval
|
|
103
|
-
: INTERVAL_BETWEEN_STATS_PUBLISH);
|
|
104
|
-
StatsPublisher.interval = interval;
|
|
105
|
-
}
|
|
106
|
-
static stop() {
|
|
107
|
-
if (StatsPublisher.interval) {
|
|
108
|
-
clearInterval(StatsPublisher.interval);
|
|
109
|
-
}
|
|
110
|
-
StatsPublisher.interval = null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.StatsPublisher = StatsPublisher;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StatsPublisher = void 0;
|
|
7
|
+
const axios_1 = require("axios");
|
|
8
|
+
const __1 = require("..");
|
|
9
|
+
const node_os_utils_1 = __importDefault(require("node-os-utils"));
|
|
10
|
+
const INTERVAL_BETWEEN_STATS_PUBLISH = 30000;
|
|
11
|
+
class StatsPublisher {
|
|
12
|
+
static start(options) {
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const si = require('systeminformation');
|
|
17
|
+
const checkDiskSpace = require('check-disk-space').default;
|
|
18
|
+
const interval = setInterval(async () => {
|
|
19
|
+
var _a, _b, _c, _d, _e;
|
|
20
|
+
try {
|
|
21
|
+
const devices = await si.blockDevices();
|
|
22
|
+
const dateValue = new Date();
|
|
23
|
+
const [cpuUsage, cpuSpeed, cpu, { usedMemMb, totalMemMb }, ...devicesSpace] = await Promise.all([
|
|
24
|
+
node_os_utils_1.default.cpu.usage(),
|
|
25
|
+
si.cpuCurrentSpeed(),
|
|
26
|
+
si.cpu(),
|
|
27
|
+
node_os_utils_1.default.mem.used(),
|
|
28
|
+
...devices.map((device) => checkDiskSpace(device.mount)),
|
|
29
|
+
]);
|
|
30
|
+
const totalDisk = devicesSpace.reduce((acc, drive) => acc + drive.size, 0);
|
|
31
|
+
const totalDiskFree = devicesSpace.reduce((acc, drive) => acc + drive.free, 0);
|
|
32
|
+
const totalDiskUSage = totalDisk - totalDiskFree;
|
|
33
|
+
const totalDiskUSagePerCent = (totalDiskUSage / totalDisk) * 100 || 0;
|
|
34
|
+
const payload = {
|
|
35
|
+
cpuUsage: (cpuSpeed.avg * (cpu.cores || 1) * 1000 * 1000 * 1000 * cpuUsage) / 100,
|
|
36
|
+
cpuPercentUsage: cpuUsage,
|
|
37
|
+
ramUsage: usedMemMb * 1024 * 1024,
|
|
38
|
+
ramPercentUsage: ((usedMemMb * 1024 * 1024) / (totalMemMb * 1024 * 1024)) * 100,
|
|
39
|
+
diskUsage: totalDiskUSage,
|
|
40
|
+
diskPercentUsage: totalDiskUSagePerCent,
|
|
41
|
+
};
|
|
42
|
+
const stats = [
|
|
43
|
+
{
|
|
44
|
+
type: __1.ApplicationStatsType.CPU_USAGE,
|
|
45
|
+
dateValue,
|
|
46
|
+
value: payload.cpuUsage,
|
|
47
|
+
percentValue: payload.cpuPercentUsage,
|
|
48
|
+
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: __1.ApplicationStatsType.RAM_USAGE,
|
|
52
|
+
dateValue,
|
|
53
|
+
value: payload.ramUsage,
|
|
54
|
+
percentValue: payload.ramPercentUsage,
|
|
55
|
+
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: __1.ApplicationStatsType.DISK_USAGE,
|
|
59
|
+
dateValue,
|
|
60
|
+
value: payload.diskUsage,
|
|
61
|
+
percentValue: payload.diskPercentUsage,
|
|
62
|
+
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
if (options === null || options === void 0 ? void 0 : options.customCallback) {
|
|
66
|
+
await options.customCallback(stats);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const applicationId = __1.AbyssMonitorCore.getConfig().applicationId;
|
|
70
|
+
const secretPublishToken = __1.AbyssMonitorCore.getConfig().secretPublishToken;
|
|
71
|
+
if (!applicationId) {
|
|
72
|
+
(_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.warn(`No applicationId provided on AbyssMonitorCore. Skipping publish stats`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!secretPublishToken) {
|
|
76
|
+
(_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.warn(`No secretPublishToken provided on AbyssMonitorCore. Skipping publish stats`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
await (0, __1.createApplicationStats)({ applicationId }, { token: secretPublishToken }, { stats: stats });
|
|
80
|
+
await (0, __1.sendStatsAlert)({
|
|
81
|
+
...payload,
|
|
82
|
+
logger: options === null || options === void 0 ? void 0 : options.logger,
|
|
83
|
+
statsData: {
|
|
84
|
+
cpu: { percentValue: payload.cpuPercentUsage, value: payload.cpuUsage },
|
|
85
|
+
ram: { percentValue: payload.ramPercentUsage, value: payload.ramUsage },
|
|
86
|
+
disk: { percentValue: payload.diskPercentUsage, value: payload.diskUsage },
|
|
87
|
+
},
|
|
88
|
+
processId: (options === null || options === void 0 ? void 0 : options.processId) || process.pid.toString(),
|
|
89
|
+
dateValue,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.log(error);
|
|
95
|
+
(_c = options === null || options === void 0 ? void 0 : options.logger) === null || _c === void 0 ? void 0 : _c.error(`Failed to publish stats. Error ${error}`, { data: { error } });
|
|
96
|
+
if ((0, axios_1.isAxiosError)(error) && ((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 401) {
|
|
97
|
+
(_e = options === null || options === void 0 ? void 0 : options.logger) === null || _e === void 0 ? void 0 : _e.warn(`Unauthorized to publish stats, disabling stats publisher.`);
|
|
98
|
+
this.stop();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, (options === null || options === void 0 ? void 0 : options.interval) && (options === null || options === void 0 ? void 0 : options.interval) >= INTERVAL_BETWEEN_STATS_PUBLISH
|
|
102
|
+
? options === null || options === void 0 ? void 0 : options.interval
|
|
103
|
+
: INTERVAL_BETWEEN_STATS_PUBLISH);
|
|
104
|
+
StatsPublisher.interval = interval;
|
|
105
|
+
}
|
|
106
|
+
static stop() {
|
|
107
|
+
if (StatsPublisher.interval) {
|
|
108
|
+
clearInterval(StatsPublisher.interval);
|
|
109
|
+
}
|
|
110
|
+
StatsPublisher.interval = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.StatsPublisher = StatsPublisher;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export declare enum ErrorType {
|
|
2
|
-
apiError = "api_error",
|
|
3
|
-
authError = "authentication_error",
|
|
4
|
-
resourceError = "resource_error"
|
|
5
|
-
}
|
|
6
|
-
export declare enum Code {
|
|
7
|
-
tokenFailure = "token_authentication_failure",
|
|
8
|
-
authenticationFailure = "authentication_credentials_failure",
|
|
9
|
-
accessNotAllowed = "access_not_allowed",
|
|
10
|
-
notFound = "not_found",
|
|
11
|
-
validationError = "resource_validation_error",
|
|
12
|
-
constraintError = "resource_constraint_error",
|
|
13
|
-
internalServerError = "internal_server_error",
|
|
14
|
-
serviceUnavailable = "service_unavailable",
|
|
15
|
-
invalidData = "invalid_data",
|
|
16
|
-
notImplemented = "not_implemented",
|
|
17
|
-
maxCronTaskNumber = "max_cron_task_number",
|
|
18
|
-
maxStoreEntryNumber = "max_store_entry_number",
|
|
19
|
-
slugAlreadyExist = "slug_already_exist"
|
|
20
|
-
}
|
|
1
|
+
export declare enum ErrorType {
|
|
2
|
+
apiError = "api_error",
|
|
3
|
+
authError = "authentication_error",
|
|
4
|
+
resourceError = "resource_error"
|
|
5
|
+
}
|
|
6
|
+
export declare enum Code {
|
|
7
|
+
tokenFailure = "token_authentication_failure",
|
|
8
|
+
authenticationFailure = "authentication_credentials_failure",
|
|
9
|
+
accessNotAllowed = "access_not_allowed",
|
|
10
|
+
notFound = "not_found",
|
|
11
|
+
validationError = "resource_validation_error",
|
|
12
|
+
constraintError = "resource_constraint_error",
|
|
13
|
+
internalServerError = "internal_server_error",
|
|
14
|
+
serviceUnavailable = "service_unavailable",
|
|
15
|
+
invalidData = "invalid_data",
|
|
16
|
+
notImplemented = "not_implemented",
|
|
17
|
+
maxCronTaskNumber = "max_cron_task_number",
|
|
18
|
+
maxStoreEntryNumber = "max_store_entry_number",
|
|
19
|
+
slugAlreadyExist = "slug_already_exist"
|
|
20
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Code = exports.ErrorType = void 0;
|
|
4
|
-
var ErrorType;
|
|
5
|
-
(function (ErrorType) {
|
|
6
|
-
ErrorType["apiError"] = "api_error";
|
|
7
|
-
ErrorType["authError"] = "authentication_error";
|
|
8
|
-
ErrorType["resourceError"] = "resource_error";
|
|
9
|
-
})(ErrorType
|
|
10
|
-
var Code;
|
|
11
|
-
(function (Code) {
|
|
12
|
-
Code["tokenFailure"] = "token_authentication_failure";
|
|
13
|
-
Code["authenticationFailure"] = "authentication_credentials_failure";
|
|
14
|
-
Code["accessNotAllowed"] = "access_not_allowed";
|
|
15
|
-
Code["notFound"] = "not_found";
|
|
16
|
-
Code["validationError"] = "resource_validation_error";
|
|
17
|
-
Code["constraintError"] = "resource_constraint_error";
|
|
18
|
-
Code["internalServerError"] = "internal_server_error";
|
|
19
|
-
Code["serviceUnavailable"] = "service_unavailable";
|
|
20
|
-
Code["invalidData"] = "invalid_data";
|
|
21
|
-
Code["notImplemented"] = "not_implemented";
|
|
22
|
-
Code["maxCronTaskNumber"] = "max_cron_task_number";
|
|
23
|
-
Code["maxStoreEntryNumber"] = "max_store_entry_number";
|
|
24
|
-
Code["slugAlreadyExist"] = "slug_already_exist";
|
|
25
|
-
})(Code
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Code = exports.ErrorType = void 0;
|
|
4
|
+
var ErrorType;
|
|
5
|
+
(function (ErrorType) {
|
|
6
|
+
ErrorType["apiError"] = "api_error";
|
|
7
|
+
ErrorType["authError"] = "authentication_error";
|
|
8
|
+
ErrorType["resourceError"] = "resource_error";
|
|
9
|
+
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
|
10
|
+
var Code;
|
|
11
|
+
(function (Code) {
|
|
12
|
+
Code["tokenFailure"] = "token_authentication_failure";
|
|
13
|
+
Code["authenticationFailure"] = "authentication_credentials_failure";
|
|
14
|
+
Code["accessNotAllowed"] = "access_not_allowed";
|
|
15
|
+
Code["notFound"] = "not_found";
|
|
16
|
+
Code["validationError"] = "resource_validation_error";
|
|
17
|
+
Code["constraintError"] = "resource_constraint_error";
|
|
18
|
+
Code["internalServerError"] = "internal_server_error";
|
|
19
|
+
Code["serviceUnavailable"] = "service_unavailable";
|
|
20
|
+
Code["invalidData"] = "invalid_data";
|
|
21
|
+
Code["notImplemented"] = "not_implemented";
|
|
22
|
+
Code["maxCronTaskNumber"] = "max_cron_task_number";
|
|
23
|
+
Code["maxStoreEntryNumber"] = "max_store_entry_number";
|
|
24
|
+
Code["slugAlreadyExist"] = "slug_already_exist";
|
|
25
|
+
})(Code || (exports.Code = Code = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare enum APIMethod {
|
|
2
|
-
GET = 1,
|
|
3
|
-
POST = 2,
|
|
4
|
-
DELETE = 3,
|
|
5
|
-
PUT = 4,
|
|
6
|
-
PATCH = 5
|
|
7
|
-
}
|
|
1
|
+
export declare enum APIMethod {
|
|
2
|
+
GET = 1,
|
|
3
|
+
POST = 2,
|
|
4
|
+
DELETE = 3,
|
|
5
|
+
PUT = 4,
|
|
6
|
+
PATCH = 5
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIMethod = void 0;
|
|
4
|
-
var APIMethod;
|
|
5
|
-
(function (APIMethod) {
|
|
6
|
-
APIMethod[APIMethod["GET"] = 1] = "GET";
|
|
7
|
-
APIMethod[APIMethod["POST"] = 2] = "POST";
|
|
8
|
-
APIMethod[APIMethod["DELETE"] = 3] = "DELETE";
|
|
9
|
-
APIMethod[APIMethod["PUT"] = 4] = "PUT";
|
|
10
|
-
APIMethod[APIMethod["PATCH"] = 5] = "PATCH";
|
|
11
|
-
})(APIMethod
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APIMethod = void 0;
|
|
4
|
+
var APIMethod;
|
|
5
|
+
(function (APIMethod) {
|
|
6
|
+
APIMethod[APIMethod["GET"] = 1] = "GET";
|
|
7
|
+
APIMethod[APIMethod["POST"] = 2] = "POST";
|
|
8
|
+
APIMethod[APIMethod["DELETE"] = 3] = "DELETE";
|
|
9
|
+
APIMethod[APIMethod["PUT"] = 4] = "PUT";
|
|
10
|
+
APIMethod[APIMethod["PATCH"] = 5] = "PATCH";
|
|
11
|
+
})(APIMethod || (exports.APIMethod = APIMethod = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare enum ApplicationAlertType {
|
|
2
|
-
CRON_TASK = "CRON_TASK",
|
|
3
|
-
LOG = "LOG",
|
|
4
|
-
STATS = "STATS"
|
|
5
|
-
}
|
|
1
|
+
export declare enum ApplicationAlertType {
|
|
2
|
+
CRON_TASK = "CRON_TASK",
|
|
3
|
+
LOG = "LOG",
|
|
4
|
+
STATS = "STATS"
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationAlertType = void 0;
|
|
4
|
-
var ApplicationAlertType;
|
|
5
|
-
(function (ApplicationAlertType) {
|
|
6
|
-
ApplicationAlertType["CRON_TASK"] = "CRON_TASK";
|
|
7
|
-
ApplicationAlertType["LOG"] = "LOG";
|
|
8
|
-
ApplicationAlertType["STATS"] = "STATS";
|
|
9
|
-
})(ApplicationAlertType
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationAlertType = void 0;
|
|
4
|
+
var ApplicationAlertType;
|
|
5
|
+
(function (ApplicationAlertType) {
|
|
6
|
+
ApplicationAlertType["CRON_TASK"] = "CRON_TASK";
|
|
7
|
+
ApplicationAlertType["LOG"] = "LOG";
|
|
8
|
+
ApplicationAlertType["STATS"] = "STATS";
|
|
9
|
+
})(ApplicationAlertType || (exports.ApplicationAlertType = ApplicationAlertType = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare enum ApplicationStatsType {
|
|
2
|
-
CPU_USAGE = 10,
|
|
3
|
-
RAM_USAGE = 20,
|
|
4
|
-
DISK_USAGE = 30
|
|
5
|
-
}
|
|
1
|
+
export declare enum ApplicationStatsType {
|
|
2
|
+
CPU_USAGE = 10,
|
|
3
|
+
RAM_USAGE = 20,
|
|
4
|
+
DISK_USAGE = 30
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationStatsType = void 0;
|
|
4
|
-
var ApplicationStatsType;
|
|
5
|
-
(function (ApplicationStatsType) {
|
|
6
|
-
ApplicationStatsType[ApplicationStatsType["CPU_USAGE"] = 10] = "CPU_USAGE";
|
|
7
|
-
ApplicationStatsType[ApplicationStatsType["RAM_USAGE"] = 20] = "RAM_USAGE";
|
|
8
|
-
ApplicationStatsType[ApplicationStatsType["DISK_USAGE"] = 30] = "DISK_USAGE";
|
|
9
|
-
})(ApplicationStatsType
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationStatsType = void 0;
|
|
4
|
+
var ApplicationStatsType;
|
|
5
|
+
(function (ApplicationStatsType) {
|
|
6
|
+
ApplicationStatsType[ApplicationStatsType["CPU_USAGE"] = 10] = "CPU_USAGE";
|
|
7
|
+
ApplicationStatsType[ApplicationStatsType["RAM_USAGE"] = 20] = "RAM_USAGE";
|
|
8
|
+
ApplicationStatsType[ApplicationStatsType["DISK_USAGE"] = 30] = "DISK_USAGE";
|
|
9
|
+
})(ApplicationStatsType || (exports.ApplicationStatsType = ApplicationStatsType = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './api-error.enum';
|
|
2
|
-
export * from './api-method.enum';
|
|
3
|
-
export * from './application-stats-type.enum';
|
|
4
|
-
export * from './application-alert-type.enum';
|
|
5
|
-
export * from './log-level.enum';
|
|
6
|
-
export * from './log-scenario.enum';
|
|
7
|
-
export * from './webhook-type.enum';
|
|
1
|
+
export * from './api-error.enum';
|
|
2
|
+
export * from './api-method.enum';
|
|
3
|
+
export * from './application-stats-type.enum';
|
|
4
|
+
export * from './application-alert-type.enum';
|
|
5
|
+
export * from './log-level.enum';
|
|
6
|
+
export * from './log-scenario.enum';
|
|
7
|
+
export * from './webhook-type.enum';
|
package/dist/types/enum/index.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__exportStar(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
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("./api-error.enum"), exports);
|
|
18
|
+
__exportStar(require("./api-method.enum"), exports);
|
|
19
|
+
__exportStar(require("./application-stats-type.enum"), exports);
|
|
20
|
+
__exportStar(require("./application-alert-type.enum"), exports);
|
|
21
|
+
__exportStar(require("./log-level.enum"), exports);
|
|
22
|
+
__exportStar(require("./log-scenario.enum"), exports);
|
|
23
|
+
__exportStar(require("./webhook-type.enum"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare enum LogLevel {
|
|
2
|
-
ERROR = 1,
|
|
3
|
-
WARN = 2,
|
|
4
|
-
INFO = 3,
|
|
5
|
-
LOG = 4
|
|
6
|
-
}
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
ERROR = 1,
|
|
3
|
+
WARN = 2,
|
|
4
|
+
INFO = 3,
|
|
5
|
+
LOG = 4
|
|
6
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogLevel = void 0;
|
|
4
|
-
var LogLevel;
|
|
5
|
-
(function (LogLevel) {
|
|
6
|
-
LogLevel[LogLevel["ERROR"] = 1] = "ERROR";
|
|
7
|
-
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
8
|
-
LogLevel[LogLevel["INFO"] = 3] = "INFO";
|
|
9
|
-
LogLevel[LogLevel["LOG"] = 4] = "LOG";
|
|
10
|
-
})(LogLevel
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevel = void 0;
|
|
4
|
+
var LogLevel;
|
|
5
|
+
(function (LogLevel) {
|
|
6
|
+
LogLevel[LogLevel["ERROR"] = 1] = "ERROR";
|
|
7
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
8
|
+
LogLevel[LogLevel["INFO"] = 3] = "INFO";
|
|
9
|
+
LogLevel[LogLevel["LOG"] = 4] = "LOG";
|
|
10
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare enum LogScenario {
|
|
2
|
-
API = "API",
|
|
3
|
-
SYSTEM_STARTUP = "SYSTEM_STARTUP",
|
|
4
|
-
OTHER = "OTHER"
|
|
5
|
-
}
|
|
1
|
+
export declare enum LogScenario {
|
|
2
|
+
API = "API",
|
|
3
|
+
SYSTEM_STARTUP = "SYSTEM_STARTUP",
|
|
4
|
+
OTHER = "OTHER"
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogScenario = void 0;
|
|
4
|
-
var LogScenario;
|
|
5
|
-
(function (LogScenario) {
|
|
6
|
-
LogScenario["API"] = "API";
|
|
7
|
-
LogScenario["SYSTEM_STARTUP"] = "SYSTEM_STARTUP";
|
|
8
|
-
LogScenario["OTHER"] = "OTHER";
|
|
9
|
-
})(LogScenario
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogScenario = void 0;
|
|
4
|
+
var LogScenario;
|
|
5
|
+
(function (LogScenario) {
|
|
6
|
+
LogScenario["API"] = "API";
|
|
7
|
+
LogScenario["SYSTEM_STARTUP"] = "SYSTEM_STARTUP";
|
|
8
|
+
LogScenario["OTHER"] = "OTHER";
|
|
9
|
+
})(LogScenario || (exports.LogScenario = LogScenario = {}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare enum WebhookType {
|
|
2
|
-
DISCORD = "DISCORD"
|
|
3
|
-
}
|
|
1
|
+
export declare enum WebhookType {
|
|
2
|
+
DISCORD = "DISCORD"
|
|
3
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookType = void 0;
|
|
4
|
-
var WebhookType;
|
|
5
|
-
(function (WebhookType) {
|
|
6
|
-
WebhookType["DISCORD"] = "DISCORD";
|
|
7
|
-
})(WebhookType
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookType = void 0;
|
|
4
|
+
var WebhookType;
|
|
5
|
+
(function (WebhookType) {
|
|
6
|
+
WebhookType["DISCORD"] = "DISCORD";
|
|
7
|
+
})(WebhookType || (exports.WebhookType = WebhookType = {}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export * from './interface';
|
|
2
|
-
export * from './enum';
|
|
3
|
-
export
|
|
4
|
-
start: Date;
|
|
5
|
-
startTime: [number, number];
|
|
6
|
-
durationToFinish?: number;
|
|
7
|
-
durationToClose?: number;
|
|
8
|
-
};
|
|
9
|
-
export
|
|
10
|
-
shouldNotPublishLog?: boolean;
|
|
11
|
-
shouldNotSaveRequestBody?: boolean;
|
|
12
|
-
shouldNotSaveResponseBody?: boolean;
|
|
13
|
-
responseBody?: unknown;
|
|
14
|
-
controller?: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
error?: any;
|
|
17
|
-
timer: IMonitorTimerLocals;
|
|
18
|
-
};
|
|
1
|
+
export * from './interface';
|
|
2
|
+
export * from './enum';
|
|
3
|
+
export type IMonitorTimerLocals = {
|
|
4
|
+
start: Date;
|
|
5
|
+
startTime: [number, number];
|
|
6
|
+
durationToFinish?: number;
|
|
7
|
+
durationToClose?: number;
|
|
8
|
+
};
|
|
9
|
+
export type IMonitorLocals = {
|
|
10
|
+
shouldNotPublishLog?: boolean;
|
|
11
|
+
shouldNotSaveRequestBody?: boolean;
|
|
12
|
+
shouldNotSaveResponseBody?: boolean;
|
|
13
|
+
responseBody?: unknown;
|
|
14
|
+
controller?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
error?: any;
|
|
17
|
+
timer: IMonitorTimerLocals;
|
|
18
|
+
};
|