This commit is contained in:
Nawaz Dhandala
2022-04-15 12:54:26 +01:00
parent 55999da87a
commit 1ed1bc49aa
29 changed files with 65 additions and 65 deletions

View File

@@ -78,7 +78,7 @@ export default {
return promise;
},
sshScanApplicationSecurity: async security => {
sshScanApplicationSecurity: async (security: $TSFixMe) => {
let securityDir: $TSFixMe = 'application_security_dir';
securityDir = await createDir(securityDir);
@@ -120,7 +120,7 @@ export default {
throw error;
});
audit.stdout.on('data', data => {
audit.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
auditOutput += strData;
});
@@ -216,7 +216,7 @@ export default {
});
},
scanApplicationSecurity: async security => {
scanApplicationSecurity: async (security: $TSFixMe) => {
let securityDir: $TSFixMe = 'application_security_dir';
securityDir = await createDir(securityDir);
@@ -262,7 +262,7 @@ export default {
throw error;
});
audit.stdout.on('data', data => {
audit.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
auditOutput += strData;
});

View File

@@ -345,7 +345,7 @@ router.post(
if (monitorStatus && monitorStatus.length) {
const uptimePercents: $TSFixMe = await Promise.all(
monitorStatus.map(async probe => {
monitorStatus.map(async (probe: $TSFixMe) => {
const { uptimePercent }: $TSFixMe =
await MonitorService.calculateTime(
probe.statuses,
@@ -746,7 +746,7 @@ router.get(
{ path: 'resourceCategory', select: 'name' },
];
await Promise.all(
allComponents.map(async component => {
allComponents.map(async (component: $TSFixMe) => {
const componentErrorTrackers: $TSFixMe =
await ErrorTrackerService.findBy({
query: {

View File

@@ -983,7 +983,7 @@ router.post(
// get the list of team members
await Promise.all(
teamMemberId.map(async teamMemberUserId => {
teamMemberId.map(async (teamMemberUserId: $TSFixMe) => {
// check if in organization
let member: $TSFixMe;
try {
@@ -1133,7 +1133,7 @@ router.post(
// get the list of team members
await Promise.all(
teamMemberId.map(async teamMemberUserId => {
teamMemberId.map(async (teamMemberUserId: $TSFixMe) => {
// check if in organization
let member: $TSFixMe;
try {

View File

@@ -1317,7 +1317,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function (): void
await MonitorService.hardDeleteBy({ projectId });
await Promise.all(
monitorDataArray.map(async monitor => {
monitorDataArray.map(async (monitor: $TSFixMe) => {
await request
.post(`/monitor/${projectId}`)
.set('Authorization', authorization)

View File

@@ -682,7 +682,7 @@ describe('Resource Category API - Check pagination for 12 resource categories',
const authorization: string = `Basic ${token}`;
const createdMonitorCategories: $TSFixMe = monitorCategories.map(
async resourceCategoryName => {
async (resourceCategoryName: $TSFixMe) => {
const sentRequests: $TSFixMe = await request
.post(`/resourceCategory/${projectId}`)

View File

@@ -137,7 +137,7 @@ describe('Scheduled event API', function (): void {
const createdScheduledEvents: $TSFixMe =
scheduledEvents.map(
async scheduledEvent => {
async (scheduledEvent: $TSFixMe) => {
const sentRequests: $TSFixMe =
await request
.post(

View File

@@ -172,7 +172,7 @@ describe('Scheduled Event Note', function (): void {
const createdScheduledEventNotes: $TSFixMe =
scheduledEventNotes.map(
async scheduledEventNote => {
async (scheduledEventNote: $TSFixMe) => {
const sentRequests: $TSFixMe =
await request
.post(

View File

@@ -9,7 +9,7 @@ import AlertService from '../Services/alertService';
import { IS_SAAS_SERVICE } from '../config/server';
const handleFetchingUnpaidSubscriptions: Function = async (
startAfter
startAfter: $TSFixMe
): void => {
if (startAfter) {
return await stripe.subscriptions.list({
@@ -36,7 +36,7 @@ const _this: $TSFixMe = {
* THE SERVICE TO ALERT PROJECT OWNERS BY MAIL WILL ALSO RUN IN THE BACKGROUND
*/
handleUnpaidSubscription: async startAfter => {
handleUnpaidSubscription: async (startAfter: $TSFixMe) => {
if (IS_SAAS_SERVICE) {
const subscriptions: $TSFixMe =
await handleFetchingUnpaidSubscriptions(startAfter);

View File

@@ -132,7 +132,7 @@ export default class Service {
const select: string =
'projectId subject body emailType allowedVariables';
const templates: $TSFixMe = await Promise.all(
defaultTemplate.map(async template => {
defaultTemplate.map(async (template: $TSFixMe) => {
const emailTemplate: $TSFixMe = await this.findOneBy({
query: {
projectId: projectId,

View File

@@ -862,7 +862,7 @@ export default class Service {
const selectSchedule: $TSFixMe =
'_id name slug projectId createdById monitorsIds escalationIds createdAt isDefault userIds';
const monitorsWithSchedules: $TSFixMe = await Promise.all(
monitorsWithStatus.map(async monitor => {
monitorsWithStatus.map(async (monitor: $TSFixMe) => {
const monitorSchedules: $TSFixMe =
await ScheduleService.findBy({
query: { monitorIds: monitor._id },
@@ -982,7 +982,7 @@ export default class Service {
const selectSchedule: $TSFixMe =
'_id name slug projectId createdById monitorsIds escalationIds createdAt isDefault userIds';
const monitorsWithSchedules: $TSFixMe = await Promise.all(
monitorsWithStatus.map(async monitor => {
monitorsWithStatus.map(async (monitor: $TSFixMe) => {
const monitorSchedules: $TSFixMe = await ScheduleService.findBy(
{
query: { monitorIds: monitor._id },

View File

@@ -618,7 +618,7 @@ public async incidentResolveOrAcknowledge(data, allCriteria): void {
// }
}
await Promise.all(
incidentsV1.map(async incident => {
incidentsV1.map(async (incident: $TSFixMe) => {
if (
incident.probes &&
incident.probes.length > 0 &&
@@ -663,7 +663,7 @@ public async incidentResolveOrAcknowledge(data, allCriteria): void {
})
);
await forEach(incidentsV2, async incident => {
await forEach(incidentsV2, async (incident: $TSFixMe) => {
const trueArray: $TSFixMe = [];
const falseArray: $TSFixMe = [];
@@ -793,7 +793,7 @@ public async updateProbeStatus(probeId: $TSFixMe): void {
let matchedCriterion: $TSFixMe;
if (con && con.length) {
eventOccurred = some(con, condition => {
eventOccurred = some(con, (condition: $TSFixMe) => {
let stat: $TSFixMe = true;
if (
condition &&
@@ -863,7 +863,7 @@ public async updateProbeStatus(probeId: $TSFixMe): void {
let eventOccurred: $TSFixMe = false;
let matchedCriterion: $TSFixMe;
if (conditions && conditions.length) {
eventOccurred = some(conditions, condition => {
eventOccurred = some(conditions, (condition: $TSFixMe) => {
let response: $TSFixMe = false;
let respAnd: $TSFixMe = false,
respOr = false,

View File

@@ -229,13 +229,13 @@ public async deleteBy(query, userId, cancelSub = true): void {
]);
await Promise.all(
monitors.map(async monitor => {
monitors.map(async (monitor: $TSFixMe) => {
await MonitorService.deleteBy({ _id: monitor._id }, userId);
})
);
await Promise.all(
schedules.map(async schedule => {
schedules.map(async (schedule: $TSFixMe) => {
await ScheduleService.deleteBy({ _id: schedule._id });
})
);
@@ -247,7 +247,7 @@ public async deleteBy(query, userId, cancelSub = true): void {
}
await Promise.all(
statusPages.map(async statusPage => {
statusPages.map(async (statusPage: $TSFixMe) => {
await StatusPageService.deleteBy({
_id: statusPage._id,
});
@@ -255,7 +255,7 @@ public async deleteBy(query, userId, cancelSub = true): void {
);
await Promise.all(
components.map(async component => {
components.map(async (component: $TSFixMe) => {
await componentService.deleteBy(
{ _id: component._id },
userId
@@ -563,7 +563,7 @@ public async exitProject(projectId, userId, deletedById, saveUserSeat): void {
query: { _id: userId },
select: 'email',
});
domains.domains.forEach(async domain => {
domains.domains.forEach(async (domain: $TSFixMe) => {
if (user_member.email.indexOf(domain) > -1) {
count++;
}
@@ -629,7 +629,7 @@ public async getAllProjects(skip, limit): void {
});
projects = await Promise.all(
projects.map(async project => {
projects.map(async (project: $TSFixMe) => {
// get both sub-project users and project users
let users: $TSFixMe = await TeamService.getTeamMembersBy({
parentProjectId: project._id,
@@ -701,7 +701,7 @@ public async getUserProjects(userId, skip, limit): void {
// add project monitors
const projects: $TSFixMe = await Promise.all(
allProjects.map(async project => {
allProjects.map(async (project: $TSFixMe) => {
// get both sub-project users and project users
let users: $TSFixMe = [];
if (project.parentProjectId) {
@@ -715,7 +715,7 @@ public async getUserProjects(userId, skip, limit): void {
const select: $TSFixMe =
'createdAt name email tempEmail isVerified sso jwtRefreshToken companyName companyRole companySize referral companyPhoneNumber onCallAlert profilePic twoFactorAuthEnabled stripeCustomerId timeZone lastActive disabled paymentFailedDate role isBlocked adminNotes deleted deletedById alertPhoneNumber tempAlertPhoneNumber tutorial identification source isAdminMode';
users = await Promise.all(
project.users.map(async user => {
project.users.map(async (user: $TSFixMe) => {
const foundUser: $TSFixMe = await UserService.findOneBy({
query: {
_id: user.userId,
@@ -756,7 +756,7 @@ public async restoreBy(query: $TSFixMe): void {
);
let subscription: $TSFixMe;
await Promise.all(
projectOwners.map(async projectOwner => {
projectOwners.map(async (projectOwner: $TSFixMe) => {
const owner: $TSFixMe = await UserService.findOneBy({
query: { _id: projectOwner.userId },
select: 'stripeCustomerId',
@@ -830,7 +830,7 @@ public async searchProjects(query, skip, limit): void {
let projects: $TSFixMe = await this.findBy({ query, limit, skip, select });
projects = await Promise.all(
projects.map(async project => {
projects.map(async (project: $TSFixMe) => {
// get both sub-project users and project users
let users: $TSFixMe = await TeamService.getTeamMembersBy({
parentProjectId: project._id,

View File

@@ -591,7 +591,7 @@ public async deleteBy(query: Query, userId: ObjectID): void {
populate: populateSubscriber,
});
await Promise.all(
subscribers.map(async subscriber => {
subscribers.map(async (subscriber: $TSFixMe) => {
await SubscriberService.deleteBy(
{ _id: subscriber._id },
userId

View File

@@ -379,7 +379,7 @@ export default class Service {
let subscriber: $TSFixMe = await this.findBy({ query, select: '_id' });
if (subscriber && subscriber.length > 1) {
const subscribers: $TSFixMe = await Promise.all(
subscriber.map(async subscriber => {
subscriber.map(async (subscriber: $TSFixMe) => {
const subscriberId: $TSFixMe = subscriber._id;
subscriber = await this.updateOneBy(
{ _id: subscriberId, deleted: true },

View File

@@ -4,12 +4,12 @@ process.on('exit', () => {
logger.info('Server Shutting Shutdown');
});
process.on('unhandledRejection', err => {
process.on('unhandledRejection', (err: $TSFixMe) => {
logger.error('Unhandled rejection in server process occurred');
logger.error(err);
});
process.on('uncaughtException', err => {
process.on('uncaughtException', (err: $TSFixMe) => {
logger.error('Uncaught exception in server process occurred');
logger.error(err);
});

View File

@@ -62,7 +62,7 @@ export default {
return promise;
},
scanContainerSecurity: async security => {
scanContainerSecurity: async (security: $TSFixMe) => {
const { imagePath, imageTags }: $TSFixMe = security;
const testPath: $TSFixMe = imageTags
? `${imagePath}:${imageTags}`

View File

@@ -618,7 +618,7 @@ export default {
}
}
await forEach(incidentsV2, async incident => {
await forEach(incidentsV2, async (incident: $TSFixMe) => {
const trueArray: $TSFixMe = [];
const falseArray: $TSFixMe = [];
@@ -842,7 +842,7 @@ export default {
let eventOccurred: $TSFixMe = false;
let matchedCriterion: $TSFixMe;
if (conditions && conditions.length) {
eventOccurred = some(conditions, condition => {
eventOccurred = some(conditions, (condition: $TSFixMe) => {
let response: $TSFixMe = false;
let respAnd: $TSFixMe = false,
respOr = false,

View File

@@ -86,7 +86,7 @@ public clearTimeline(eventId: $TSFixMe): void {
private _setUpDomListener(): void {
Object.keys(window).forEach((key: $TSFixMe) => {
if (/^on(keypress|click)/.test(key)) {
window.addEventListener(key.slice(2), event => {
window.addEventListener(key.slice(2), (event: $TSFixMe) => {
if (!this.keypressTimeout) {
// confirm the event is new
if (this.lastEvent === event) {

View File

@@ -184,14 +184,14 @@ class ErrorTracker {
}
private _setUpNodeErrorListener(): void {
process
.on('uncaughtException', err => {
.on('uncaughtException', (err: $TSFixMe) => {
// display for the user
//eslint-disable-next-line no-console
console.info(`${err}`);
// any uncaught error
this._manageErrorNode(err);
})
.on('unhandledRejection', err => {
.on('unhandledRejection', (err: $TSFixMe) => {
// display this for the user
//eslint-disable-next-line no-console
console.info(`UnhandledPromiseRejectionWarning: ${err.stack}`);

View File

@@ -57,7 +57,7 @@ const lighthouseFetch: Function = (url: URL): void => {
}, 300000);
lighthouseWorker.send(url);
lighthouseWorker.on('message', async result => {
lighthouseWorker.on('message', async (result: $TSFixMe) => {
await processLighthouseScan(result);
});

View File

@@ -399,14 +399,14 @@ export default {
// handle deployment output
let desiredDeployment: $TSFixMe = 0,
readyDeployment = 0;
readyDeployment: $TSFixMe = 0;
const unhealthyDeployments: $TSFixMe = [],
healthyDeployments = [],
allDeployments = [],
unhealthyDeploymentData = [],
healthyDeploymentData = [],
allDeploymentData = [];
healthyDeployments: $TSFixMe = [],
allDeployments: $TSFixMe = [],
unhealthyDeploymentData: $TSFixMe = [],
healthyDeploymentData: $TSFixMe = [],
allDeploymentData: $TSFixMe = [];
deploymentOutput.items.forEach(
(item: $TSFixMe) => {
@@ -735,7 +735,7 @@ function loadPodOutput(configPath, namespace): void {
cwd: process.cwd(),
shell: true,
});
podCommandOutput.stdout.on('data', data => {
podCommandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
podOutput += strData;
});
@@ -758,7 +758,7 @@ function loadJobOutput(configPath, namespace): void {
cwd: process.cwd(),
shell: true,
});
jobCommandOutput.stdout.on('data', data => {
jobCommandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
jobOutput += strData;
});
@@ -781,7 +781,7 @@ function loadServiceOutput(configPath, namespace): void {
cwd: process.cwd(),
shell: true,
});
serviceCommandOutput.stdout.on('data', data => {
serviceCommandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
serviceOutput += strData;
});
@@ -804,7 +804,7 @@ function loadDeploymentOutput(configPath, namespace): void {
cwd: process.cwd(),
shell: true,
});
deploymentCommandOutput.stdout.on('data', data => {
deploymentCommandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
deploymentOutput += strData;
});
@@ -827,7 +827,7 @@ function loadStatefulsetOutput(configPath, namespace): void {
cwd: process.cwd(),
shell: true,
});
statefulsetCommandOutput.stdout.on('data', data => {
statefulsetCommandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
statefulsetOutput += strData;
});

View File

@@ -4,7 +4,7 @@ import { run as runScript } from '../Utils/scriptSandbox';
// it collects all monitors then ping them one by one to store their response
export default {
run: async monitor => {
run: async (monitor: $TSFixMe) => {
if (monitor && monitor.type === 'script') {
if (monitor.data.script) {
const code: $TSFixMe = monitor.data.script; // redundant now but may be expanded in future

View File

@@ -287,7 +287,7 @@ function decodeAndSave(content: $TSFixMe, filePath: $TSFixMe): void {
cwd: process.cwd(),
shell: true,
});
commandOutput.stdout.on('data', data => {
commandOutput.stdout.on('data', (data: $TSFixMe) => {
const strData: $TSFixMe = data.toString();
output += strData;
});

View File

@@ -7,7 +7,7 @@ import 'should';
// user credentials
const userEmail: Email = utils.generateRandomBusinessEmail();
const password: string = '1234567890';
let browser: $TSFixMe, page;
let browser: $TSFixMe, page: $TSFixMe;
const masterAdmin: $TSFixMe = {
email: 'masteradmin@hackerbay.io',
password: '1234567890',

View File

@@ -401,7 +401,7 @@ describe('SMS Logs', () => {
// await init.pageClick(page, '#smsLogSetting');
// // enable logs
// await init.page$Eval(page, 'input[name=smsStatusToggler]', e =>
// await init.page$Eval(page, 'input[name=smsStatusToggler]', (e: $TSFixMe) =>
// e.click()
// );

View File

@@ -125,7 +125,7 @@ describe('Project Setting: Change Plan', () => {
'should update project account when admin recharge account',
async (done: $TSFixMe) => {
let balance: $TSFixMe = 0,
creditedBalance = 0;
creditedBalance: $TSFixMe = 0;
await page.goto(utils.DASHBOARD_URL);
await init.pageWaitForSelector(page, '#projectSettings', {
visible: true,

View File

@@ -763,7 +763,7 @@ describe('Incident Created test', () => {
// await init.pageWaitForSelector(page, '#closeIncident_0', {
// visible: true,
// });
// await init.page$Eval(page, '#closeIncident_0', elem => elem.click());
// await init.page$Eval(page, '#closeIncident_0', (elem: $TSFixMe) => elem.click());
// await init.pageWaitForSelector(page, '#closeIncidentButton_0');
// await init.page$Eval(page, '#closeIncidentButton_0',e=>e.click());
// const elementHandle: $TSFixMe = await init.page$(page, '#modal-ok');

View File

@@ -415,7 +415,7 @@ describe('Incident API With SubProjects', () => {
// test(
// 'should get incident timeline and paginate for incident timeline in sub-project',
// async done => {
// async (done: $TSFixMe) => {
// const internalNote: string = utils.generateRandomString();
// const type: string = 'internal';
// await init.loginUser(newUser, page);
@@ -432,7 +432,7 @@ describe('Incident API With SubProjects', () => {
// visible: true,
// timeout: init.timeout,
// });
// await init.page$Eval(page, `#incident_0`, e => e.click());
// await init.page$Eval(page, `#incident_0`, (e: $TSFixMe) => e.click());
// await init.pageWaitForSelector(page, '#incident_0', {
// visible: true,
// timeout: init.timeout,
@@ -441,7 +441,7 @@ describe('Incident API With SubProjects', () => {
// await init.gotoTab(utils.incidentTabIndexes.BASIC, page);
// for (let i: $TSFixMe = 0; i < 10; i++) {
// await init.page$Eval(page, `#add-${type}-message`, e =>
// await init.page$Eval(page, `#add-${type}-message`, (e: $TSFixMe) =>
// e.click()
// );
// await init.pageWaitForSelector(
@@ -488,7 +488,7 @@ describe('Incident API With SubProjects', () => {
// expect(countIncidentTimelines).toEqual(10);
// await init.page$Eval(page, '#btnTimelineNext', e => e.click());
// await init.page$Eval(page, '#btnTimelineNext', (e: $TSFixMe) => e.click());
// await init.pageWaitForSelector(page, '.ball-beat', {
// visible: true,
// timeout: init.timeout,
@@ -503,7 +503,7 @@ describe('Incident API With SubProjects', () => {
// countIncidentTimelines = incidentTimelineRows.length;
// expect(countIncidentTimelines).toEqual(5);
// await init.page$Eval(page, '#btnTimelinePrev', e => e.click());
// await init.page$Eval(page, '#btnTimelinePrev', (e: $TSFixMe) => e.click());
// await init.pageWaitForSelector(page, '.ball-beat', {
// visible: true,
// timeout: init.timeout,

View File

@@ -33,7 +33,7 @@
"uninstall": "docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)",
"delete-all-local-branches": "git branch | grep -v 'master' | xargs git branch -D",
"lint": "ejslint home/views/*.ejs && eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore",
"fix-lint": "eslint '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore --fix",
"fix-lint": "eslint --fix '**/*.ts' -c .eslintrc.json --ignore-path .eslintignore",
"fix": "npm run fix-lint",
"build": "docker-compose --env-file ./docker-enterprise.env build",
"build-dev": "docker-compose --env-file ./docker-enterprise.env -f docker-compose.dev.yml build $npm_config_services",