@resolveio/server-lib 12.5.53 → 12.5.54
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/.nodemon.json +5 -0
- package/.vscode/settings.json +3 -0
- package/README.md +22 -0
- package/compileDTS.pl +64 -0
- package/gulpfile.js +127 -0
- package/mongodbensurers.js +2 -0
- package/mongostop.js +3 -0
- package/package.json +1 -1
- package/settings.development.json +13 -0
- package/src/client-server-app.ts +7 -0
- package/src/collections/app-status.collection.ts +51 -0
- package/src/collections/counter.collection.ts +54 -0
- package/src/collections/cron-job-history.collection.ts +82 -0
- package/src/collections/cron-job.collection.ts +85 -0
- package/src/collections/email-history.collection.ts +66 -0
- package/src/collections/email-verified.collection.ts +61 -0
- package/src/collections/file.collection.ts +73 -0
- package/src/collections/flag.collection.ts +56 -0
- package/src/collections/log-method-latency.collection.ts +64 -0
- package/src/collections/log-subscription.collection.ts +68 -0
- package/src/collections/log-ts.collection.ts +78 -0
- package/src/collections/log.collection.ts +77 -0
- package/src/collections/logged-in-users.collection.ts +65 -0
- package/src/collections/method-response.collection.ts +66 -0
- package/src/collections/monitor-cpu.collection.ts +63 -0
- package/src/collections/monitor-memory.collection.ts +75 -0
- package/src/collections/monitor-mongo.collection.ts +69 -0
- package/src/collections/notification.collection.ts +51 -0
- package/src/collections/report-builder-dashboard-builder.collection.ts +109 -0
- package/src/collections/report-builder-library.collection.ts +89 -0
- package/src/collections/report-builder-report.collection.ts +149 -0
- package/src/collections/user-group.collection.ts +90 -0
- package/src/collections/user-guide.collection.ts +57 -0
- package/src/collections/user.collection.ts +259 -0
- package/src/cron/cron.ts +188 -0
- package/src/fixtures/cron-jobs.ts +25 -0
- package/src/fixtures/init.ts +10 -0
- package/src/http/auth.ts +732 -0
- package/src/http/health.ts +7 -0
- package/src/http/home.ts +71 -0
- package/src/index.ts +71 -0
- package/src/managers/cron.manager.ts +208 -0
- package/src/managers/method.manager.ts +607 -0
- package/src/managers/mongo.manager.ts +2282 -0
- package/src/managers/monitor.manager.ts +323 -0
- package/src/managers/subscription.manager.ts +1196 -0
- package/{managers/subscription.performance.js → src/managers/subscription.performance.ts} +68 -33
- package/src/methods/accounts.ts +202 -0
- package/src/methods/aws.ts +507 -0
- package/src/methods/collections.ts +512 -0
- package/src/methods/counters.ts +75 -0
- package/src/methods/cron-jobs.ts +1454 -0
- package/src/methods/flags.ts +7 -0
- package/src/methods/logs.ts +327 -0
- package/src/methods/monitor.ts +548 -0
- package/src/methods/pdf.ts +615 -0
- package/src/methods/report-builder.ts +876 -0
- package/src/methods/support.ts +146 -0
- package/{models/app-status.model.d.ts → src/models/app-status.model.ts} +3 -2
- package/{models/billing-logged-in-users.model.d.ts → src/models/billing-logged-in-users.model.ts} +5 -4
- package/src/models/collection-document.model.ts +22 -0
- package/{models/counter.model.d.ts → src/models/counter.model.ts} +4 -3
- package/src/models/cron-job-history.model.ts +13 -0
- package/src/models/cron-job.model.ts +14 -0
- package/src/models/dialog.model.ts +25 -0
- package/{models/email-history.model.d.ts → src/models/email-history.model.ts} +8 -7
- package/{models/email-verified.model.d.ts → src/models/email-verified.model.ts} +6 -5
- package/{models/file.model.d.ts → src/models/file.model.ts} +8 -7
- package/{models/flag.model.d.ts → src/models/flag.model.ts} +4 -3
- package/{models/log-method-latency.model.d.ts → src/models/log-method-latency.model.ts} +5 -4
- package/{models/log-subscription.model.d.ts → src/models/log-subscription.model.ts} +8 -6
- package/{models/log.model.d.ts → src/models/log.model.ts} +12 -10
- package/{models/logged-in-users.model.d.ts → src/models/logged-in-users.model.ts} +6 -5
- package/{models/method-response.model.d.ts → src/models/method-response.model.ts} +7 -6
- package/src/models/method.model.ts +11 -0
- package/{models/monitor-cpu.model.d.ts → src/models/monitor-cpu.model.ts} +9 -7
- package/src/models/monitor-memory.model.ts +17 -0
- package/src/models/monitor-mongo.model.ts +15 -0
- package/{models/notification.model.d.ts → src/models/notification.model.ts} +3 -2
- package/src/models/pagination.model.ts +30 -0
- package/src/models/permission.model.ts +14 -0
- package/src/models/report-builder-dashboard-builder.model.ts +29 -0
- package/src/models/report-builder-library.model.ts +20 -0
- package/src/models/report-builder-report.model.ts +110 -0
- package/src/models/report-builder.model.ts +68 -0
- package/src/models/select-data-label.model.ts +9 -0
- package/src/models/server-response.model.ts +5 -0
- package/src/models/subscription.model.ts +64 -0
- package/src/models/support-ticket.model.ts +81 -0
- package/src/models/user-group.model.ts +23 -0
- package/{models/user-guide.model.d.ts → src/models/user-guide.model.ts} +5 -4
- package/src/models/user.model.ts +79 -0
- package/{public_api.d.ts → src/public_api.ts} +1 -1
- package/src/publications/app-status.ts +13 -0
- package/src/publications/cron-jobs.ts +30 -0
- package/src/publications/files.ts +34 -0
- package/src/publications/flags.ts +20 -0
- package/src/publications/logs.ts +164 -0
- package/src/publications/method-responses.ts +13 -0
- package/src/publications/notifications.ts +13 -0
- package/src/publications/report-builder-dashboard-builders.ts +39 -0
- package/src/publications/report-builder-libraries.ts +41 -0
- package/src/publications/report-builder-reports.ts +48 -0
- package/src/publications/super-admin.ts +13 -0
- package/src/publications/user-groups.ts +12 -0
- package/src/publications/user-guides.ts +12 -0
- package/src/server-app.ts +769 -0
- package/src/util/common.ts +519 -0
- package/src/util/schema-report-builder.ts +413 -0
- package/tsconfig.json +30 -0
- package/tslint.json +143 -0
- package/client-server-app.d.ts +0 -1
- package/client-server-app.js +0 -48
- package/client-server-app.js.map +0 -1
- package/collections/app-status.collection.d.ts +0 -3
- package/collections/app-status.collection.js +0 -51
- package/collections/app-status.collection.js.map +0 -1
- package/collections/counter.collection.d.ts +0 -3
- package/collections/counter.collection.js +0 -54
- package/collections/counter.collection.js.map +0 -1
- package/collections/cron-job-history.collection.d.ts +0 -3
- package/collections/cron-job-history.collection.js +0 -82
- package/collections/cron-job-history.collection.js.map +0 -1
- package/collections/cron-job.collection.d.ts +0 -3
- package/collections/cron-job.collection.js +0 -85
- package/collections/cron-job.collection.js.map +0 -1
- package/collections/email-history.collection.d.ts +0 -3
- package/collections/email-history.collection.js +0 -66
- package/collections/email-history.collection.js.map +0 -1
- package/collections/email-verified.collection.d.ts +0 -3
- package/collections/email-verified.collection.js +0 -61
- package/collections/email-verified.collection.js.map +0 -1
- package/collections/file.collection.d.ts +0 -3
- package/collections/file.collection.js +0 -73
- package/collections/file.collection.js.map +0 -1
- package/collections/flag.collection.d.ts +0 -3
- package/collections/flag.collection.js +0 -56
- package/collections/flag.collection.js.map +0 -1
- package/collections/log-method-latency.collection.d.ts +0 -3
- package/collections/log-method-latency.collection.js +0 -64
- package/collections/log-method-latency.collection.js.map +0 -1
- package/collections/log-subscription.collection.d.ts +0 -3
- package/collections/log-subscription.collection.js +0 -68
- package/collections/log-subscription.collection.js.map +0 -1
- package/collections/log-ts.collection.d.ts +0 -3
- package/collections/log-ts.collection.js +0 -78
- package/collections/log-ts.collection.js.map +0 -1
- package/collections/log.collection.d.ts +0 -3
- package/collections/log.collection.js +0 -77
- package/collections/log.collection.js.map +0 -1
- package/collections/logged-in-users.collection.d.ts +0 -3
- package/collections/logged-in-users.collection.js +0 -65
- package/collections/logged-in-users.collection.js.map +0 -1
- package/collections/method-response.collection.d.ts +0 -3
- package/collections/method-response.collection.js +0 -66
- package/collections/method-response.collection.js.map +0 -1
- package/collections/monitor-cpu.collection.d.ts +0 -3
- package/collections/monitor-cpu.collection.js +0 -63
- package/collections/monitor-cpu.collection.js.map +0 -1
- package/collections/monitor-memory.collection.d.ts +0 -3
- package/collections/monitor-memory.collection.js +0 -75
- package/collections/monitor-memory.collection.js.map +0 -1
- package/collections/monitor-mongo.collection.d.ts +0 -3
- package/collections/monitor-mongo.collection.js +0 -69
- package/collections/monitor-mongo.collection.js.map +0 -1
- package/collections/notification.collection.d.ts +0 -3
- package/collections/notification.collection.js +0 -51
- package/collections/notification.collection.js.map +0 -1
- package/collections/report-builder-dashboard-builder.collection.d.ts +0 -3
- package/collections/report-builder-dashboard-builder.collection.js +0 -109
- package/collections/report-builder-dashboard-builder.collection.js.map +0 -1
- package/collections/report-builder-library.collection.d.ts +0 -3
- package/collections/report-builder-library.collection.js +0 -87
- package/collections/report-builder-library.collection.js.map +0 -1
- package/collections/report-builder-report.collection.d.ts +0 -4
- package/collections/report-builder-report.collection.js +0 -149
- package/collections/report-builder-report.collection.js.map +0 -1
- package/collections/user-group.collection.d.ts +0 -4
- package/collections/user-group.collection.js +0 -90
- package/collections/user-group.collection.js.map +0 -1
- package/collections/user-guide.collection.d.ts +0 -3
- package/collections/user-guide.collection.js +0 -57
- package/collections/user-guide.collection.js.map +0 -1
- package/collections/user.collection.d.ts +0 -4
- package/collections/user.collection.js +0 -259
- package/collections/user.collection.js.map +0 -1
- package/cron/cron.d.ts +0 -5
- package/cron/cron.js +0 -162
- package/cron/cron.js.map +0 -1
- package/fixtures/cron-jobs.d.ts +0 -1
- package/fixtures/cron-jobs.js +0 -73
- package/fixtures/cron-jobs.js.map +0 -1
- package/fixtures/init.d.ts +0 -1
- package/fixtures/init.js +0 -59
- package/fixtures/init.js.map +0 -1
- package/http/auth.d.ts +0 -2
- package/http/auth.js +0 -763
- package/http/auth.js.map +0 -1
- package/http/health.d.ts +0 -1
- package/http/health.js +0 -12
- package/http/health.js.map +0 -1
- package/http/home.d.ts +0 -2
- package/http/home.js +0 -66
- package/http/home.js.map +0 -1
- package/index.d.ts +0 -23
- package/index.js +0 -127
- package/index.js.map +0 -1
- package/managers/cron.manager.d.ts +0 -17
- package/managers/cron.manager.js +0 -242
- package/managers/cron.manager.js.map +0 -1
- package/managers/method.manager.d.ts +0 -38
- package/managers/method.manager.js +0 -595
- package/managers/method.manager.js.map +0 -1
- package/managers/mongo.manager.d.ts +0 -178
- package/managers/mongo.manager.js +0 -2221
- package/managers/mongo.manager.js.map +0 -1
- package/managers/monitor.manager.d.ts +0 -59
- package/managers/monitor.manager.js +0 -351
- package/managers/monitor.manager.js.map +0 -1
- package/managers/subscription.manager.d.ts +0 -50
- package/managers/subscription.manager.js +0 -1091
- package/managers/subscription.manager.js.map +0 -1
- package/managers/subscription.performance.d.ts +0 -1
- package/managers/subscription.performance.js.map +0 -1
- package/methods/accounts.d.ts +0 -2
- package/methods/accounts.js +0 -274
- package/methods/accounts.js.map +0 -1
- package/methods/aws.d.ts +0 -2
- package/methods/aws.js +0 -617
- package/methods/aws.js.map +0 -1
- package/methods/collections.d.ts +0 -2
- package/methods/collections.js +0 -499
- package/methods/collections.js.map +0 -1
- package/methods/counters.d.ts +0 -2
- package/methods/counters.js +0 -122
- package/methods/counters.js.map +0 -1
- package/methods/cron-jobs.d.ts +0 -2
- package/methods/cron-jobs.js +0 -1315
- package/methods/cron-jobs.js.map +0 -1
- package/methods/flags.d.ts +0 -2
- package/methods/flags.js +0 -9
- package/methods/flags.js.map +0 -1
- package/methods/logs.d.ts +0 -2
- package/methods/logs.js +0 -371
- package/methods/logs.js.map +0 -1
- package/methods/monitor.d.ts +0 -2
- package/methods/monitor.js +0 -565
- package/methods/monitor.js.map +0 -1
- package/methods/pdf.d.ts +0 -2
- package/methods/pdf.js +0 -468
- package/methods/pdf.js.map +0 -1
- package/methods/report-builder.d.ts +0 -2
- package/methods/report-builder.js +0 -858
- package/methods/report-builder.js.map +0 -1
- package/methods/support.d.ts +0 -2
- package/methods/support.js +0 -246
- package/methods/support.js.map +0 -1
- package/models/app-status.model.js +0 -4
- package/models/app-status.model.js.map +0 -1
- package/models/billing-logged-in-users.model.js +0 -4
- package/models/billing-logged-in-users.model.js.map +0 -1
- package/models/collection-document.model.d.ts +0 -19
- package/models/collection-document.model.js +0 -4
- package/models/collection-document.model.js.map +0 -1
- package/models/counter.model.js +0 -4
- package/models/counter.model.js.map +0 -1
- package/models/cron-job-history.model.d.ts +0 -12
- package/models/cron-job-history.model.js +0 -4
- package/models/cron-job-history.model.js.map +0 -1
- package/models/cron-job.model.d.ts +0 -13
- package/models/cron-job.model.js +0 -4
- package/models/cron-job.model.js.map +0 -1
- package/models/dialog.model.d.ts +0 -23
- package/models/dialog.model.js +0 -4
- package/models/dialog.model.js.map +0 -1
- package/models/email-history.model.js +0 -4
- package/models/email-history.model.js.map +0 -1
- package/models/email-verified.model.js +0 -4
- package/models/email-verified.model.js.map +0 -1
- package/models/file.model.js +0 -4
- package/models/file.model.js.map +0 -1
- package/models/flag.model.js +0 -4
- package/models/flag.model.js.map +0 -1
- package/models/log-method-latency.model.js +0 -4
- package/models/log-method-latency.model.js.map +0 -1
- package/models/log-subscription.model.js +0 -4
- package/models/log-subscription.model.js.map +0 -1
- package/models/log.model.js +0 -4
- package/models/log.model.js.map +0 -1
- package/models/logged-in-users.model.js +0 -4
- package/models/logged-in-users.model.js.map +0 -1
- package/models/method-response.model.js +0 -4
- package/models/method-response.model.js.map +0 -1
- package/models/method.model.d.ts +0 -9
- package/models/method.model.js +0 -4
- package/models/method.model.js.map +0 -1
- package/models/monitor-cpu.model.js +0 -4
- package/models/monitor-cpu.model.js.map +0 -1
- package/models/monitor-memory.model.d.ts +0 -15
- package/models/monitor-memory.model.js +0 -4
- package/models/monitor-memory.model.js.map +0 -1
- package/models/monitor-mongo.model.d.ts +0 -13
- package/models/monitor-mongo.model.js +0 -4
- package/models/monitor-mongo.model.js.map +0 -1
- package/models/notification.model.js +0 -4
- package/models/notification.model.js.map +0 -1
- package/models/pagination.model.d.ts +0 -10
- package/models/pagination.model.js +0 -24
- package/models/pagination.model.js.map +0 -1
- package/models/permission.model.d.ts +0 -12
- package/models/permission.model.js +0 -4
- package/models/permission.model.js.map +0 -1
- package/models/report-builder-dashboard-builder.model.d.ts +0 -25
- package/models/report-builder-dashboard-builder.model.js +0 -4
- package/models/report-builder-dashboard-builder.model.js.map +0 -1
- package/models/report-builder-library.model.d.ts +0 -17
- package/models/report-builder-library.model.js +0 -4
- package/models/report-builder-library.model.js.map +0 -1
- package/models/report-builder-report.model.d.ts +0 -98
- package/models/report-builder-report.model.js +0 -4
- package/models/report-builder-report.model.js.map +0 -1
- package/models/report-builder.model.d.ts +0 -61
- package/models/report-builder.model.js +0 -4
- package/models/report-builder.model.js.map +0 -1
- package/models/select-data-label.model.d.ts +0 -9
- package/models/select-data-label.model.js +0 -4
- package/models/select-data-label.model.js.map +0 -1
- package/models/server-response.model.d.ts +0 -5
- package/models/server-response.model.js +0 -4
- package/models/server-response.model.js.map +0 -1
- package/models/subscription.model.d.ts +0 -23
- package/models/subscription.model.js +0 -4
- package/models/subscription.model.js.map +0 -1
- package/models/support-ticket.model.d.ts +0 -72
- package/models/support-ticket.model.js +0 -4
- package/models/support-ticket.model.js.map +0 -1
- package/models/user-group.model.d.ts +0 -19
- package/models/user-group.model.js +0 -4
- package/models/user-group.model.js.map +0 -1
- package/models/user-guide.model.js +0 -4
- package/models/user-guide.model.js.map +0 -1
- package/models/user.model.d.ts +0 -70
- package/models/user.model.js +0 -4
- package/models/user.model.js.map +0 -1
- package/public_api.js +0 -75
- package/public_api.js.map +0 -1
- package/publications/app-status.d.ts +0 -2
- package/publications/app-status.js +0 -17
- package/publications/app-status.js.map +0 -1
- package/publications/cron-jobs.d.ts +0 -2
- package/publications/cron-jobs.js +0 -33
- package/publications/cron-jobs.js.map +0 -1
- package/publications/files.d.ts +0 -2
- package/publications/files.js +0 -37
- package/publications/files.js.map +0 -1
- package/publications/flags.d.ts +0 -2
- package/publications/flags.js +0 -23
- package/publications/flags.js.map +0 -1
- package/publications/logs.d.ts +0 -2
- package/publications/logs.js +0 -165
- package/publications/logs.js.map +0 -1
- package/publications/method-responses.d.ts +0 -2
- package/publications/method-responses.js +0 -17
- package/publications/method-responses.js.map +0 -1
- package/publications/notifications.d.ts +0 -2
- package/publications/notifications.js +0 -17
- package/publications/notifications.js.map +0 -1
- package/publications/report-builder-dashboard-builders.d.ts +0 -2
- package/publications/report-builder-dashboard-builders.js +0 -43
- package/publications/report-builder-dashboard-builders.js.map +0 -1
- package/publications/report-builder-libraries.d.ts +0 -2
- package/publications/report-builder-libraries.js +0 -90
- package/publications/report-builder-libraries.js.map +0 -1
- package/publications/report-builder-reports.d.ts +0 -2
- package/publications/report-builder-reports.js +0 -51
- package/publications/report-builder-reports.js.map +0 -1
- package/publications/super-admin.d.ts +0 -2
- package/publications/super-admin.js +0 -17
- package/publications/super-admin.js.map +0 -1
- package/publications/user-groups.d.ts +0 -1
- package/publications/user-groups.js +0 -17
- package/publications/user-groups.js.map +0 -1
- package/publications/user-guides.d.ts +0 -1
- package/publications/user-guides.js +0 -17
- package/publications/user-guides.js.map +0 -1
- package/server-app.d.ts +0 -52
- package/server-app.js +0 -739
- package/server-app.js.map +0 -1
- package/util/common.d.ts +0 -24
- package/util/common.js +0 -511
- package/util/common.js.map +0 -1
- package/util/schema-report-builder.d.ts +0 -6
- package/util/schema-report-builder.js +0 -453
- package/util/schema-report-builder.js.map +0 -1
- /package/{private → src/private}/email-templates/enrollment.html +0 -0
- /package/{private → src/private}/email-templates/forgot-password.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-modified.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket.html +0 -0
- /package/{private → src/private}/images/ResolveIO.png +0 -0
package/methods/logs.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.loadLogMethods = void 0;
|
|
40
|
-
var log_collection_1 = require("../collections/log.collection");
|
|
41
|
-
var log_subscription_collection_1 = require("../collections/log-subscription.collection");
|
|
42
|
-
var index_1 = require("../index");
|
|
43
|
-
var log_method_latency_collection_1 = require("../collections/log-method-latency.collection");
|
|
44
|
-
var mongo_manager_1 = require("../managers/mongo.manager");
|
|
45
|
-
function loadLogMethods(methodManager) {
|
|
46
|
-
methodManager.methods({
|
|
47
|
-
insertErrorLog: {
|
|
48
|
-
function: function (message, data) {
|
|
49
|
-
this.sendEmail('dev@resolveio.com', 'Error Detected - ' + index_1.ResolveIOServer.getClientName(), this.user + '\n' + message + '\n' + JSON.stringify(data, null, 2));
|
|
50
|
-
return log_collection_1.Logs.insertOne({
|
|
51
|
-
_id: (0, mongo_manager_1.objectIdHexString)(),
|
|
52
|
-
type: 'error',
|
|
53
|
-
collection: '',
|
|
54
|
-
id_document: '',
|
|
55
|
-
payload: JSON.stringify(data, null, 2),
|
|
56
|
-
method: '',
|
|
57
|
-
id_user: this.id_user || '',
|
|
58
|
-
user: this.user || '',
|
|
59
|
-
messageId: 0,
|
|
60
|
-
route: ''
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
skipValidation: true
|
|
64
|
-
},
|
|
65
|
-
insertSubscriptionLog: {
|
|
66
|
-
function: function (type, subscription, collection_name, subData) {
|
|
67
|
-
return log_subscription_collection_1.LogSubscriptions.create({
|
|
68
|
-
_id: (0, mongo_manager_1.objectIdHexString)(),
|
|
69
|
-
__v: 0,
|
|
70
|
-
date: new Date(),
|
|
71
|
-
type: type,
|
|
72
|
-
subscription: subscription,
|
|
73
|
-
collection_name: collection_name,
|
|
74
|
-
subData: subData
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
skipValidation: true
|
|
78
|
-
},
|
|
79
|
-
insertMethodLatencyLog: {
|
|
80
|
-
function: function (method) {
|
|
81
|
-
return log_method_latency_collection_1.LogMethodLatencies.create({
|
|
82
|
-
_id: (0, mongo_manager_1.objectIdHexString)(),
|
|
83
|
-
__v: 0,
|
|
84
|
-
date_start: new Date(),
|
|
85
|
-
date_end: null,
|
|
86
|
-
latency_ms: 0,
|
|
87
|
-
method: method
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
skipValidation: true
|
|
91
|
-
},
|
|
92
|
-
superadminAPM: {
|
|
93
|
-
function: function (date_start, date_end, graphInterval) {
|
|
94
|
-
var _this = this;
|
|
95
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
96
|
-
var latencies, subscriptions, groupId, groupSort, methodGraphData, subGraphData;
|
|
97
|
-
return __generator(this, function (_a) {
|
|
98
|
-
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
100
|
-
{
|
|
101
|
-
$match: {
|
|
102
|
-
$and: [
|
|
103
|
-
{
|
|
104
|
-
createdAt: { $gte: date_start }
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
createdAt: { $lte: date_end }
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
$group: {
|
|
114
|
-
_id: '$method',
|
|
115
|
-
method: { $first: '$method' },
|
|
116
|
-
count: { $sum: 1 },
|
|
117
|
-
latency_min: { $min: '$latency_ms' },
|
|
118
|
-
latency_avg: { $avg: '$latency_ms' },
|
|
119
|
-
latency_max: { $max: '$latency_ms' }
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
], { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
123
|
-
case 1:
|
|
124
|
-
latencies = _a.sent();
|
|
125
|
-
return [4 /*yield*/, log_subscription_collection_1.LogSubscriptions.aggregate([
|
|
126
|
-
{
|
|
127
|
-
$match: {
|
|
128
|
-
$and: [
|
|
129
|
-
{
|
|
130
|
-
createdAt: { $gte: date_start }
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
createdAt: { $lte: date_end }
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
$group: {
|
|
140
|
-
_id: '$subscription',
|
|
141
|
-
subscription: { $first: '$subscription' },
|
|
142
|
-
count: { $sum: 1 }
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
], { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
146
|
-
case 2:
|
|
147
|
-
subscriptions = _a.sent();
|
|
148
|
-
groupId = {};
|
|
149
|
-
groupSort = {};
|
|
150
|
-
if (graphInterval === 'seconds') {
|
|
151
|
-
groupId = {
|
|
152
|
-
second: {
|
|
153
|
-
$second: {
|
|
154
|
-
date: '$createdAt',
|
|
155
|
-
timezone: process.env.TZ
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
minute: {
|
|
159
|
-
$minute: {
|
|
160
|
-
date: '$createdAt',
|
|
161
|
-
timezone: process.env.TZ
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
hour: {
|
|
165
|
-
$hour: {
|
|
166
|
-
date: '$createdAt',
|
|
167
|
-
timezone: process.env.TZ
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
day: {
|
|
171
|
-
$dayOfMonth: {
|
|
172
|
-
date: '$createdAt',
|
|
173
|
-
timezone: process.env.TZ
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
month: {
|
|
177
|
-
$month: {
|
|
178
|
-
date: '$createdAt',
|
|
179
|
-
timezone: process.env.TZ
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
year: {
|
|
183
|
-
$year: {
|
|
184
|
-
date: '$createdAt',
|
|
185
|
-
timezone: process.env.TZ
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
groupSort = {
|
|
190
|
-
'_id.year': 1,
|
|
191
|
-
'_id.month': 1,
|
|
192
|
-
'_id.day': 1,
|
|
193
|
-
'_id.hour': 1,
|
|
194
|
-
'_id.minute': 1,
|
|
195
|
-
'_id.second': 1
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
else if (graphInterval === 'minutes') {
|
|
199
|
-
groupId = {
|
|
200
|
-
minute: {
|
|
201
|
-
$minute: {
|
|
202
|
-
date: '$createdAt',
|
|
203
|
-
timezone: process.env.TZ
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
hour: {
|
|
207
|
-
$hour: {
|
|
208
|
-
date: '$createdAt',
|
|
209
|
-
timezone: process.env.TZ
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
day: {
|
|
213
|
-
$dayOfMonth: {
|
|
214
|
-
date: '$createdAt',
|
|
215
|
-
timezone: process.env.TZ
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
month: {
|
|
219
|
-
$month: {
|
|
220
|
-
date: '$createdAt',
|
|
221
|
-
timezone: process.env.TZ
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
year: {
|
|
225
|
-
$year: {
|
|
226
|
-
date: '$createdAt',
|
|
227
|
-
timezone: process.env.TZ
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
groupSort = {
|
|
232
|
-
'_id.year': 1,
|
|
233
|
-
'_id.month': 1,
|
|
234
|
-
'_id.day': 1,
|
|
235
|
-
'_id.hour': 1,
|
|
236
|
-
'_id.minute': 1
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
else if (graphInterval === 'hours') {
|
|
240
|
-
groupId = {
|
|
241
|
-
hour: {
|
|
242
|
-
$hour: {
|
|
243
|
-
date: '$createdAt',
|
|
244
|
-
timezone: process.env.TZ
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
day: {
|
|
248
|
-
$dayOfMonth: {
|
|
249
|
-
date: '$createdAt',
|
|
250
|
-
timezone: process.env.TZ
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
month: {
|
|
254
|
-
$month: {
|
|
255
|
-
date: '$createdAt',
|
|
256
|
-
timezone: process.env.TZ
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
year: {
|
|
260
|
-
$year: {
|
|
261
|
-
date: '$createdAt',
|
|
262
|
-
timezone: process.env.TZ
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
groupSort = {
|
|
267
|
-
'_id.year': 1,
|
|
268
|
-
'_id.month': 1,
|
|
269
|
-
'_id.day': 1,
|
|
270
|
-
'_id.hour': 1
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
groupId = {
|
|
275
|
-
day: {
|
|
276
|
-
$dayOfMonth: {
|
|
277
|
-
date: '$createdAt',
|
|
278
|
-
timezone: process.env.TZ
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
month: {
|
|
282
|
-
$month: {
|
|
283
|
-
date: '$createdAt',
|
|
284
|
-
timezone: process.env.TZ
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
year: {
|
|
288
|
-
$year: {
|
|
289
|
-
date: '$createdAt',
|
|
290
|
-
timezone: process.env.TZ
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
groupSort = {
|
|
295
|
-
'_id.year': 1,
|
|
296
|
-
'_id.month': 1,
|
|
297
|
-
'_id.day': 1
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
301
|
-
{
|
|
302
|
-
$match: {
|
|
303
|
-
$and: [
|
|
304
|
-
{
|
|
305
|
-
createdAt: { $gte: date_start }
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
createdAt: { $lte: date_end }
|
|
309
|
-
}
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
$group: {
|
|
315
|
-
_id: groupId,
|
|
316
|
-
count: {
|
|
317
|
-
$sum: 1
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
$sort: groupSort
|
|
323
|
-
}
|
|
324
|
-
], { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
325
|
-
case 3:
|
|
326
|
-
methodGraphData = _a.sent();
|
|
327
|
-
return [4 /*yield*/, log_subscription_collection_1.LogSubscriptions.aggregate([
|
|
328
|
-
{
|
|
329
|
-
$match: {
|
|
330
|
-
$and: [
|
|
331
|
-
{
|
|
332
|
-
createdAt: { $gte: date_start }
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
createdAt: { $lte: date_end }
|
|
336
|
-
}
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
$group: {
|
|
342
|
-
_id: groupId,
|
|
343
|
-
count: {
|
|
344
|
-
$sum: 1
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
$sort: groupSort
|
|
350
|
-
}
|
|
351
|
-
], { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
352
|
-
case 4:
|
|
353
|
-
subGraphData = _a.sent();
|
|
354
|
-
resolve({
|
|
355
|
-
methods: latencies,
|
|
356
|
-
subscriptions: subscriptions,
|
|
357
|
-
methodGraphData: methodGraphData,
|
|
358
|
-
subGraphData: subGraphData
|
|
359
|
-
});
|
|
360
|
-
return [2 /*return*/];
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
}); });
|
|
364
|
-
},
|
|
365
|
-
skipValidation: true
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
exports.loadLogMethods = loadLogMethods;
|
|
370
|
-
|
|
371
|
-
//# sourceMappingURL=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AI,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,EAAA;;gCAxB/H,YAAY,GAAG,SAwBgH;gCAEnI,OAAO,CAAC;oCACP,OAAO,EAAE,SAAS;oCAClB,aAAa,EAAE,aAAa;oCAC5B,eAAe,EAAE,eAAe;oCAChC,YAAY,EAAE,YAAY;iCAC1B,CAAC,CAAC;;;;qBACH,CAAC,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,IAAI;SACpB;KACD,CAAC,CAAC;AACJ,CAAC;AA/TD,wCA+TC","file":"logs.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { Logs } from '../collections/log.collection';\nimport { LogSubscriptions } from '../collections/log-subscription.collection';\nimport { ResolveIOServer } from '../index';\nimport { LogMethodLatencies } from '../collections/log-method-latency.collection';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadLogMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tinsertErrorLog: {\n\t\t\tfunction: function(message, data) {\n\t\t\t\tthis.sendEmail('dev@resolveio.com', 'Error Detected - ' + ResolveIOServer.getClientName(), this.user + '\\n' + message + '\\n' + JSON.stringify(data, null, 2));\n\n\t\t\t\treturn Logs.insertOne({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'error',\n\t\t\t\t\tcollection: '',\n\t\t\t\t\tid_document: '',\n\t\t\t\t\tpayload: JSON.stringify(data, null, 2),\n\t\t\t\t\tmethod: '',\n\t\t\t\t\tid_user: this.id_user || '',\n\t\t\t\t\tuser: this.user || '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: ''\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertSubscriptionLog: {\n\t\t\tfunction: function(type, subscription, collection_name, subData) {\n\t\t\t\treturn LogSubscriptions.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate: new Date(),\n\t\t\t\t\ttype: type,\n\t\t\t\t\tsubscription: subscription,\n\t\t\t\t\tcollection_name: collection_name,\n\t\t\t\t\tsubData: subData\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertMethodLatencyLog: {\n\t\t\tfunction: function(method) {\n\t\t\t\treturn LogMethodLatencies.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate_start: new Date(),\n\t\t\t\t\tdate_end: null,\n\t\t\t\t\tlatency_ms: 0,\n\t\t\t\t\tmethod: method\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tsuperadminAPM: {\n\t\t\tfunction: function(date_start: Date, date_end: Date, graphInterval) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet latencies = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$method',\n\t\t\t\t\t\t\t\tmethod: {$first: '$method'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1},\n\t\t\t\t\t\t\t\tlatency_min: {$min: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_avg: {$avg: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_max: {$max: '$latency_ms'}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subscriptions = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$subscription',\n\t\t\t\t\t\t\t\tsubscription: {$first: '$subscription'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupSort = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1,\n\t\t\t\t\t\t\t'_id.second': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tlet methodGraphData = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subGraphData = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve({\n\t\t\t\t\t\tmethods: latencies,\n\t\t\t\t\t\tsubscriptions: subscriptions,\n\t\t\t\t\t\tmethodGraphData: methodGraphData,\n\t\t\t\t\t\tsubGraphData: subGraphData\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t}\n\t});\n}"]}
|
package/methods/monitor.d.ts
DELETED