refactor(core): Enable import/order eslint rule (#10794)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { mock } from 'jest-mock-extended';
|
||||
|
||||
import type { CacheService } from '@/services/cache/cache.service';
|
||||
import type { OrchestrationService } from '@/services/orchestration.service';
|
||||
import type { TestWebhookRegistration } from '@/webhooks/test-webhook-registrations.service';
|
||||
import { TestWebhookRegistrationsService } from '@/webhooks/test-webhook-registrations.service';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
|
||||
describe('TestWebhookRegistrationsService', () => {
|
||||
const cacheService = mock<CacheService>();
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
import type * as express from 'express';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { TestWebhooks } from '@/webhooks/test-webhooks';
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import type { IWebhookData, IWorkflowExecuteAdditionalData, Workflow } from 'n8n-workflow';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { generateNanoId } from '@/databases/utils/generators';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import type * as express from 'express';
|
||||
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import type { IWorkflowDb } from '@/interfaces';
|
||||
import type { IWebhookData, IWorkflowExecuteAdditionalData, Workflow } from 'n8n-workflow';
|
||||
import type {
|
||||
TestWebhookRegistrationsService,
|
||||
TestWebhookRegistration,
|
||||
} from '@/webhooks/test-webhook-registrations.service';
|
||||
|
||||
import * as AdditionalData from '@/workflow-execute-additional-data';
|
||||
import { TestWebhooks } from '@/webhooks/test-webhooks';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import type { WebhookRequest } from '@/webhooks/webhook.types';
|
||||
import * as AdditionalData from '@/workflow-execute-additional-data';
|
||||
|
||||
jest.mock('@/workflow-execute-additional-data');
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type express from 'express';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { WaitingWebhooks } from '@/webhooks/waiting-webhooks';
|
||||
|
||||
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { IExecutionResponse } from '@/interfaces';
|
||||
import type express from 'express';
|
||||
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
|
||||
import { WaitingWebhooks } from '@/webhooks/waiting-webhooks';
|
||||
import type { WaitingWebhookRequest } from '@/webhooks/webhook.types';
|
||||
|
||||
describe('WaitingWebhooks', () => {
|
||||
|
||||
@@ -3,14 +3,14 @@ import { mock } from 'jest-mock-extended';
|
||||
import { randomString } from 'n8n-workflow';
|
||||
import type { IHttpRequestMethods } from 'n8n-workflow';
|
||||
|
||||
import { ResponseError } from '@/errors/response-errors/abstract/response.error';
|
||||
import { createWebhookHandlerFor } from '@/webhooks/webhook-request-handler';
|
||||
import type {
|
||||
IWebhookManager,
|
||||
IWebhookResponseCallbackData,
|
||||
WebhookOptionsRequest,
|
||||
WebhookRequest,
|
||||
} from '@/webhooks/webhook.types';
|
||||
import { createWebhookHandlerFor } from '@/webhooks/webhook-request-handler';
|
||||
import { ResponseError } from '@/errors/response-errors/abstract/response.error';
|
||||
|
||||
describe('WebhookRequestHandler', () => {
|
||||
const webhookManager = mock<Required<IWebhookManager>>();
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import config from '@/config';
|
||||
import { WebhookEntity } from '@/databases/entities/webhook-entity';
|
||||
import { WebhookRepository } from '@/databases/repositories/webhook.repository';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
import { WebhookService } from '@/webhooks/webhook.service';
|
||||
import { WebhookEntity } from '@/databases/entities/webhook-entity';
|
||||
import { mockInstance } from '@test/mocking';
|
||||
|
||||
const createWebhook = (method: string, path: string, webhookId?: string, pathSegments?: number) =>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import { Service } from 'typedi';
|
||||
import type { Response } from 'express';
|
||||
import { Workflow, NodeHelpers } from 'n8n-workflow';
|
||||
import type { INode, IWebhookData, IHttpRequestMethods } from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import { Logger } from '@/logger';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import { WebhookService } from '@/webhooks/webhook.service';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import { WorkflowStaticDataService } from '@/workflows/workflow-static-data.service';
|
||||
|
||||
import type {
|
||||
IWebhookResponseCallbackData,
|
||||
IWebhookManager,
|
||||
WebhookAccessControlOptions,
|
||||
WebhookRequest,
|
||||
} from './webhook.types';
|
||||
import { Logger } from '@/logger';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import { WebhookService } from '@/webhooks/webhook.service';
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import { WorkflowStaticDataService } from '@/workflows/workflow-static-data.service';
|
||||
|
||||
/**
|
||||
* Service for handling the execution of live webhooks, i.e. webhooks
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Service } from 'typedi';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
import type { IWebhookData } from 'n8n-workflow';
|
||||
import type { IWorkflowDb } from '@/interfaces';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import { TEST_WEBHOOK_TIMEOUT, TEST_WEBHOOK_TIMEOUT_BUFFER } from '@/constants';
|
||||
import type { IWorkflowDb } from '@/interfaces';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
|
||||
export type TestWebhookRegistration = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type express from 'express';
|
||||
import { Service } from 'typedi';
|
||||
import * as NodeExecuteFunctions from 'n8n-core';
|
||||
import { WebhookPathTakenError, Workflow } from 'n8n-workflow';
|
||||
import type {
|
||||
IWebhookData,
|
||||
@@ -7,26 +7,28 @@ import type {
|
||||
IHttpRequestMethods,
|
||||
IRunData,
|
||||
} from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import { TEST_WEBHOOK_TIMEOUT } from '@/constants';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import { WorkflowMissingIdError } from '@/errors/workflow-missing-id.error';
|
||||
import type { IWorkflowDb } from '@/interfaces';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import { Push } from '@/push';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { removeTrailingSlash } from '@/utils';
|
||||
import type { TestWebhookRegistration } from '@/webhooks/test-webhook-registrations.service';
|
||||
import { TestWebhookRegistrationsService } from '@/webhooks/test-webhook-registrations.service';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
|
||||
import type {
|
||||
IWebhookResponseCallbackData,
|
||||
IWebhookManager,
|
||||
WebhookAccessControlOptions,
|
||||
WebhookRequest,
|
||||
} from './webhook.types';
|
||||
import { Push } from '@/push';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import { TEST_WEBHOOK_TIMEOUT } from '@/constants';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { WorkflowMissingIdError } from '@/errors/workflow-missing-id.error';
|
||||
import { WebhookNotFoundError } from '@/errors/response-errors/webhook-not-found.error';
|
||||
import * as NodeExecuteFunctions from 'n8n-core';
|
||||
import { removeTrailingSlash } from '@/utils';
|
||||
import type { TestWebhookRegistration } from '@/webhooks/test-webhook-registrations.service';
|
||||
import { TestWebhookRegistrationsService } from '@/webhooks/test-webhook-registrations.service';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import type { IWorkflowDb } from '@/interfaces';
|
||||
|
||||
/**
|
||||
* Service for handling the execution of webhooks of manual executions
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import type express from 'express';
|
||||
import { NodeHelpers, Workflow } from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
import type express from 'express';
|
||||
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { IExecutionResponse, IWorkflowDb } from '@/interfaces';
|
||||
import { Logger } from '@/logger';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
|
||||
import type {
|
||||
IWebhookResponseCallbackData,
|
||||
IWebhookManager,
|
||||
WaitingWebhookRequest,
|
||||
} from './webhook.types';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
|
||||
import { Logger } from '@/logger';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { IExecutionResponse, IWorkflowDb } from '@/interfaces';
|
||||
|
||||
/**
|
||||
* Service for handling the execution of webhooks of Wait nodes that use the
|
||||
|
||||
@@ -7,13 +7,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import type express from 'express';
|
||||
import { Container } from 'typedi';
|
||||
import get from 'lodash/get';
|
||||
import { finished } from 'stream/promises';
|
||||
import formidable from 'formidable';
|
||||
|
||||
import get from 'lodash/get';
|
||||
import { BinaryDataService, NodeExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import type {
|
||||
IBinaryData,
|
||||
IBinaryKeyData,
|
||||
@@ -40,21 +36,24 @@ import {
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
NodeHelpers,
|
||||
} from 'n8n-workflow';
|
||||
import { finished } from 'stream/promises';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
import type { IWebhookResponseCallbackData, WebhookRequest } from './webhook.types';
|
||||
import { ActiveExecutions } from '@/active-executions';
|
||||
import type { Project } from '@/databases/entities/project';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
||||
import type { IExecutionDb, IWorkflowDb } from '@/interfaces';
|
||||
import { Logger } from '@/logger';
|
||||
import { parseBody } from '@/middlewares';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
import { WorkflowStatisticsService } from '@/services/workflow-statistics.service';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import * as WorkflowHelpers from '@/workflow-helpers';
|
||||
import { WorkflowRunner } from '@/workflow-runner';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import { ActiveExecutions } from '@/active-executions';
|
||||
import { WorkflowStatisticsService } from '@/services/workflow-statistics.service';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
import { parseBody } from '@/middlewares';
|
||||
import { Logger } from '@/logger';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
||||
import type { Project } from '@/databases/entities/project';
|
||||
import type { IExecutionDb, IWorkflowDb } from '@/interfaces';
|
||||
|
||||
import type { IWebhookResponseCallbackData, WebhookRequest } from './webhook.types';
|
||||
|
||||
/**
|
||||
* Returns all the webhooks which should be created for the given workflow
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type express from 'express';
|
||||
import type { IHttpRequestMethods } from 'n8n-workflow';
|
||||
|
||||
import * as ResponseHelper from '@/response-helper';
|
||||
import type {
|
||||
IWebhookManager,
|
||||
WebhookOptionsRequest,
|
||||
WebhookRequest,
|
||||
} from '@/webhooks/webhook.types';
|
||||
import * as ResponseHelper from '@/response-helper';
|
||||
|
||||
const WEBHOOK_METHODS: IHttpRequestMethods[] = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import { AbstractServer } from '@/abstract-server';
|
||||
|
||||
@Service()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { WebhookRepository } from '@/databases/repositories/webhook.repository';
|
||||
import { Service } from 'typedi';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
import type { WebhookEntity } from '@/databases/entities/webhook-entity';
|
||||
import type { IHttpRequestMethods } from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import type { WebhookEntity } from '@/databases/entities/webhook-entity';
|
||||
import { WebhookRepository } from '@/databases/repositories/webhook.repository';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
|
||||
type Method = NonNullable<IHttpRequestMethods>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user