mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix(core): Fix type errors (no-changelog) (#9571)
This commit is contained in:
parent
400c005866
commit
8da0d6e9ba
|
@ -66,7 +66,7 @@ export class Queue {
|
|||
: getRedisStandardClient(Redis, clientConfig, (type + '(bull)') as RedisClientType),
|
||||
});
|
||||
|
||||
this.jobQueue.on('global:progress', (jobId, progress: WebhookResponse) => {
|
||||
this.jobQueue.on('global:progress', (_jobId, progress: WebhookResponse) => {
|
||||
this.activeExecutions.resolveResponsePromise(
|
||||
progress.executionId,
|
||||
this.decodeWebhookResponse(progress.response),
|
||||
|
|
|
@ -13,7 +13,6 @@ import type {
|
|||
} from '@/Interfaces';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { ExecutionRepository } from '@db/repositories/execution.repository';
|
||||
import { OwnershipService } from './services/ownership.service';
|
||||
import { Logger } from '@/Logger';
|
||||
import { ConflictError } from './errors/response-errors/conflict.error';
|
||||
import { NotFoundError } from './errors/response-errors/not-found.error';
|
||||
|
@ -26,7 +25,6 @@ export class WaitingWebhooks implements IWebhookManager {
|
|||
protected readonly logger: Logger,
|
||||
private readonly nodeTypes: NodeTypes,
|
||||
private readonly executionRepository: ExecutionRepository,
|
||||
private readonly ownershipService: OwnershipService,
|
||||
) {}
|
||||
|
||||
// TODO: implement `getWebhookMethods` for CORS support
|
||||
|
|
|
@ -385,7 +385,7 @@ export class Worker extends BaseCommand {
|
|||
app.get(
|
||||
'/healthz',
|
||||
|
||||
async (req: express.Request, res: express.Response) => {
|
||||
async (_req: express.Request, res: express.Response) => {
|
||||
this.logger.debug('Health check started!');
|
||||
|
||||
const connection = Db.getConnection();
|
||||
|
|
|
@ -13,7 +13,7 @@ export class TagsController {
|
|||
|
||||
// TODO: move this into a new decorator `@IfEnabled('workflowTagsDisabled')`
|
||||
@Middleware()
|
||||
workflowsEnabledMiddleware(req: Request, res: Response, next: NextFunction) {
|
||||
workflowsEnabledMiddleware(_req: Request, _res: Response, next: NextFunction) {
|
||||
if (this.config.getEnv('workflowTagsDisabled'))
|
||||
throw new BadRequestError('Workflow tags are disabled');
|
||||
next();
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Container } from 'typedi';
|
|||
import { isSourceControlLicensed } from '../sourceControlHelper.ee';
|
||||
import { SourceControlPreferencesService } from '../sourceControlPreferences.service.ee';
|
||||
|
||||
export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (req, res, next) => {
|
||||
export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (_req, res, next) => {
|
||||
const sourceControlPreferencesService = Container.get(SourceControlPreferencesService);
|
||||
if (sourceControlPreferencesService.isSourceControlLicensedAndEnabled()) {
|
||||
next();
|
||||
|
@ -19,7 +19,7 @@ export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (req, r
|
|||
}
|
||||
};
|
||||
|
||||
export const sourceControlLicensedMiddleware: RequestHandler = (req, res, next) => {
|
||||
export const sourceControlLicensedMiddleware: RequestHandler = (_req, res, next) => {
|
||||
if (isSourceControlLicensed()) {
|
||||
next();
|
||||
} else {
|
||||
|
|
|
@ -6,7 +6,7 @@ export function islogStreamingLicensed(): boolean {
|
|||
return Container.get(License).isLogStreamingEnabled();
|
||||
}
|
||||
|
||||
export const logStreamingLicensedMiddleware: RequestHandler = (req, res, next) => {
|
||||
export const logStreamingLicensedMiddleware: RequestHandler = (_req, res, next) => {
|
||||
if (islogStreamingLicensed()) {
|
||||
next();
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ const xmlParser = new XmlParser({
|
|||
});
|
||||
|
||||
const payloadSizeMax = config.getEnv('endpoints.payloadSizeMax');
|
||||
export const rawBodyReader: RequestHandler = async (req, res, next) => {
|
||||
export const rawBodyReader: RequestHandler = async (req, _res, next) => {
|
||||
parseIncomingMessage(req);
|
||||
|
||||
req.readRawBody = async () => {
|
||||
|
@ -70,7 +70,7 @@ export const parseBody = async (req: Request) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const bodyParser: RequestHandler = async (req, res, next) => {
|
||||
export const bodyParser: RequestHandler = async (req, _res, next) => {
|
||||
await parseBody(req);
|
||||
if (!req.body) req.body = {};
|
||||
next();
|
||||
|
|
|
@ -77,7 +77,7 @@ export class MetricsService extends EventEmitter {
|
|||
}
|
||||
|
||||
mountMetricsEndpoint(app: express.Application) {
|
||||
app.get('/metrics', async (req: express.Request, res: express.Response) => {
|
||||
app.get('/metrics', async (_req: express.Request, res: express.Response) => {
|
||||
const metrics = await promClient.register.metrics();
|
||||
res.setHeader('Content-Type', promClient.register.contentType);
|
||||
res.send(metrics).end();
|
||||
|
|
|
@ -91,4 +91,4 @@ export function rightDiff<T1, T2>(
|
|||
* Can be used to make sure the type is exhausted
|
||||
* in switch statements or if/else chains.
|
||||
*/
|
||||
export const assertNever = (value: never) => {};
|
||||
export const assertNever = (_value: never) => {};
|
||||
|
|
|
@ -240,7 +240,7 @@ describe('POST /external-secrets/providers/:provider', () => {
|
|||
const resp = await authOwnerAgent.post('/external-secrets/providers/dummy').send(testData);
|
||||
expect(resp.status).toBe(200);
|
||||
|
||||
const confirmResp = await authOwnerAgent.get('/external-secrets/providers/dummy');
|
||||
await authOwnerAgent.get('/external-secrets/providers/dummy');
|
||||
expect((await getExternalSecretsSettings())?.dummy.settings).toEqual({
|
||||
username: 'newuser',
|
||||
password: 'testpass',
|
||||
|
|
|
@ -26,7 +26,6 @@ import {
|
|||
|
||||
import type { User } from '@/databases/entities/User';
|
||||
import type { UserInvitationResult } from '../../shared/utils/users';
|
||||
import { ProjectRepository } from '@/databases/repositories/project.repository';
|
||||
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
|
||||
|
||||
describe('InvitationController', () => {
|
||||
|
@ -38,12 +37,10 @@ describe('InvitationController', () => {
|
|||
|
||||
let instanceOwner: User;
|
||||
let userRepository: UserRepository;
|
||||
let projectRepository: ProjectRepository;
|
||||
let projectRelationRepository: ProjectRelationRepository;
|
||||
|
||||
beforeAll(async () => {
|
||||
userRepository = Container.get(UserRepository);
|
||||
projectRepository = Container.get(ProjectRepository);
|
||||
projectRelationRepository = Container.get(ProjectRelationRepository);
|
||||
instanceOwner = await createOwner();
|
||||
});
|
||||
|
|
|
@ -536,7 +536,7 @@ describe('PUT /credentials/:id/share', () => {
|
|||
test('should respond 200 for non-owned credentials for owners', async () => {
|
||||
const savedCredential = await saveCredential(randomCredentialPayload(), { user: member });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
await authOwnerAgent
|
||||
.put(`/credentials/${savedCredential.id}/share`)
|
||||
.send({ shareWithIds: [anotherMemberPersonalProject.id] })
|
||||
.expect(200);
|
||||
|
|
|
@ -9,7 +9,6 @@ import { ProjectRepository } from '@db/repositories/project.repository';
|
|||
import type { Project } from '@db/entities/Project';
|
||||
import { CredentialsRepository } from '@db/repositories/credentials.repository';
|
||||
import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository';
|
||||
import { ProjectService } from '@/services/project.service';
|
||||
|
||||
import * as testDb from '../shared/testDb';
|
||||
import { setupTestServer } from '../shared/utils';
|
||||
|
@ -44,7 +43,6 @@ let authMemberAgent: SuperAgentTest;
|
|||
|
||||
let projectRepository: ProjectRepository;
|
||||
let sharedCredentialsRepository: SharedCredentialsRepository;
|
||||
let projectService: ProjectService;
|
||||
|
||||
beforeEach(async () => {
|
||||
await testDb.truncate(['SharedCredentials', 'Credentials']);
|
||||
|
@ -65,7 +63,6 @@ beforeEach(async () => {
|
|||
|
||||
projectRepository = Container.get(ProjectRepository);
|
||||
sharedCredentialsRepository = Container.get(SharedCredentialsRepository);
|
||||
projectService = Container.get(ProjectService);
|
||||
});
|
||||
|
||||
type GetAllResponse = { body: { data: ListQuery.Credentials.WithOwnedByAndSharedWith[] } };
|
||||
|
|
|
@ -130,6 +130,5 @@ const DEFAULT_POST_RESPONSE: { data: ILicensePostResponse } = {
|
|||
},
|
||||
};
|
||||
|
||||
const UNAUTHORIZED_RESPONSE = { status: 'error', message: 'Unauthorized' };
|
||||
const ACTIVATION_FAILED_MESSAGE = 'Failed to activate license';
|
||||
const GENERIC_ERROR_MESSAGE = 'Something went wrong';
|
||||
|
|
|
@ -912,7 +912,7 @@ describe('PATCH /users/:id/role', () => {
|
|||
createTeamProject(),
|
||||
]);
|
||||
|
||||
const [credential1, credential2, credential3] = await Promise.all([
|
||||
await Promise.all([
|
||||
saveCredential(randomCredentialPayload(), {
|
||||
user,
|
||||
role: 'credential:owner',
|
||||
|
|
|
@ -306,7 +306,7 @@ describe('PATCH /variables/:id', () => {
|
|||
});
|
||||
|
||||
test('should not modify existing variable if one with the same key exists', async () => {
|
||||
const [var1, var2] = await Promise.all([
|
||||
const [var1] = await Promise.all([
|
||||
createVariable('test1', 'value1'),
|
||||
createVariable(toModify.key, toModify.value),
|
||||
]);
|
||||
|
@ -327,7 +327,7 @@ describe('PATCH /variables/:id', () => {
|
|||
// ----------------------------------------
|
||||
describe('DELETE /variables/:id', () => {
|
||||
test('should delete a single variable for an owner', async () => {
|
||||
const [var1, var2, var3] = await Promise.all([
|
||||
const [var1] = await Promise.all([
|
||||
createVariable('test1', 'value1'),
|
||||
createVariable('test2', 'value2'),
|
||||
createVariable('test3', 'value3'),
|
||||
|
@ -344,7 +344,7 @@ describe('DELETE /variables/:id', () => {
|
|||
});
|
||||
|
||||
test('should not delete a single variable for a member', async () => {
|
||||
const [var1, var2, var3] = await Promise.all([
|
||||
const [var1] = await Promise.all([
|
||||
createVariable('test1', 'value1'),
|
||||
createVariable('test2', 'value2'),
|
||||
createVariable('test3', 'value3'),
|
||||
|
|
|
@ -91,7 +91,7 @@ describe('GET /workflow-history/:workflowId', () => {
|
|||
),
|
||||
);
|
||||
|
||||
const versions2 = await Promise.all(
|
||||
await Promise.all(
|
||||
new Array(10).fill(undefined).map(async (_) => await createWorkflowHistoryItem(workflow2.id)),
|
||||
);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ export class DummyProvider extends SecretsProvider {
|
|||
test2: 'value2',
|
||||
};
|
||||
|
||||
async init(settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
async init(_settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
this.state = 'connected';
|
||||
|
@ -101,7 +101,7 @@ export class ErrorProvider extends SecretsProvider {
|
|||
|
||||
state: SecretsProviderState = 'initializing';
|
||||
|
||||
async init(settings: SecretsProviderSettings<IDataObject>): Promise<void> {
|
||||
async init(_settings: SecretsProviderSettings<IDataObject>): Promise<void> {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
@ -122,11 +122,11 @@ export class ErrorProvider extends SecretsProvider {
|
|||
throw new Error();
|
||||
}
|
||||
|
||||
getSecret(name: string): IDataObject | undefined {
|
||||
getSecret(_name: string): IDataObject | undefined {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
hasSecret(name: string): boolean {
|
||||
hasSecret(_name: string): boolean {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ export class FailedProvider extends SecretsProvider {
|
|||
|
||||
state: SecretsProviderState = 'initializing';
|
||||
|
||||
async init(settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
async init(_settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
this.state = 'error';
|
||||
|
@ -185,7 +185,7 @@ export class TestFailProvider extends SecretsProvider {
|
|||
test2: 'value2',
|
||||
};
|
||||
|
||||
async init(settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
async init(_settings: SecretsProviderSettings<IDataObject>): Promise<void> {}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
this.state = 'connected';
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('CollaborationService', () => {
|
|||
workflowId,
|
||||
};
|
||||
|
||||
const expectActiveUsersChangedMessage = (userIds: string[]) => {
|
||||
const expectActiveUsersChangedMessage = () => {
|
||||
expect(push.sendToUsers).toHaveBeenCalledWith(
|
||||
'activeWorkflowUsersChanged',
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ describe('CollaborationService', () => {
|
|||
mockUserRepository.getByIds.mockResolvedValueOnce([{ id: userId } as User]);
|
||||
await collaborationService.handleUserMessage(userId, message);
|
||||
|
||||
expectActiveUsersChangedMessage([userId]);
|
||||
expectActiveUsersChangedMessage();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe('CollaborationService', () => {
|
|||
mockUserRepository.getByIds.mockResolvedValueOnce([{ id: userId } as User]);
|
||||
await collaborationService.handleUserMessage(userId, message);
|
||||
|
||||
expectActiveUsersChangedMessage([userId]);
|
||||
expectActiveUsersChangedMessage();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,12 +5,11 @@ import { mock } from 'jest-mock-extended';
|
|||
|
||||
describe('OnShutdown', () => {
|
||||
let shutdownService: ShutdownService;
|
||||
let registerSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
shutdownService = new ShutdownService(mock());
|
||||
Container.set(ShutdownService, shutdownService);
|
||||
registerSpy = jest.spyOn(shutdownService, 'register');
|
||||
jest.spyOn(shutdownService, 'register');
|
||||
});
|
||||
|
||||
it('should register a methods that is decorated with OnShutdown', () => {
|
||||
|
@ -49,6 +48,7 @@ describe('OnShutdown', () => {
|
|||
});
|
||||
|
||||
it('should use the given priority', () => {
|
||||
// @ts-expect-error We are checking the decorator.
|
||||
class TestClass {
|
||||
@OnShutdown(10)
|
||||
async onShutdown() {
|
||||
|
|
|
@ -12,8 +12,6 @@ function setDefaultConfig() {
|
|||
}
|
||||
|
||||
const PUBSUB_CHANNEL = 'testchannel';
|
||||
const LIST_CHANNEL = 'testlist';
|
||||
const STREAM_CHANNEL = 'teststream';
|
||||
|
||||
describe('RedisService', () => {
|
||||
beforeAll(async () => {
|
||||
|
@ -41,7 +39,7 @@ describe('RedisService', () => {
|
|||
expect(sub).toBeDefined();
|
||||
|
||||
const mockHandler = jest.fn();
|
||||
mockHandler.mockImplementation((channel: string, message: string) => {});
|
||||
mockHandler.mockImplementation((_channel: string, _message: string) => {});
|
||||
sub.addMessageHandler(PUBSUB_CHANNEL, mockHandler);
|
||||
await sub.subscribe(PUBSUB_CHANNEL);
|
||||
await pub.publish(PUBSUB_CHANNEL, 'test');
|
||||
|
|
|
@ -3,11 +3,10 @@ import config from '@/config';
|
|||
import { getWorkflowHistoryPruneTime } from '@/workflows/workflowHistory/workflowHistoryHelper.ee';
|
||||
import { mockInstance } from '../shared/mocking';
|
||||
|
||||
let licenseMock: License;
|
||||
let licensePruneTime = -1;
|
||||
|
||||
beforeAll(async () => {
|
||||
licenseMock = mockInstance(License, {
|
||||
mockInstance(License, {
|
||||
getWorkflowHistoryPruneLimit() {
|
||||
return licensePruneTime;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue