This commit is contained in:
Nawaz Dhandala 2022-04-15 11:49:06 +01:00
parent 4a2b10e02d
commit be02a2a608
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
15 changed files with 56 additions and 30 deletions

View File

@ -20,7 +20,10 @@ const router: $TSFixMe = express.getRouter();
import multer from 'multer';
import storage from '../middlewares/upload';
const callForward: Function = async (req: ExpressRequest, res: ExpressResponse): void => {
const callForward: Function = async (
req: ExpressRequest,
res: ExpressResponse
): void => {
try {
const body: $TSFixMe = req.body;
const to: $TSFixMe = body['To'];
@ -69,7 +72,10 @@ const backupCallForward: Function = async (
}
};
const callStatus: Function = async (req: ExpressRequest, res: ExpressResponse): void => {
const callStatus: Function = async (
req: ExpressRequest,
res: ExpressResponse
): void => {
try {
const body: $TSFixMe = req.body;
const to: $TSFixMe = body['To'];
@ -107,7 +113,7 @@ router.get(
isAuthorized,
async (req: ExpressRequest, res: ExpressResponse) => {
try {
let {skip, limit}: $TSFixMe = req.query;
let { skip, limit }: $TSFixMe = req.query;
const { projectId }: $TSFixMe = req.params;
if (typeof skip === 'string') {

View File

@ -249,7 +249,10 @@ const getStatusPages: Function = async (
return null;
};
const getUsers: Function = async (projectIds: $TSFixMe, val: $TSFixMe): void => {
const getUsers: Function = async (
projectIds: $TSFixMe,
val: $TSFixMe
): void => {
//get project users id so as to search for only users in a project and its subproject
const projectUsers: $TSFixMe = [];
@ -260,7 +263,9 @@ const getUsers: Function = async (projectIds: $TSFixMe, val: $TSFixMe): void =>
projects.forEach((project: $TSFixMe) => {
projectUsers.push(project.users);
});
const userIds: $TSFixMe = projectUsers.flat().map((user: $TSFixMe) => user.userId);
const userIds: $TSFixMe = projectUsers
.flat()
.map((user: $TSFixMe) => user.userId);
const users: $TSFixMe = await UserService.findBy({
query: {
_id: { $in: userIds },
@ -466,7 +471,9 @@ const getErrorTrackers: Function = async (
query: { projectId: { $in: projectIds }, deleted: false },
select: '_id',
});
const componentIds: $TSFixMe = components.map((component: $TSFixMe) => component._id);
const componentIds: $TSFixMe = components.map(
(component: $TSFixMe) => component._id
);
const select: $TSFixMe =
'componentId name slug key showQuickStart resourceCategory createdById createdAt';
const populate: $TSFixMe = [
@ -518,7 +525,9 @@ const getLogContainers: Function = async (
query: { projectId: { $in: projectIds }, deleted: false },
select: '_id',
});
const componentIds: $TSFixMe = components.map((component: $TSFixMe) => component._id);
const componentIds: $TSFixMe = components.map(
(component: $TSFixMe) => component._id
);
const populateAppLogs: $TSFixMe = [
{
path: 'componentId',
@ -575,7 +584,9 @@ const getPerformanceTrackers: Function = async (
select: 'id',
});
const componentIds: $TSFixMe = components.map((component: $TSFixMe) => component._id);
const componentIds: $TSFixMe = components.map(
(component: $TSFixMe) => component._id
);
const selectPerfTracker: $TSFixMe =
'componentId name slug key showQuickStart createdById';

View File

@ -18,7 +18,7 @@ import VerificationTokenModel from '../backend/models/verificationToken';
import AirtableService from '../backend/services/airtableService';
const sleep: Function = (waitTimeInMs: $TSFixMe): void =>
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
let userId: ObjectID, projectId: ObjectID;

View File

@ -39,7 +39,7 @@ import UserModel from '../backend/models/user';
import GlobalConfigModel from '../backend/models/globalConfig';
const sleep: Function = (waitTimeInMs: $TSFixMe): void =>
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
let authorization: $TSFixMe,
token,

View File

@ -45,7 +45,7 @@ const selectEmailStatus: $TSFixMe =
'from to subject body createdAt template status content error deleted deletedAt deletedById replyTo smtpServer';
const sleep: Function = (waitTimeInMs: $TSFixMe): void =>
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
let token: $TSFixMe,
userId: ObjectID,

View File

@ -69,7 +69,7 @@ import uuid from 'uuid';
import axios from 'axios';
const sleep: Function = (waitTimeInMs: $TSFixMe): void =>
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
let authorization: $TSFixMe,
userId: ObjectID,

View File

@ -32,7 +32,7 @@ import AirtableService from '../backend/services/airtableService';
let token: $TSFixMe, userId, projectId: ObjectID, componentId: $TSFixMe;
const probeKey: string = 'test-key';
const sleep: Function = (waitTimeInMs: $TSFixMe): void =>
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
new Promise((resolve: $TSFixMe) => setTimeout(resolve, waitTimeInMs));
const generateRandomString: $TSFixMe =
require('./utils/string').generateRandomString;
const probeServerRequestHeader: Function = ({

View File

@ -535,7 +535,9 @@ class SocketApp extends Component<ComponentProps> {
onClose: () => '',
onConfirm: () =>
new Promise((resolve: $TSFixMe) => resolve()),
new Promise((resolve: $TSFixMe) =>
resolve()
),
content: RemovedFromProjectModal,
});
}
@ -568,7 +570,9 @@ class SocketApp extends Component<ComponentProps> {
onClose: () => '',
onConfirm: () =>
new Promise((resolve: $TSFixMe) => resolve()),
new Promise((resolve: $TSFixMe) =>
resolve()
),
content: DataPathHoC(
RemovedFromSubProjectModal,
{

View File

@ -86,7 +86,7 @@ const questions: $TSFixMe = [
const checkParams: Function = (params: $TSFixMe): void => {
const values: $TSFixMe = [];
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
resolve(
params.reduce(
(promiseChain, param) =>
@ -112,7 +112,7 @@ const checkParams: Function = (params: $TSFixMe): void => {
const getParamValue: Function = (params, name): void => {
const options: $TSFixMe = program.opts();
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
if (options[name] === true || options[name] === undefined) {
if (name === 'monitorId') {
resolve(process.env[name] || null);
@ -259,7 +259,7 @@ checkParams(questions).then(values => {
monitorId:
monitorId ||
(data => {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
const question: $TSFixMe = questions.filter(
param => param.name === 'monitorId'
);

View File

@ -14,7 +14,9 @@ import OneUptimeLogger from '../src/logger';
describe('OneUptimeLogger', function (): void {
const sleep: Function = (milliseconds: $TSFixMe): void => {
return new Promise((resolve: $TSFixMe) => setTimeout(resolve, milliseconds));
return new Promise((resolve: $TSFixMe) =>
setTimeout(resolve, milliseconds)
);
};
this.timeout(timeout + 1000);
let projectId: ObjectID,

View File

@ -23,7 +23,9 @@ let errorTracker: $TSFixMe;
describe('Tracker Timeline', function (): void {
const sleep: Function = (milliseconds: $TSFixMe): void => {
return new Promise((resolve: $TSFixMe) => setTimeout(resolve, milliseconds));
return new Promise((resolve: $TSFixMe) =>
setTimeout(resolve, milliseconds)
);
};
this.timeout(timeout + 1000);
let projectId: ObjectID, token: $TSFixMe, componentId;

View File

@ -658,7 +658,7 @@ export default {
};
function loadPodOutput(configPath, namespace): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
let podOutput: $TSFixMe = '';
const podCommand: string = `kubectl get pods -o json --kubeconfig ${configPath} --namespace ${namespace}`;
@ -681,7 +681,7 @@ function loadPodOutput(configPath, namespace): void {
}
function loadJobOutput(configPath, namespace): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
let jobOutput: $TSFixMe = '';
const jobCommand: string = `kubectl get jobs -o json --kubeconfig ${configPath} --namespace ${namespace}`;
@ -704,7 +704,7 @@ function loadJobOutput(configPath, namespace): void {
}
function loadServiceOutput(configPath, namespace): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
let serviceOutput: $TSFixMe = '';
const serviceCommand: string = `kubectl get services -o json --kubeconfig ${configPath} --namespace ${namespace}`;
@ -727,7 +727,7 @@ function loadServiceOutput(configPath, namespace): void {
}
function loadDeploymentOutput(configPath, namespace): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
let deploymentOutput: $TSFixMe = '';
const deploymentCommand: string = `kubectl get deployments -o json --kubeconfig ${configPath} --namespace ${namespace}`;
@ -750,7 +750,7 @@ function loadDeploymentOutput(configPath, namespace): void {
}
function loadStatefulsetOutput(configPath, namespace): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
let statefulsetOutput: $TSFixMe = '';
const statefulsetCommand: string = `kubectl get statefulsets -o json --kubeconfig ${configPath} --namespace ${namespace}`;

View File

@ -3,8 +3,8 @@ import { performance } from 'perf_hooks';
const run: Function = async (script: $TSFixMe): void => {
const start: $TSFixMe = performance.now();
return new Promise((resolve: $TSFixMe) => {
exec(script, (err: $TSFixMe, stdout: $TSFixMe)=>{
return new Promise((resolve: $TSFixMe) => {
exec(script, (err: $TSFixMe, stdout: $TSFixMe) => {
if (err) {
return resolve({
success: false,

View File

@ -16,7 +16,8 @@ class ScriptError extends Error {
this.message = message;
this.errors = Array.isArray(errors)
? errors.reduce(
(allErr: $TSFixMe, err: $TSFixMe) => [...allErr, err.message].join(','),
(allErr: $TSFixMe, err: $TSFixMe) =>
[...allErr, err.message].join(','),
[]
)
: errors.message ?? errors;
@ -42,7 +43,7 @@ const run: Function = async (
return;
}
const start: $TSFixMe = performance.now();
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
const worker: $TSFixMe = new Worker(__filename, {
workerData: { functionCode },
execArgv: [

View File

@ -279,7 +279,7 @@ async function fetchCredential(
}
function decodeAndSave(content: $TSFixMe, filePath: $TSFixMe): void {
return new Promise((resolve: $TSFixMe) => {
return new Promise((resolve: $TSFixMe) => {
const command: string = `echo ${content} | base64 -d`;
let output: $TSFixMe = '';