refactor: Remove unused "Model" dependency from package.json files

This commit is contained in:
Simon Larsen 2024-08-05 14:58:52 -06:00
parent b1c3a9e3c8
commit ea3c357be1
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
16 changed files with 64 additions and 34 deletions

View File

@ -27,14 +27,12 @@
}, },
"dependencies": { "dependencies": {
"Common": "file:../Common", "Common": "file:../Common",
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"CommonUI": "file:../CommonUI", "CommonUI": "file:../CommonUI",
"css-loader": "^6.11.0", "css-loader": "^6.11.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"Model": "file:../Model",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-router-dom": "^6.23.1", "react-router-dom": "^6.23.1",

View File

@ -9,7 +9,6 @@
"CommonUI": "file:../CommonUI", "CommonUI": "file:../CommonUI",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"Model": "file:../Model",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-router-dom": "^6.23.1", "react-router-dom": "^6.23.1",

View File

@ -104,7 +104,8 @@ RunCron(
try { try {
if ( if (
!monitor.monitorSteps || !monitor.monitorSteps ||
monitor.monitorSteps.data?.monitorStepsInstanceArray.length === 0 !monitor.monitorSteps.data?.monitorStepsInstanceArray?.length ||
monitor.monitorSteps.data.monitorStepsInstanceArray.length === 0
) { ) {
logger.debug("Monitor has no steps. Skipping..."); logger.debug("Monitor has no steps. Skipping...");
continue; continue;
@ -113,7 +114,7 @@ RunCron(
monitorResponses.push( monitorResponses.push(
monitorTelemetryMonitor({ monitorTelemetryMonitor({
monitorStep: monitorStep:
monitor.monitorSteps.data?.monitorStepsInstanceArray[0]!, monitor.monitorSteps.data!.monitorStepsInstanceArray[0]!,
monitorType: monitor.monitorType!, monitorType: monitor.monitorType!,
monitorId: monitor.id!, monitorId: monitor.id!,
}), }),
@ -135,7 +136,13 @@ RunCron(
}, },
); );
const monitorTelemetryMonitor = async (data: { type MonitorTelemetryMonitorFunction = (data: {
monitorStep: MonitorStep;
monitorType: MonitorType;
monitorId: ObjectID;
}) => Promise<LogMonitorResponse>;
const monitorTelemetryMonitor: MonitorTelemetryMonitorFunction = async (data: {
monitorStep: MonitorStep; monitorStep: MonitorStep;
monitorType: MonitorType; monitorType: MonitorType;
monitorId: ObjectID; monitorId: ObjectID;
@ -152,7 +159,12 @@ const monitorTelemetryMonitor = async (data: {
throw new BadDataException("Monitor type is not supported"); throw new BadDataException("Monitor type is not supported");
}; };
const monitorLogs = async (data: { type MonitorLogsFunction = (data: {
monitorStep: MonitorStep;
monitorId: ObjectID;
}) => Promise<LogMonitorResponse>;
const monitorLogs: MonitorLogsFunction = async (data: {
monitorStep: MonitorStep; monitorStep: MonitorStep;
monitorId: ObjectID; monitorId: ObjectID;
}): Promise<LogMonitorResponse> => { }): Promise<LogMonitorResponse> => {

3
App/package-lock.json generated
View File

@ -14,7 +14,6 @@
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"ejs": "^3.1.9", "ejs": "^3.1.9",
"handlebars": "^4.7.8", "handlebars": "^4.7.8",
"Model": "file:../Model",
"nodemailer": "^6.9.7", "nodemailer": "^6.9.7",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"twilio": "^4.20.0", "twilio": "^4.20.0",
@ -82,7 +81,6 @@
"airtable": "^0.12.2", "airtable": "^0.12.2",
"bullmq": "^5.3.3", "bullmq": "^5.3.3",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cors": "^2.8.5", "cors": "^2.8.5",
"cron-parser": "^4.8.1", "cron-parser": "^4.8.1",
@ -94,7 +92,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"marked": "^12.0.2", "marked": "^12.0.2",
"Model": "file:../Model",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"nodemailer": "^6.9.10", "nodemailer": "^6.9.10",
"pg": "^8.7.3", "pg": "^8.7.3",

View File

@ -0,0 +1,31 @@
import DataToProcess from "../DataToProcess";
import CompareCriteria from "./CompareCriteria";
import { CheckOn, CriteriaFilter } from "Common/Types/Monitor/CriteriaFilter";
import LogMonitorResponse from "Common/Types/Monitor/LogMonitor/LogMonitorResponse";
export default class LogMonitorCriteria {
public static async isMonitorInstanceCriteriaFilterMet(input: {
dataToProcess: DataToProcess;
criteriaFilter: CriteriaFilter;
}): Promise<string | null> {
// Server Monitoring Checks
let threshold: number | string | undefined | null =
input.criteriaFilter.value;
if (input.criteriaFilter.checkOn === CheckOn.LogCount) {
threshold = CompareCriteria.convertToNumber(threshold);
const currentLogCount: number =
(input.dataToProcess as LogMonitorResponse).logCount || 0;
return CompareCriteria.compareCriteriaNumbers({
value: currentLogCount,
threshold: threshold as number,
criteriaFilter: input.criteriaFilter,
});
}
return null;
}
}

View File

@ -49,6 +49,7 @@ import MonitorProbe from "Common/Models/DatabaseModels/MonitorProbe";
import MonitorStatusTimeline from "Common/Models/DatabaseModels/MonitorStatusTimeline"; import MonitorStatusTimeline from "Common/Models/DatabaseModels/MonitorStatusTimeline";
import OnCallDutyPolicy from "Common/Models/DatabaseModels/OnCallDutyPolicy"; import OnCallDutyPolicy from "Common/Models/DatabaseModels/OnCallDutyPolicy";
import OneUptimeDate from "Common/Types/Date"; import OneUptimeDate from "Common/Types/Date";
import LogMonitorCriteria from "./Criteria/LogMonitorCriteria";
export default class MonitorResourceUtil { export default class MonitorResourceUtil {
public static async monitorResource( public static async monitorResource(
@ -1202,6 +1203,19 @@ export default class MonitorResourceUtil {
} }
} }
if (input.monitor.monitorType === MonitorType.Logs) {
// check server monitor
const logMonitorResult: string | null =
await LogMonitorCriteria.isMonitorInstanceCriteriaFilterMet({
dataToProcess: input.dataToProcess,
criteriaFilter: input.criteriaFilter,
});
if (logMonitorResult) {
return logMonitorResult;
}
}
return null; return null;
} }
} }

View File

@ -32,7 +32,6 @@
"airtable": "^0.12.2", "airtable": "^0.12.2",
"bullmq": "^5.3.3", "bullmq": "^5.3.3",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cors": "^2.8.5", "cors": "^2.8.5",
"cron-parser": "^4.8.1", "cron-parser": "^4.8.1",
@ -44,7 +43,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"marked": "^12.0.2", "marked": "^12.0.2",
"Model": "file:../Model",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"nodemailer": "^6.9.10", "nodemailer": "^6.9.10",
"otpauth": "^9.3.1", "otpauth": "^9.3.1",

View File

@ -32,12 +32,10 @@
"@types/react-highlight": "^0.12.8", "@types/react-highlight": "^0.12.8",
"@types/react-syntax-highlighter": "^15.5.13", "@types/react-syntax-highlighter": "^15.5.13",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"formik": "^2.4.6", "formik": "^2.4.6",
"history": "^5.3.0", "history": "^5.3.0",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"Model": "file:../Model",
"moment-timezone": "^0.5.45", "moment-timezone": "^0.5.45",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",

View File

@ -19,7 +19,6 @@
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"Model": "file:../Model",
"openai": "^4.52.5", "openai": "^4.52.5",
"ts-node": "^10.9.1" "ts-node": "^10.9.1"
}, },

View File

@ -36,7 +36,6 @@
"CommonUI": "file:../CommonUI", "CommonUI": "file:../CommonUI",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"Model": "file:../Model",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-router-dom": "^6.23.0", "react-router-dom": "^6.23.0",

View File

@ -84,7 +84,7 @@ const LogMonitorStepForm: FunctionComponent<ComponentProps> = (
value: 86400, value: 86400,
}, },
], ],
title: "Monitor Last X Time of Logs", title: "Monitor Logs for Last",
isAdvancedFilter: true, isAdvancedFilter: true,
}, },
{ {
@ -96,7 +96,7 @@ const LogMonitorStepForm: FunctionComponent<ComponentProps> = (
isAdvancedFilter: true, isAdvancedFilter: true,
}, },
{ {
key: "telemetryServiceId", key: "telemetryServiceIds",
type: FieldType.MultiSelectDropdown, type: FieldType.MultiSelectDropdown,
filterDropdownOptions: props.telemetryServices.map( filterDropdownOptions: props.telemetryServices.map(
(telemetryService: TelemetryService) => { (telemetryService: TelemetryService) => {

View File

@ -19,7 +19,6 @@
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"Model": "file:../Model",
"protobufjs": "^7.3.2", "protobufjs": "^7.3.2",
"ts-node": "^10.9.1" "ts-node": "^10.9.1"
}, },

View File

@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"Common": "file:../Common", "Common": "file:../Common",
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"Model": "file:../Model",
"ts-node": "^10.9.1" "ts-node": "^10.9.1"
}, },
"devDependencies": { "devDependencies": {
@ -67,7 +66,6 @@
"airtable": "^0.12.2", "airtable": "^0.12.2",
"bullmq": "^5.3.3", "bullmq": "^5.3.3",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cors": "^2.8.5", "cors": "^2.8.5",
"cron-parser": "^4.8.1", "cron-parser": "^4.8.1",
@ -79,7 +77,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"marked": "^12.0.2", "marked": "^12.0.2",
"Model": "file:../Model",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"nodemailer": "^6.9.10", "nodemailer": "^6.9.10",
"pg": "^8.7.3", "pg": "^8.7.3",

View File

@ -14,7 +14,6 @@
"Common": "file:../Common", "Common": "file:../Common",
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"Model": "file:../Model",
"ping": "^0.4.4", "ping": "^0.4.4",
"playwright": "^1.45.1", "playwright": "^1.45.1",
"ts-node": "^10.9.1" "ts-node": "^10.9.1"
@ -76,7 +75,6 @@
"airtable": "^0.12.2", "airtable": "^0.12.2",
"bullmq": "^5.3.3", "bullmq": "^5.3.3",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cors": "^2.8.5", "cors": "^2.8.5",
"cron-parser": "^4.8.1", "cron-parser": "^4.8.1",
@ -88,7 +86,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"marked": "^12.0.2", "marked": "^12.0.2",
"Model": "file:../Model",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"nodemailer": "^6.9.10", "nodemailer": "^6.9.10",
"pg": "^8.7.3", "pg": "^8.7.3",

View File

@ -13,7 +13,6 @@
"CommonServer": "file:../CommonServer", "CommonServer": "file:../CommonServer",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"Model": "file:../Model",
"ts-node": "^10.9.2" "ts-node": "^10.9.2"
}, },
"devDependencies": { "devDependencies": {
@ -84,7 +83,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"Model": "file:../Model",
"node-device-detector": "^2.0.0", "node-device-detector": "^2.0.0",
"nodemailer": "^6.7.3", "nodemailer": "^6.7.3",
"nodemailer-express-handlebars": "^5.0.0", "nodemailer-express-handlebars": "^5.0.0",
@ -5715,7 +5713,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"Model": "file:../Model",
"node-device-detector": "^2.0.0", "node-device-detector": "^2.0.0",
"nodemailer": "^6.7.3", "nodemailer": "^6.7.3",
"nodemailer-express-handlebars": "^5.0.0", "nodemailer-express-handlebars": "^5.0.0",

View File

@ -15,7 +15,6 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"Model": "file:../Model",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-router-dom": "^6.23.1", "react-router-dom": "^6.23.1",
@ -4651,7 +4650,6 @@
"airtable": "^0.12.2", "airtable": "^0.12.2",
"bullmq": "^5.3.3", "bullmq": "^5.3.3",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cors": "^2.8.5", "cors": "^2.8.5",
"cron-parser": "^4.8.1", "cron-parser": "^4.8.1",
@ -4663,7 +4661,6 @@
"json2csv": "^5.0.7", "json2csv": "^5.0.7",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"marked": "^12.0.2", "marked": "^12.0.2",
"Model": "file:../Model",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"nodemailer": "^6.9.10", "nodemailer": "^6.9.10",
"pg": "^8.7.3", "pg": "^8.7.3",
@ -12484,12 +12481,10 @@
"@types/react-highlight": "^0.12.8", "@types/react-highlight": "^0.12.8",
"@types/react-syntax-highlighter": "^15.5.13", "@types/react-syntax-highlighter": "^15.5.13",
"Common": "file:../Common", "Common": "file:../Common",
"CommonProject": "file:../CommonProject",
"formik": "^2.4.6", "formik": "^2.4.6",
"history": "^5.3.0", "history": "^5.3.0",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"Model": "file:../Model",
"moment-timezone": "^0.5.45", "moment-timezone": "^0.5.45",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"react": "^18.3.1", "react": "^18.3.1",