From b750e514ad4d6a47b9f4a4a28175380752a165a0 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Fri, 15 Apr 2022 16:22:42 +0100 Subject: [PATCH] fix --- Accounts/src/Reducers/changePassword.ts | 5 ++- Accounts/src/Reducers/login.ts | 5 ++- Accounts/src/Reducers/register.ts | 5 ++- Accounts/src/Reducers/resendToken.ts | 5 ++- Accounts/src/Reducers/resetPassword.ts | 5 ++- AdminDashboard/src/Reducers/notifications.ts | 2 +- AdminDashboard/src/Reducers/probe.ts | 5 ++- Backend/workers/serverMonitor.ts | 6 +-- Common/Types/API/URL.ts | 4 +- Common/Types/Domain.ts | 2 +- Common/Types/EmailWithName.ts | 2 +- Common/Types/Html.ts | 2 +- Common/Types/JSON.ts | 4 +- Common/Types/Name.ts | 8 ++-- Common/Types/Port.ts | 4 +- CommonServer/Services/AirtableService.ts | 12 +++--- CommonServer/Services/DatabaseService.ts | 4 +- CommonServer/Services/ErrorEventService.ts | 2 +- CommonServer/Services/IncidentService.ts | 2 +- .../Services/IncomingRequestService.ts | 12 +++--- .../Services/ScheduledEventService.ts | 5 +-- CommonServer/Services/SsoService.ts | 2 +- CommonServer/Services/StripeService.ts | 10 ++--- Dashboard/src/Actions/Base/base.ts | 18 ++++----- Dashboard/src/Reducers/callRouting.ts | 5 ++- Dashboard/src/Reducers/card.ts | 5 ++- Dashboard/src/Reducers/changePassword.ts | 5 ++- Dashboard/src/Reducers/dateTime.ts | 5 ++- Dashboard/src/Reducers/emailTemplates.ts | 5 ++- Dashboard/src/Reducers/groups.ts | 5 ++- Dashboard/src/Reducers/incident.ts | 5 ++- Dashboard/src/Reducers/monitorCustomField.ts | 18 +++++---- Dashboard/src/Reducers/monitorSla.ts | 37 +++++++++++-------- Dashboard/src/Reducers/notifications.ts | 8 ++-- Dashboard/src/Reducers/probe.ts | 5 ++- Dashboard/src/Reducers/project.ts | 5 ++- Dashboard/src/Reducers/report.ts | 5 ++- Dashboard/src/Reducers/resourceCategories.ts | 4 +- Dashboard/src/Reducers/schedule.ts | 5 ++- Dashboard/src/Reducers/search.ts | 5 ++- Dashboard/src/Reducers/security.ts | 13 ++++--- Dashboard/src/Reducers/smsTemplates.ts | 5 ++- Dashboard/src/Reducers/subProject.ts | 5 ++- Dashboard/src/Reducers/subscriber.ts | 7 +++- Dashboard/src/Utils/joinNames.ts | 2 +- Dashboard/src/Utils/paginate.ts | 4 +- Dashboard/src/Utils/secondsToHms.ts | 4 +- .../src/cli/server-monitor/bin/index.ts | 2 +- .../src/cli/server-monitor/lib/helpers.ts | 2 +- .../test/server-monitor.test.ts | 4 +- JavaScriptSDK/src/listener.ts | 16 +++++--- JavaScriptSDK/src/utils/hrTimer.ts | 12 +++--- JavaScriptSDK/src/utils/perfTimer.ts | 10 ++--- Mail/Services/MailService.ts | 3 +- ScriptRunner/utils/scriptSandbox.ts | 2 +- StatusPage/src/Reducer/status.ts | 2 +- StatusPage/src/Reducer/validateToken.ts | 5 ++- 57 files changed, 218 insertions(+), 138 deletions(-) diff --git a/Accounts/src/Reducers/changePassword.ts b/Accounts/src/Reducers/changePassword.ts index 90f27cf520..b762757886 100755 --- a/Accounts/src/Reducers/changePassword.ts +++ b/Accounts/src/Reducers/changePassword.ts @@ -12,7 +12,10 @@ const initialState: $TSFixMe = { success: false, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.CHANGEPASSWORD_REQUEST: return Object.assign({}, state, { diff --git a/Accounts/src/Reducers/login.ts b/Accounts/src/Reducers/login.ts index 9476a5306b..fba5adc84b 100755 --- a/Accounts/src/Reducers/login.ts +++ b/Accounts/src/Reducers/login.ts @@ -52,7 +52,10 @@ const initialState: $TSFixMe = { loginMethod: 'standard', }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case CHANGE_LOGIN: return Object.assign({}, state, { diff --git a/Accounts/src/Reducers/register.ts b/Accounts/src/Reducers/register.ts index 24f9a0ce01..8381fa61c4 100755 --- a/Accounts/src/Reducers/register.ts +++ b/Accounts/src/Reducers/register.ts @@ -47,7 +47,10 @@ const initialState: $TSFixMe = { email: null, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { let incCount: $TSFixMe, decCount: $TSFixMe, stage: $TSFixMe; switch (action.type) { case SIGNUP_REQUEST: diff --git a/Accounts/src/Reducers/resendToken.ts b/Accounts/src/Reducers/resendToken.ts index 713bef8a54..c3ea1fe79a 100755 --- a/Accounts/src/Reducers/resendToken.ts +++ b/Accounts/src/Reducers/resendToken.ts @@ -13,7 +13,10 @@ const initialState: $TSFixMe = { success: false, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case RESENDTOKEN_REQUEST: return Object.assign({}, state, { diff --git a/Accounts/src/Reducers/resetPassword.ts b/Accounts/src/Reducers/resetPassword.ts index 9a55fe35d6..e1876f280f 100755 --- a/Accounts/src/Reducers/resetPassword.ts +++ b/Accounts/src/Reducers/resetPassword.ts @@ -17,7 +17,10 @@ const initialState: $TSFixMe = { success: false, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case PASSWORDRESET_REQUEST: return Object.assign({}, state, { diff --git a/AdminDashboard/src/Reducers/notifications.ts b/AdminDashboard/src/Reducers/notifications.ts index 46413abbe1..cd25ffe882 100644 --- a/AdminDashboard/src/Reducers/notifications.ts +++ b/AdminDashboard/src/Reducers/notifications.ts @@ -94,7 +94,7 @@ export default (state: $TSFixMe = initialState, action: Action): void => { notifications: { ...state.notifications, notifications: state.notifications.notifications.map( - notification => { + (notification: $TSFixMe) => { if ( notification._id === action.payload.notificationId._id diff --git a/AdminDashboard/src/Reducers/probe.ts b/AdminDashboard/src/Reducers/probe.ts index a4e05a5cba..f431464d9b 100644 --- a/AdminDashboard/src/Reducers/probe.ts +++ b/AdminDashboard/src/Reducers/probe.ts @@ -29,7 +29,10 @@ const initialState: $TSFixMe = { }, }; -export default function probes(state: $TSFixMe = initialState, action: Action): void { +export default function probes( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.PROBE_SUCCESS: return Object.assign({}, state, { diff --git a/Backend/workers/serverMonitor.ts b/Backend/workers/serverMonitor.ts index 87aabc0f57..16a1222e58 100644 --- a/Backend/workers/serverMonitor.ts +++ b/Backend/workers/serverMonitor.ts @@ -1,8 +1,8 @@ import moment from 'moment'; const MonitorService: $TSFixMe = require('../Services/monitorService'), - MonitorLogService = require('../Services/monitorLogService'), - MonitorStatusService = require('../Services/monitorStatusService'), - ProbeService = require('../Services/probeService'); + MonitorLogService: $TSFixMe = require('../Services/monitorLogService'), + MonitorStatusService: $TSFixMe = require('../Services/monitorStatusService'), + ProbeService: $TSFixMe = require('../Services/probeService'); export default { checkAllServerMonitors: async () => { diff --git a/Common/Types/API/URL.ts b/Common/Types/API/URL.ts index 68aa10d009..fdd8338a41 100644 --- a/Common/Types/API/URL.ts +++ b/Common/Types/API/URL.ts @@ -37,11 +37,11 @@ export default class URL { } } - isHttps(): boolean { + public isHttps(): boolean { return this.protocol === Protocol.HTTPS; } - toString(): string { + public toString(): string { return `${this.protocol}${this.hostname}${this.route}`; } diff --git a/Common/Types/Domain.ts b/Common/Types/Domain.ts index c19d8630d7..556e25cbb0 100644 --- a/Common/Types/Domain.ts +++ b/Common/Types/Domain.ts @@ -48,7 +48,7 @@ export default class Domain { this.domain = domain; } - toString(): string { + public toString(): string { return this.domain; } } diff --git a/Common/Types/EmailWithName.ts b/Common/Types/EmailWithName.ts index cefbc8da13..cc0e65fe99 100644 --- a/Common/Types/EmailWithName.ts +++ b/Common/Types/EmailWithName.ts @@ -29,7 +29,7 @@ export default class EmailWithName { this.name = name; } - toString(): string { + public toString(): string { return `"${this.name}" <${this.email}>`; } } diff --git a/Common/Types/Html.ts b/Common/Types/Html.ts index c8a2448736..473e74c532 100644 --- a/Common/Types/Html.ts +++ b/Common/Types/Html.ts @@ -11,7 +11,7 @@ export default class HTML { this.html = html; } - toString(): string { + public toString(): string { return this.html; } } diff --git a/Common/Types/JSON.ts b/Common/Types/JSON.ts index f83216e424..3db5f3d721 100644 --- a/Common/Types/JSON.ts +++ b/Common/Types/JSON.ts @@ -22,11 +22,11 @@ export interface JSONObject { export interface JSONArray extends Array {} export class JSONFunctions { - toCompressedString(val: JSONValue): string { + public toCompressedString(val: JSONValue): string { return JSON.stringify(val, null, 2); } - toString(val: JSONValue): string { + public toString(val: JSONValue): string { return JSON.stringify(val); } } diff --git a/Common/Types/Name.ts b/Common/Types/Name.ts index 54833557e0..526f1a7725 100644 --- a/Common/Types/Name.ts +++ b/Common/Types/Name.ts @@ -19,11 +19,11 @@ export default class Name { this.name = name; } - getFirstName(): string { + public getFirstName(): string { return this.name.split(' ')[0] || ''; } - getLastName(): string { + public getLastName(): string { if (this.name.split(' ').length > 1) { return this.name.split(' ')[this.name.split(' ').length - 1] || ''; } else { @@ -31,7 +31,7 @@ export default class Name { } } - getMiddleName(): string { + public getMiddleName(): string { if (this.name.split(' ').length > 2) { return this.name.split(' ')[1] || ''; } else { @@ -39,7 +39,7 @@ export default class Name { } } - toString(): string { + public toString(): string { return this.name; } } diff --git a/Common/Types/Port.ts b/Common/Types/Port.ts index c1d791d679..1c15b05467 100644 --- a/Common/Types/Port.ts +++ b/Common/Types/Port.ts @@ -20,11 +20,11 @@ export default class Port { } } - toString(): string { + public toString(): string { return this.port.toString(); } - toNumber(): number { + public toNumber(): number { return this.port.toNumber(); } } diff --git a/CommonServer/Services/AirtableService.ts b/CommonServer/Services/AirtableService.ts index d0ae4e54e3..0d3a7e9618 100644 --- a/CommonServer/Services/AirtableService.ts +++ b/CommonServer/Services/AirtableService.ts @@ -20,7 +20,7 @@ export default class Service { return base(tableName).destroy(id); } - logUser({ + public logUser({ name, email, phone, @@ -44,7 +44,7 @@ export default class Service { }); } - logLeads({ + public logLeads({ name, country, email, @@ -74,7 +74,7 @@ export default class Service { }); } - deleteUser(airtableId: $TSFixMe): void { + public deleteUser(airtableId: $TSFixMe): void { if (!base) { return; } @@ -86,7 +86,7 @@ export default class Service { //Params: //Param 1: data: Feedback data (message, name, email, project, page). //Returns: promise - logFeedback({ message, name, email, project, page }: $TSFixMe): void { + public logFeedback({ message, name, email, project, page }: $TSFixMe): void { if (!base) { return; } @@ -100,7 +100,7 @@ export default class Service { }); } - deleteFeedback(airtableId: $TSFixMe): void { + public deleteFeedback(airtableId: $TSFixMe): void { if (!base) { return; } @@ -140,7 +140,7 @@ export default class Service { } } - logProjectDeletionFeedback({ + public logProjectDeletionFeedback({ reason, project, name, diff --git a/CommonServer/Services/DatabaseService.ts b/CommonServer/Services/DatabaseService.ts index 3053b09124..cd902cecd1 100644 --- a/CommonServer/Services/DatabaseService.ts +++ b/CommonServer/Services/DatabaseService.ts @@ -51,8 +51,8 @@ class DatabaseService { public memberItemProps: ItemProps; public memberListProps: ListProps; public model: Model; - publicItemProps: ItemProps; - publicListProps: ListProps; + public ItemProps: ItemProps; + public ListProps: ListProps; public requiredFields: RequiredFields; public uniqueFields: UniqueFields; public encryptedFields: EncryptedFields; diff --git a/CommonServer/Services/ErrorEventService.ts b/CommonServer/Services/ErrorEventService.ts index 4b97860b9b..f38eae6a87 100644 --- a/CommonServer/Services/ErrorEventService.ts +++ b/CommonServer/Services/ErrorEventService.ts @@ -217,7 +217,7 @@ export default class Service { } // sort total error events by latest occurence date - totalErrorEvents.sort((eventA, eventB) => { + totalErrorEvents.sort((eventA: $TSFixMe, eventB: $TSFixMe) => { return moment(eventB.latestOccurennce).isAfter( eventA.latestOccurennce ); diff --git a/CommonServer/Services/IncidentService.ts b/CommonServer/Services/IncidentService.ts index c321d26dfc..42d6272220 100755 --- a/CommonServer/Services/IncidentService.ts +++ b/CommonServer/Services/IncidentService.ts @@ -163,7 +163,7 @@ export default class Service { let incident: $TSFixMe = new IncidentModel(); let parentCount: $TSFixMe = 0, - deletedParentCount = 0; + deletedParentCount: $TSFixMe = 0; if (project && project.parentProjectId) { const [pCount, dpCount]: $TSFixMe = await Promise.all([ this.countBy({ diff --git a/CommonServer/Services/IncomingRequestService.ts b/CommonServer/Services/IncomingRequestService.ts index 4197bce945..623cc2c851 100644 --- a/CommonServer/Services/IncomingRequestService.ts +++ b/CommonServer/Services/IncomingRequestService.ts @@ -1073,8 +1073,8 @@ export default class Service { const incidentArray: $TSFixMe = []; for (const filter of updatedFilters) { const filterCriteria: $TSFixMe = filter.filterCriteria, - filterCondition = filter.filterCondition, - filterText = filter.filterText; + filterCondition: $TSFixMe = filter.filterCondition, + filterText: $TSFixMe = filter.filterText; if ( filterCriteria && @@ -1625,8 +1625,8 @@ export default class Service { const incidentArray: $TSFixMe = []; for (const filter of updatedFilters) { const filterCriteria: $TSFixMe = filter.filterCriteria, - filterCondition = filter.filterCondition, - filterText = filter.filterText; + filterCondition: $TSFixMe = filter.filterCondition, + filterText: $TSFixMe = filter.filterText; if ( filterCriteria && @@ -1901,8 +1901,8 @@ export default class Service { for (const field of incidentCustomFields) { const filterCriteria: $TSFixMe = filter.filterCriteria, - filterCondition = filter.filterCondition, - filterText = filter.filterText; + filterCondition: $TSFixMe = filter.filterCondition, + filterText: $TSFixMe = filter.filterText; if ( filterCriteria && diff --git a/CommonServer/Services/ScheduledEventService.ts b/CommonServer/Services/ScheduledEventService.ts index 1a2c8ed4ec..e869dad546 100755 --- a/CommonServer/Services/ScheduledEventService.ts +++ b/CommonServer/Services/ScheduledEventService.ts @@ -751,9 +751,8 @@ export default class Service { }); } - /** - * @description Create Ended note for all schedule events -async */ createScheduledEventEndedNote(): void { + +public async createScheduledEventEndedNote(): void { const currentTime: $TSFixMe = moment(); //fetch events that have ended diff --git a/CommonServer/Services/SsoService.ts b/CommonServer/Services/SsoService.ts index d96248b612..e3d99a331f 100644 --- a/CommonServer/Services/SsoService.ts +++ b/CommonServer/Services/SsoService.ts @@ -141,7 +141,7 @@ export default class Service { // grab the email from xml response // assuming there's only one email in the xml response // or the same email x times in the response - getEmail(xml: $TSFixMe): void { + public getEmail(xml: $TSFixMe): void { const stringifiedXml: $TSFixMe = String(xml); const regex: $TSFixMe = // eslint-disable-next-line no-control-regex diff --git a/CommonServer/Services/StripeService.ts b/CommonServer/Services/StripeService.ts index 3548ae9e1b..7297cff235 100755 --- a/CommonServer/Services/StripeService.ts +++ b/CommonServer/Services/StripeService.ts @@ -312,21 +312,21 @@ export default class StripeService { ); if (amountRechargedStripe) { const projectId: $TSFixMe = paymentIntent.metadata.projectId, - minimumBalance = + minimumBalance : $TSFixMe = paymentIntent.metadata.minimumBalance && Number(paymentIntent.metadata.minimumBalance), - rechargeToBalance = + rechargeToBalance: $TSFixMe = paymentIntent.metadata.rechargeToBalance && Number(paymentIntent.metadata.rechargeToBalance), - billingUS = + billingUS: $TSFixMe = paymentIntent.metadata.billingUS && JSON.parse(paymentIntent.metadata.billingUS), - billingNonUSCountries = + billingNonUSCountries: $TSFixMe = paymentIntent.metadata.billingNonUSCountries && JSON.parse( paymentIntent.metadata.billingNonUSCountries ), - billingRiskCountries = + billingRiskCountries: $TSFixMe = paymentIntent.metadata.billingRiskCountries && JSON.parse(paymentIntent.metadata.billingRiskCountries); diff --git a/Dashboard/src/Actions/Base/base.ts b/Dashboard/src/Actions/Base/base.ts index a84a804594..e77d14f1d6 100644 --- a/Dashboard/src/Actions/Base/base.ts +++ b/Dashboard/src/Actions/Base/base.ts @@ -3,13 +3,13 @@ import { getErrorMessageFromResponse } from '../../utils/error'; import { Dispatch } from 'redux'; import ErrorPayload from 'CommonUI/src/payload-types/error'; class BaseAction { - actionKeys: $TSFixMe; - actionType: $TSFixMe; - apiName: $TSFixMe; - constantKeys: $TSFixMe; - friendlyName: $TSFixMe; - isRequestAllowed: $TSFixMe; - isResourceInProject: $TSFixMe; + private actionKeys: $TSFixMe; + private actionType: $TSFixMe; + private apiName: $TSFixMe; + private constantKeys: $TSFixMe; + private friendlyName: $TSFixMe; + private isRequestAllowed: $TSFixMe; + private isResourceInProject: $TSFixMe; public constructor({ friendlyName, apiPath, @@ -43,7 +43,7 @@ class BaseAction { }; } - getConstants(): void { + public getConstants(): void { const friendlyName: $TSFixMe = this.friendlyName .replace(' ', '_') .toUpperCase(); @@ -88,7 +88,7 @@ class BaseAction { return constants; } - getActions(): void { + public getActions(): void { const constants: $TSFixMe = this.getConstants(); const actions: $TSFixMe = {}; diff --git a/Dashboard/src/Reducers/callRouting.ts b/Dashboard/src/Reducers/callRouting.ts index 72c0746db5..0d3f4ef3b8 100644 --- a/Dashboard/src/Reducers/callRouting.ts +++ b/Dashboard/src/Reducers/callRouting.ts @@ -78,7 +78,10 @@ const initialState: $TSFixMe = { }, }; -export default function card(state: $TSFixMe = initialState, action: Action): void { +export default function card( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.GET_CALL_ROUTING_NUMBERS_REQUEST: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/card.ts b/Dashboard/src/Reducers/card.ts index 05bfc5410c..127074784e 100755 --- a/Dashboard/src/Reducers/card.ts +++ b/Dashboard/src/Reducers/card.ts @@ -30,7 +30,10 @@ const initialState: $TSFixMe = { }, }; -export default function card(state: $TSFixMe = initialState, action: Action): void { +export default function card( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.ADD_CARD_REQUEST: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/changePassword.ts b/Dashboard/src/Reducers/changePassword.ts index 90f27cf520..b762757886 100755 --- a/Dashboard/src/Reducers/changePassword.ts +++ b/Dashboard/src/Reducers/changePassword.ts @@ -12,7 +12,10 @@ const initialState: $TSFixMe = { success: false, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.CHANGEPASSWORD_REQUEST: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/dateTime.ts b/Dashboard/src/Reducers/dateTime.ts index 2f5d4c31b8..58e1a6bada 100644 --- a/Dashboard/src/Reducers/dateTime.ts +++ b/Dashboard/src/Reducers/dateTime.ts @@ -9,7 +9,10 @@ const initialState: $TSFixMe = { }, }; -export default function dateTime(state: $TSFixMe = initialState, action: Action): void { +export default function dateTime( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case 'SET_START_DATE': return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/emailTemplates.ts b/Dashboard/src/Reducers/emailTemplates.ts index 334a866e4f..9deaff3989 100755 --- a/Dashboard/src/Reducers/emailTemplates.ts +++ b/Dashboard/src/Reducers/emailTemplates.ts @@ -35,7 +35,10 @@ const initialState: $TSFixMe = { showEmailSmtpConfiguration: false, }; -export default function incident(state: $TSFixMe = initialState, action: Action): void { +export default function incident( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.EMAIL_TEMPLATES_SUCCESS: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/groups.ts b/Dashboard/src/Reducers/groups.ts index 62c3f4fcce..8ed01fae32 100644 --- a/Dashboard/src/Reducers/groups.ts +++ b/Dashboard/src/Reducers/groups.ts @@ -12,7 +12,10 @@ const initialState: $TSFixMe = { oncallDuty: [], }; -export default function groups(state: $TSFixMe = initialState, action: Action): void { +export default function groups( + state: $TSFixMe = initialState, + action: Action +): void { let updatedGroup: $TSFixMe; switch (action.type) { case types.GET_GROUPS_REQUEST: diff --git a/Dashboard/src/Reducers/incident.ts b/Dashboard/src/Reducers/incident.ts index 54887b3ca3..37a4ce0142 100755 --- a/Dashboard/src/Reducers/incident.ts +++ b/Dashboard/src/Reducers/incident.ts @@ -84,7 +84,10 @@ const initialState: $TSFixMe = { activeIncident: null, }; -export default function incident(state: $TSFixMe = initialState, action: Action): void { +export default function incident( + state: $TSFixMe = initialState, + action: Action +): void { let incident: $TSFixMe, incidents: $TSFixMe, unresolvedincidents: $TSFixMe, diff --git a/Dashboard/src/Reducers/monitorCustomField.ts b/Dashboard/src/Reducers/monitorCustomField.ts index 8e7139b9ee..5a37bf2f73 100644 --- a/Dashboard/src/Reducers/monitorCustomField.ts +++ b/Dashboard/src/Reducers/monitorCustomField.ts @@ -71,7 +71,9 @@ export default function monitorCustomField( case types.DELETE_CUSTOM_FIELD_SUCCESS: { const fields: $TSFixMe = state.monitorCustomFields.fields.filter( - field => String(field._id) !== String(action.payload._id) + field => { + return String(field._id) !== String(action.payload._id); + } ); return { ...state, @@ -148,13 +150,15 @@ export default function monitorCustomField( }; case types.UPDATE_CUSTOM_FIELD_SUCCESS: { - const fields: $TSFixMe = state.monitorCustomFields.fields.map(field: $TSFixMe => { - if (String(field._id) === String(action.payload._id)) { - field = action.payload; - } + const fields: $TSFixMe = state.monitorCustomFields.fields.map( + (field: $TSFixMe) => { + if (String(field._id) === String(action.payload._id)) { + field = action.payload; + } - return field; - }); + return field; + } + ); return { ...state, monitorCustomFields: { diff --git a/Dashboard/src/Reducers/monitorSla.ts b/Dashboard/src/Reducers/monitorSla.ts index 0211c9a10c..ad7ede23d3 100644 --- a/Dashboard/src/Reducers/monitorSla.ts +++ b/Dashboard/src/Reducers/monitorSla.ts @@ -28,7 +28,10 @@ const initialState: $TSFixMe = { page: 1, }; -export default function monitorSla(state: $TSFixMe = initialState, action: Action): void { +export default function monitorSla( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.CREATE_MONITOR_SLA_REQUEST: return { @@ -76,9 +79,9 @@ export default function monitorSla(state: $TSFixMe = initialState, action: Actio }; case types.DELETE_MONITOR_SLA_SUCCESS: { - const slas: $TSFixMe = state.monitorSlas.slas.filter( - sla => String(sla._id) !== String(action.payload._id) - ); + const slas: $TSFixMe = state.monitorSlas.slas.filter(sla => { + return String(sla._id) !== String(action.payload._id); + }); return { ...state, monitorSlas: { @@ -184,20 +187,22 @@ export default function monitorSla(state: $TSFixMe = initialState, action: Actio }; case types.UPDATE_MONITOR_SLA_SUCCESS: { - const slas: $TSFixMe = state.monitorSlas.slas.map(sla: $TSFixMe => { - if ( - action.payload.isDefault && - String(sla._id) !== String(action.payload._id) - ) { - sla.isDefault = false; - } + const slas: $TSFixMe = state.monitorSlas.slas.map( + (sla: $TSFixMe) => { + if ( + action.payload.isDefault && + String(sla._id) !== String(action.payload._id) + ) { + sla.isDefault = false; + } - if (String(sla._id) === String(action.payload._id)) { - sla = action.payload; - } + if (String(sla._id) === String(action.payload._id)) { + sla = action.payload; + } - return sla; - }); + return sla; + } + ); return { ...state, monitorSlas: { diff --git a/Dashboard/src/Reducers/notifications.ts b/Dashboard/src/Reducers/notifications.ts index f2338e2136..aa25e4ccc3 100755 --- a/Dashboard/src/Reducers/notifications.ts +++ b/Dashboard/src/Reducers/notifications.ts @@ -97,7 +97,7 @@ export default (state: $TSFixMe = initialState, action: Action): void => { notifications: { ...state.notifications, notifications: state.notifications.notifications.map( - notification => { + (notification: $TSFixMe) => { if ( notification._id === action.payload.notificationId @@ -121,7 +121,7 @@ export default (state: $TSFixMe = initialState, action: Action): void => { notifications: { ...state.notifications, notifications: state.notifications.notifications.map( - notification => { + (notification: $TSFixMe) => { if ( notification._id === action.payload.notificationId @@ -145,7 +145,7 @@ export default (state: $TSFixMe = initialState, action: Action): void => { notifications: { ...state.notifications, notifications: state.notifications.notifications.map( - notification => { + (notification: $TSFixMe) => { return { ...notification, read: notification.read.concat([ @@ -162,7 +162,7 @@ export default (state: $TSFixMe = initialState, action: Action): void => { notifications: { ...state.notifications, notifications: state.notifications.notifications.filter( - notification => { + (notification: $TSFixMe) => { return notification.projectId !== action.payload; } ), diff --git a/Dashboard/src/Reducers/probe.ts b/Dashboard/src/Reducers/probe.ts index 13ee070da0..0082695528 100644 --- a/Dashboard/src/Reducers/probe.ts +++ b/Dashboard/src/Reducers/probe.ts @@ -14,7 +14,10 @@ const initialState: $TSFixMe = { }, }; -export default function probes(state: $TSFixMe = initialState, action: Action): void { +export default function probes( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.PROBE_SUCCESS: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/project.ts b/Dashboard/src/Reducers/project.ts index db486a4031..d4ebcee414 100755 --- a/Dashboard/src/Reducers/project.ts +++ b/Dashboard/src/Reducers/project.ts @@ -128,7 +128,10 @@ const initialState: $TSFixMe = { }, }; -export default function project(state: $TSFixMe = initialState, action: Action): void { +export default function project( + state: $TSFixMe = initialState, + action: Action +): void { let projects: $TSFixMe, newProjects: $TSFixMe; switch (action.type) { case types.CHANGE_DELETE_MODAL: diff --git a/Dashboard/src/Reducers/report.ts b/Dashboard/src/Reducers/report.ts index 030858cd6e..1f972430a9 100755 --- a/Dashboard/src/Reducers/report.ts +++ b/Dashboard/src/Reducers/report.ts @@ -31,7 +31,10 @@ const initialState: $TSFixMe = { }, }; -export default function incidents(state: $TSFixMe = initialState, action: Action): void { +export default function incidents( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.GET_ACTIVE_MEMBERS_REQUEST: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/resourceCategories.ts b/Dashboard/src/Reducers/resourceCategories.ts index 36521b1bf9..cde7b7ad81 100755 --- a/Dashboard/src/Reducers/resourceCategories.ts +++ b/Dashboard/src/Reducers/resourceCategories.ts @@ -193,7 +193,7 @@ export default function resourceCategory( ...state.resourceCategoryListForNewResource, resourceCategories: state.resourceCategoryListForNewResource.resourceCategories.filter( - resourceCategory => { + (resourceCategory: $TSFixMe) => { if (resourceCategory._id === action.payload) { return false; } else { @@ -206,7 +206,7 @@ export default function resourceCategory( ...state.resourceCategoryList, resourceCategories: state.resourceCategoryList.resourceCategories.filter( - resourceCategory => { + (resourceCategory: $TSFixMe) => { if (resourceCategory._id === action.payload) { return false; } else { diff --git a/Dashboard/src/Reducers/schedule.ts b/Dashboard/src/Reducers/schedule.ts index c50d6ff7d4..09a292a8ed 100755 --- a/Dashboard/src/Reducers/schedule.ts +++ b/Dashboard/src/Reducers/schedule.ts @@ -125,7 +125,10 @@ const initialState: $TSFixMe = { }, }; -export default function schedule(state: $TSFixMe = initialState, action: Action): void { +export default function schedule( + state: $TSFixMe = initialState, + action: Action +): void { let data: $TSFixMe, index: $TSFixMe, isExistingSchedule: $TSFixMe; switch (action.type) { case SCHEDULE_FETCH_SUCCESS: diff --git a/Dashboard/src/Reducers/search.ts b/Dashboard/src/Reducers/search.ts index b04b243b1a..9d32e4f53d 100644 --- a/Dashboard/src/Reducers/search.ts +++ b/Dashboard/src/Reducers/search.ts @@ -17,7 +17,10 @@ const initialState: $TSFixMe = { searchFieldVisible: false, }; -export default function search(state: $TSFixMe = initialState, action: Action): void { +export default function search( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case SHOW_SEARCH_BAR: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/security.ts b/Dashboard/src/Reducers/security.ts index a7970f9f6e..c5f68921ac 100644 --- a/Dashboard/src/Reducers/security.ts +++ b/Dashboard/src/Reducers/security.ts @@ -43,7 +43,10 @@ const initialState: $TSFixMe = { activeApplicationSecurity: '', }; -export default function security(state: $TSFixMe = initialState, action: Action): void { +export default function security( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.ADD_CONTAINER_SECURITY_REQUEST: return { @@ -97,7 +100,7 @@ export default function security(state: $TSFixMe = initialState, action: Action) const securities: $TSFixMe = state.containerSecurities.securities.length > 0 ? state.containerSecurities.securities.map( - (containerSecurity : $TSFixMe) =>{ + (containerSecurity: $TSFixMe) => { if ( String(containerSecurity._id) === String(action.payload._id) @@ -192,7 +195,7 @@ export default function security(state: $TSFixMe = initialState, action: Action) // update the list of container securities const securities: $TSFixMe = state.containerSecurities.securities.filter( - (containerSecurity : $TSFixMe) =>{ + (containerSecurity: $TSFixMe) => { return ( String(containerSecurity._id) !== String(action.payload._id) @@ -410,7 +413,7 @@ export default function security(state: $TSFixMe = initialState, action: Action) const securities: $TSFixMe = state.applicationSecurities.securities.length > 0 ? state.applicationSecurities.securities.map( - (applicationSecurity : $TSFixMe) =>{ + (applicationSecurity: $TSFixMe) => { if ( String(applicationSecurity._id) === String(action.payload._id) @@ -505,7 +508,7 @@ export default function security(state: $TSFixMe = initialState, action: Action) // update the list of application securities const securities: $TSFixMe = state.applicationSecurities.securities.filter( - (applicationSecurity : $TSFixMe) =>{ + (applicationSecurity: $TSFixMe) => { return ( String(applicationSecurity._id) !== String(action.payload._id) diff --git a/Dashboard/src/Reducers/smsTemplates.ts b/Dashboard/src/Reducers/smsTemplates.ts index ea856d0766..7abb26655a 100755 --- a/Dashboard/src/Reducers/smsTemplates.ts +++ b/Dashboard/src/Reducers/smsTemplates.ts @@ -35,7 +35,10 @@ const initialState: $TSFixMe = { showSmsSmtpConfiguration: false, }; -export default function incident(state: $TSFixMe = initialState, action: Action): void { +export default function incident( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.SMS_TEMPLATES_SUCCESS: return Object.assign({}, state, { diff --git a/Dashboard/src/Reducers/subProject.ts b/Dashboard/src/Reducers/subProject.ts index c902abe665..9123dd7a13 100755 --- a/Dashboard/src/Reducers/subProject.ts +++ b/Dashboard/src/Reducers/subProject.ts @@ -42,7 +42,10 @@ const initialState: $TSFixMe = { activeSubProject: null, }; -export default function subProject(state: $TSFixMe = initialState, action: Action): void { +export default function subProject( + state: $TSFixMe = initialState, + action: Action +): void { let subProjects: $TSFixMe, index: $TSFixMe; switch (action.type) { case types.SUBPROJECTS_SUCCESS: diff --git a/Dashboard/src/Reducers/subscriber.ts b/Dashboard/src/Reducers/subscriber.ts index c6cc1b7b42..371b23f839 100755 --- a/Dashboard/src/Reducers/subscriber.ts +++ b/Dashboard/src/Reducers/subscriber.ts @@ -40,7 +40,10 @@ const initialState: $TSFixMe = { }, }; -export default function subscriber(state: $TSFixMe = initialState, action: Action): void { +export default function subscriber( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.CREATE_SUBSCRIBER_RESET: return Object.assign({}, state, { @@ -127,7 +130,7 @@ export default function subscriber(state: $TSFixMe = initialState, action: Actio subscribers: { ...state.subscribers, subscribers: state.subscribers.subscribers.filter( - subscriber => { + (subscriber: $TSFixMe) => { return subscriber !== action.payload._id; } ), diff --git a/Dashboard/src/Utils/joinNames.ts b/Dashboard/src/Utils/joinNames.ts index 2533e82e1a..da335a2139 100644 --- a/Dashboard/src/Utils/joinNames.ts +++ b/Dashboard/src/Utils/joinNames.ts @@ -4,7 +4,7 @@ * @returns a string */ -const joinNames: Function = (acc: $TSFixMe = []): void => { +const joinNames: Function = (acc: $TSFixMe = [], arr: $TSFixMe): void => { if (!Array.isArray(arr)) { return ''; } diff --git a/Dashboard/src/Utils/paginate.ts b/Dashboard/src/Utils/paginate.ts index c1d5f548eb..6ac0d3d605 100644 --- a/Dashboard/src/Utils/paginate.ts +++ b/Dashboard/src/Utils/paginate.ts @@ -7,8 +7,8 @@ function paginate(items: $TSFixMe, page = 1, limit = 10): void { const offset: Function = (page - 1) * limit, - paginatedItems = items.slice(offset).slice(0, limit), - total_pages = Math.ceil(items.length / limit); + paginatedItems: $TSFixMe = items.slice(offset).slice(0, limit), + total_pages: $TSFixMe = Math.ceil(items.length / limit); return { pre_page: page - 1 ? page - 1 : null, next_page: total_pages > page ? page + 1 : null, diff --git a/Dashboard/src/Utils/secondsToHms.ts b/Dashboard/src/Utils/secondsToHms.ts index ebe926d99e..04446f1177 100644 --- a/Dashboard/src/Utils/secondsToHms.ts +++ b/Dashboard/src/Utils/secondsToHms.ts @@ -8,8 +8,8 @@ const secondsToHms: Function = (value: $TSFixMe): void => { if (!isNaN(value)) { value = Number(value); const hr: $TSFixMe = Math.floor(value / 3600), - min = Math.floor((value % 3600) / 60), - sec = Math.floor((value % 3600) % 60); + min: $TSFixMe = Math.floor((value % 3600) / 60), + sec: $TSFixMe = Math.floor((value % 3600) % 60); const formattedValue: string = `${hr > 0 ? `${hr} hr` : ''} ${ min > 0 diff --git a/JavaScriptSDK/src/cli/server-monitor/bin/index.ts b/JavaScriptSDK/src/cli/server-monitor/bin/index.ts index 8f47b56a26..c6304dfa49 100644 --- a/JavaScriptSDK/src/cli/server-monitor/bin/index.ts +++ b/JavaScriptSDK/src/cli/server-monitor/bin/index.ts @@ -88,7 +88,7 @@ const checkParams: Function = (params: $TSFixMe): void => { return new Promise((resolve: $TSFixMe) => { resolve( - params.reduce((promiseChain, param) => { + params.reduce((promiseChain: $TSFixMe, param: $TSFixMe) => { return promiseChain.then(() => { return getParamValue(params, param.name).then( (value: $TSFixMe) => { diff --git a/JavaScriptSDK/src/cli/server-monitor/lib/helpers.ts b/JavaScriptSDK/src/cli/server-monitor/lib/helpers.ts index eb34a4d28d..bff1204ad5 100644 --- a/JavaScriptSDK/src/cli/server-monitor/lib/helpers.ts +++ b/JavaScriptSDK/src/cli/server-monitor/lib/helpers.ts @@ -51,7 +51,7 @@ const get: Function = ( url: URL, key: $TSFixMe, success: $TSFixMe, - error = defaultErrorHandler + error: $TSFixMe = defaultErrorHandler ): void => { headers['apiKey'] = key; diff --git a/JavaScriptSDK/src/cli/server-monitor/test/server-monitor.test.ts b/JavaScriptSDK/src/cli/server-monitor/test/server-monitor.test.ts index 3bcd05d8cc..0f323cd120 100644 --- a/JavaScriptSDK/src/cli/server-monitor/test/server-monitor.test.ts +++ b/JavaScriptSDK/src/cli/server-monitor/test/server-monitor.test.ts @@ -16,9 +16,9 @@ import serverMonitor from '../lib/api'; const user: $TSFixMe = require('./test-utils').user; user.email = utils.generateRandomBusinessEmail(); -let token, projectId: ObjectID, apiKey: string, monitorId: $TSFixMe; +let token: $TSFixMe, projectId: ObjectID, apiKey: string, monitorId: $TSFixMe; const badProjectId: string = 'badProjectId', - badApiKey = 'badApiKey'; + badApiKey: $TSFixMe = 'badApiKey'; const invalidProjectId: string = utils.generateRandomString(); const timeout: $TSFixMe = 5000, monitor = { diff --git a/JavaScriptSDK/src/listener.ts b/JavaScriptSDK/src/listener.ts index 71efadbea0..9ce9bcc9cc 100644 --- a/JavaScriptSDK/src/listener.ts +++ b/JavaScriptSDK/src/listener.ts @@ -12,7 +12,11 @@ class OneUptimeListener { options: $TSFixMe; timelineObj: $TSFixMe; utilObj: $TSFixMe; - public constructor(eventId: $TSFixMe, isWindow: $TSFixMe, options: $TSFixMe) { + public constructor( + eventId: $TSFixMe, + isWindow: $TSFixMe, + options: $TSFixMe + ) { this.options = options; this.isWindow = isWindow; this.timelineObj = new OneUptimeTimelineManager(options); @@ -36,11 +40,11 @@ class OneUptimeListener { this._setUpFetchListener(); this._setUpXhrListener(); } -public getTimeline(): void { + public getTimeline(): void { // this always get the current state of the timeline array return this.timelineObj.getTimeline(); } -public clearTimeline(eventId: $TSFixMe): void { + public clearTimeline(eventId: $TSFixMe): void { // set a new eventId this.currentEventId = eventId; // this will reset the state of the timeline array @@ -101,7 +105,7 @@ public clearTimeline(eventId: $TSFixMe): void { } // not logging cus of timeout - public clearTimeout(this.keypressTimeout); + clearTimeout(this.keypressTimeout); this.keypressTimeout = setTimeout(() => { this.keypressTimeout = undefined; @@ -276,7 +280,7 @@ public clearTimeline(eventId: $TSFixMe): void { // add timeline to the stack this.timelineObj.addToTimeline(timelineObj); } -public logErrorEvent(content: $TSFixMe, category = 'exception'): void { + public logErrorEvent(content: $TSFixMe, category = 'exception'): void { const timelineObj: $TSFixMe = { category, data: { @@ -288,7 +292,7 @@ public logErrorEvent(content: $TSFixMe, category = 'exception'): void { // add timeline to the stack this.timelineObj.addToTimeline(timelineObj); } -public logCustomTimelineEvent(timelineObj: $TSFixMe): void { + public logCustomTimelineEvent(timelineObj: $TSFixMe): void { timelineObj.eventId = this.currentEventId; // add timeline to the stack diff --git a/JavaScriptSDK/src/utils/hrTimer.ts b/JavaScriptSDK/src/utils/hrTimer.ts index 015e546cc9..6ac56c79ba 100644 --- a/JavaScriptSDK/src/utils/hrTimer.ts +++ b/JavaScriptSDK/src/utils/hrTimer.ts @@ -11,12 +11,12 @@ class HrTimer { this.dataStore = new DataStore(this.apiUrl, this.appId, this.appKey); } - start = (id: $TSFixMe, log: $TSFixMe): void => { + public start(id: $TSFixMe, log: $TSFixMe): void { this.dataStore.setValue(id, log); return process.hrtime(); - }; + } - end = (id: $TSFixMe, startHrTime: $TSFixMe): void => { + public end(id: $TSFixMe, startHrTime: $TSFixMe): void { let elapsedHrTime: $TSFixMe = process.hrtime(startHrTime); elapsedHrTime = elapsedHrTime[0] * 1000 + elapsedHrTime[1] / 1e6; @@ -28,10 +28,10 @@ class HrTimer { this.dataStore.destroy(id); } return; - }; + } - store = (): void => { + public store(): void { return this.dataStore; - }; + } } export default HrTimer; diff --git a/JavaScriptSDK/src/utils/perfTimer.ts b/JavaScriptSDK/src/utils/perfTimer.ts index e5b6456680..93d6e2ff6a 100644 --- a/JavaScriptSDK/src/utils/perfTimer.ts +++ b/JavaScriptSDK/src/utils/perfTimer.ts @@ -1,7 +1,7 @@ import { performance, PerformanceObserver } from 'perf_hooks'; import DataStore from './dataStore'; class PerfTimer { - obs: $TSFixMe; + private obs: $TSFixMe; private dataStore; private apiUrl; private appId; @@ -11,7 +11,7 @@ class PerfTimer { this.appId = appId; this.appKey = appKey; this.dataStore = new DataStore(this.apiUrl, this.appId, this.appKey); - this.obs = new PerformanceObserver((list: $TSFixMe) => { + this.obs = new PerformanceObserver((list: $TSFixMe) { const entry: $TSFixMe = list.getEntries()[0]; const id: $TSFixMe = entry.name.slice(entry.name.indexOf('-') + 1); const originalValue: $TSFixMe = this.dataStore.getValue(id); @@ -26,17 +26,17 @@ class PerfTimer { this.obs.observe({ entryTypes: ['measure'] }); } - start = (id: $TSFixMe, log: $TSFixMe): void => { + public start (id: $TSFixMe, log: $TSFixMe): void { this.dataStore.setValue(id, log); return performance.mark(`start-${id}`); }; - end = (id: $TSFixMe, result: $TSFixMe, type: $TSFixMe): void => { + public end (id: $TSFixMe, result: $TSFixMe, type: $TSFixMe): void { performance.mark(`end-${id}`); return performance.measure(`${type}-${id}`, `start-${id}`, `end-${id}`); }; - store = (): void => { + public store (): void { return this.dataStore; }; } diff --git a/Mail/Services/MailService.ts b/Mail/Services/MailService.ts index f1bd6f0701..a9e7c047b6 100755 --- a/Mail/Services/MailService.ts +++ b/Mail/Services/MailService.ts @@ -295,8 +295,7 @@ export default class MailService { try { await this.transportMail(mail, mailServer); } catch (error) { - if (mailServer.backupMailServer) { - } + throw error; } } } diff --git a/ScriptRunner/utils/scriptSandbox.ts b/ScriptRunner/utils/scriptSandbox.ts index ba19691872..1f6daf34e3 100644 --- a/ScriptRunner/utils/scriptSandbox.ts +++ b/ScriptRunner/utils/scriptSandbox.ts @@ -31,7 +31,7 @@ const { const run: Function = async ( functionCode: $TSFixMe, isCalled: $TSFixMe, // skip IIFE calls - options = { maxScriptRunTime, maxSyncStatementDuration } + options: $TSFixMe = { maxScriptRunTime, maxSyncStatementDuration } ): void => { if (isMainThread) { // modifiable option in development mode only diff --git a/StatusPage/src/Reducer/status.ts b/StatusPage/src/Reducer/status.ts index 09ac49de29..885c245b9c 100755 --- a/StatusPage/src/Reducer/status.ts +++ b/StatusPage/src/Reducer/status.ts @@ -1938,7 +1938,7 @@ export default (state: $TSFixMe = INITIAL_STATE, action: Action): void => { const timelineIds: $TSFixMe = []; let singleTimeline: $TSFixMe = false; let timelines: $TSFixMe = state.lastIncidentTimelines.timelines.map( - timeline => { + (timeline: $TSFixMe) => { if ( String(timeline.incidentId) === String(action.payload.incidentId) diff --git a/StatusPage/src/Reducer/validateToken.ts b/StatusPage/src/Reducer/validateToken.ts index db7bf8d9d0..172de8d147 100755 --- a/StatusPage/src/Reducer/validateToken.ts +++ b/StatusPage/src/Reducer/validateToken.ts @@ -15,7 +15,10 @@ const initialState: $TSFixMe = { success: false, }; -export default function register(state: $TSFixMe = initialState, action: Action): void { +export default function register( + state: $TSFixMe = initialState, + action: Action +): void { switch (action.type) { case types.VALIDATE_TOKEN_REQUEST: return Object.assign({}, state, {