From 34d7fcc27e9a76493f31fa87973bb078bbd5d5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 21 Mar 2023 12:11:59 +0100 Subject: [PATCH] ci: Fix linting issues on master (no-changelog) (#5740) --- packages/cli/src/CommunityNodes/helpers.ts | 2 +- .../MessageEventBusLogWriter.ts | 10 ++++------ .../src/sso/saml/middleware/samlEnabledMiddleware.ts | 2 +- .../cli/src/sso/saml/routes/saml.controller.ee.ts | 11 ++++------- packages/cli/src/sso/saml/types/requests.ts | 2 +- packages/cli/src/sso/saml/views/initSsoRedirect.ts | 12 ------------ 6 files changed, 11 insertions(+), 28 deletions(-) delete mode 100644 packages/cli/src/sso/saml/views/initSsoRedirect.ts diff --git a/packages/cli/src/CommunityNodes/helpers.ts b/packages/cli/src/CommunityNodes/helpers.ts index 295f6a1072a0d..6cbe4134c4f75 100644 --- a/packages/cli/src/CommunityNodes/helpers.ts +++ b/packages/cli/src/CommunityNodes/helpers.ts @@ -207,7 +207,7 @@ export function hasPackageLoaded(packageName: string): boolean { export function removePackageFromMissingList(packageName: string): void { try { - const failedPackages = (config.get('nodes.packagesMissing') as string).split(' '); + const failedPackages = config.get('nodes.packagesMissing').split(' '); const packageFailedToLoad = failedPackages.filter( (packageNameAndVersion) => diff --git a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts index c8dc5f74ba593..87293f6149432 100644 --- a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts +++ b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts @@ -158,9 +158,8 @@ export class MessageEventBusLogWriter { sentMessages: [], unfinishedExecutions: {}, }; - const logCount = logHistory - ? Math.min(config.get('eventBus.logWriter.keepLogCount') as number, logHistory) - : (config.get('eventBus.logWriter.keepLogCount') as number); + const configLogCount = config.get('eventBus.logWriter.keepLogCount'); + const logCount = logHistory ? Math.min(configLogCount, logHistory) : configLogCount; for (let i = logCount; i >= 0; i--) { const logFileName = this.getLogFileName(i); if (logFileName) { @@ -255,9 +254,8 @@ export class MessageEventBusLogWriter { logHistory?: number, ): Promise { const result: EventMessageTypes[] = []; - const logCount = logHistory - ? Math.min(config.get('eventBus.logWriter.keepLogCount') as number, logHistory) - : (config.get('eventBus.logWriter.keepLogCount') as number); + const configLogCount = config.get('eventBus.logWriter.keepLogCount'); + const logCount = logHistory ? Math.min(configLogCount, logHistory) : configLogCount; for (let i = 0; i < logCount; i++) { const logFileName = this.getLogFileName(i); if (logFileName) { diff --git a/packages/cli/src/sso/saml/middleware/samlEnabledMiddleware.ts b/packages/cli/src/sso/saml/middleware/samlEnabledMiddleware.ts index d12d9f914f80b..6e4600b895f06 100644 --- a/packages/cli/src/sso/saml/middleware/samlEnabledMiddleware.ts +++ b/packages/cli/src/sso/saml/middleware/samlEnabledMiddleware.ts @@ -1,5 +1,5 @@ import type { RequestHandler } from 'express'; -import type { AuthenticatedRequest } from '../../../requests'; +import type { AuthenticatedRequest } from '@/requests'; import { isSamlLicensed, isSamlLicensedAndEnabled } from '../samlHelpers'; export const samlLicensedOwnerMiddleware: RequestHandler = ( diff --git a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts index d5cc9969d2621..b88ac17b260b5 100644 --- a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts +++ b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts @@ -1,5 +1,5 @@ import express from 'express'; -import { Get, Post, RestController } from '../../../decorators'; +import { Get, Post, RestController } from '@/decorators'; import { SamlUrls } from '../constants'; import { samlLicensedAndEnabledMiddleware, @@ -8,15 +8,14 @@ import { } from '../middleware/samlEnabledMiddleware'; import { SamlService } from '../saml.service.ee'; import { SamlConfiguration } from '../types/requests'; -import { AuthError, BadRequestError } from '../../../ResponseHelper'; +import { AuthError, BadRequestError } from '@/ResponseHelper'; import { getInitSSOFormView } from '../views/initSsoPost'; -import { getInitSSOPostView } from '../views/initSsoRedirect'; -import { issueCookie } from '../../../auth/jwt'; +import { issueCookie } from '@/auth/jwt'; import { validate } from 'class-validator'; import type { PostBindingContext } from 'samlify/types/src/entity'; import { isSamlLicensedAndEnabled } from '../samlHelpers'; import type { SamlLoginBinding } from '../types'; -import { AuthenticatedRequest } from '../../../requests'; +import { AuthenticatedRequest } from '@/requests'; @RestController('/sso/saml') export class SamlController { @@ -136,8 +135,6 @@ export class SamlController { private async handleInitSSO(res: express.Response) { const result = this.samlService.getLoginRequestUrl(); if (result?.binding === 'redirect') { - // forced client side redirect through the use of a javascript redirect - // return res.send(getInitSSOPostView(result.context)); // Return the redirect URL directly return res.send(result.context.context); } else if (result?.binding === 'post') { diff --git a/packages/cli/src/sso/saml/types/requests.ts b/packages/cli/src/sso/saml/types/requests.ts index cd54aaf72d181..4d58afb2dd53d 100644 --- a/packages/cli/src/sso/saml/types/requests.ts +++ b/packages/cli/src/sso/saml/types/requests.ts @@ -1,4 +1,4 @@ -import type { AuthenticatedRequest } from '../../../requests'; +import type { AuthenticatedRequest } from '@/requests'; import type { SamlPreferences } from './samlPreferences'; export declare namespace SamlConfiguration { diff --git a/packages/cli/src/sso/saml/views/initSsoRedirect.ts b/packages/cli/src/sso/saml/views/initSsoRedirect.ts deleted file mode 100644 index 56db9ce0838d7..0000000000000 --- a/packages/cli/src/sso/saml/views/initSsoRedirect.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { BindingContext } from 'samlify/types/src/entity'; - -export function getInitSSOPostView(context: BindingContext): string { - return ` - - `; -}