refactor(core): Move methods from WorkflowHelpers into various workflow services (no-changelog) (#8348)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-17 10:16:13 +01:00
committed by GitHub
parent ab52aaf7e9
commit 7cdbb424e3
21 changed files with 896 additions and 802 deletions

View File

@@ -1,12 +1,12 @@
import Container from 'typedi';
import type { User } from '@db/entities/User';
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
import { ExecutionsService } from './executions.service';
import type { ExecutionRequest } from './execution.request';
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
import { EnterpriseWorkflowService } from '../workflows/workflow.service.ee';
import type { WorkflowWithSharingsAndCredentials } from '@/workflows/workflows.types';
import Container from 'typedi';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { WorkflowSharingService } from '@/workflows/workflowSharing.service';
export class EnterpriseExecutionsService extends ExecutionsService {
/**
@@ -14,7 +14,7 @@ export class EnterpriseExecutionsService extends ExecutionsService {
*/
static async getWorkflowIdsForUser(user: User): Promise<string[]> {
// Get all workflows
return getSharedWorkflowIds(user);
return Container.get(WorkflowSharingService).getSharedWorkflowIds(user);
}
static async getExecution(

View File

@@ -1,3 +1,4 @@
import { Container, Service } from 'typedi';
import { validate as jsonSchemaValidate } from 'jsonschema';
import type {
IWorkflowBase,
@@ -8,6 +9,7 @@ import type {
WorkflowExecuteMode,
} from 'n8n-workflow';
import { ApplicationError, jsonParse, Workflow, WorkflowOperationError } from 'n8n-workflow';
import { ActiveExecutions } from '@/ActiveExecutions';
import config from '@/config';
import type { User } from '@db/entities/User';
@@ -22,10 +24,8 @@ import type {
import { NodeTypes } from '@/NodeTypes';
import { Queue } from '@/Queue';
import type { ExecutionRequest } from './execution.request';
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
import { WorkflowRunner } from '@/WorkflowRunner';
import * as GenericHelpers from '@/GenericHelpers';
import { Container, Service } from 'typedi';
import { getStatusUsingPreviousExecutionStatusMethod } from './executionHelpers';
import type { IGetExecutionsQueryFilter } from '@db/repositories/execution.repository';
import { ExecutionRepository } from '@db/repositories/execution.repository';
@@ -33,6 +33,7 @@ import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { Logger } from '@/Logger';
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { WorkflowSharingService } from '@/workflows/workflowSharing.service';
const schemaGetExecutionsQueryFilter = {
$id: '/IGetExecutionsQueryFilter',
@@ -77,7 +78,7 @@ export class ExecutionsService {
*/
static async getWorkflowIdsForUser(user: User): Promise<string[]> {
// Get all workflows using owner role
return getSharedWorkflowIds(user, ['owner']);
return Container.get(WorkflowSharingService).getSharedWorkflowIds(user, ['owner']);
}
static async getExecutionsList(req: ExecutionRequest.GetAll): Promise<IExecutionsListResponse> {