ci: Break most of the circular dependencies in code (no-changelog) (#4990)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-12-21 10:46:26 +01:00
committed by GitHub
parent 82f763589b
commit 5db9c46043
36 changed files with 105 additions and 110 deletions

View File

@@ -10,7 +10,7 @@ import { validateEntity } from '@/GenericHelpers';
import type { WorkflowRequest } from '@/requests';
import { isSharingEnabled, rightDiff } from '@/UserManagement/UserManagementHelper';
import { EEWorkflowsService as EEWorkflows } from './workflows.services.ee';
import { externalHooks } from '../Server';
import { ExternalHooks } from '@/ExternalHooks';
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
import { LoggerProxy } from 'n8n-workflow';
import * as TagHelpers from '@/TagHelpers';
@@ -117,7 +117,7 @@ EEWorkflowController.post(
await validateEntity(newWorkflow);
await externalHooks.run('workflow.create', [newWorkflow]);
await ExternalHooks().run('workflow.create', [newWorkflow]);
const { tags: tagIds } = req.body;
@@ -178,7 +178,7 @@ EEWorkflowController.post(
});
}
await externalHooks.run('workflow.afterCreate', [savedWorkflow]);
await ExternalHooks().run('workflow.afterCreate', [savedWorkflow]);
void InternalHooksManager.getInstance().onWorkflowCreated(req.user.id, newWorkflow, false);
const { id, ...rest } = savedWorkflow;

View File

@@ -17,7 +17,7 @@ import { SharedWorkflow } from '@db/entities/SharedWorkflow';
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { validateEntity } from '@/GenericHelpers';
import { InternalHooksManager } from '@/InternalHooksManager';
import { externalHooks } from '@/Server';
import { ExternalHooks } from '@/ExternalHooks';
import { getLogger } from '@/Logger';
import type { WorkflowRequest } from '@/requests';
import { isBelowOnboardingThreshold } from '@/WorkflowHelpers';
@@ -57,7 +57,7 @@ workflowsController.post(
await validateEntity(newWorkflow);
await externalHooks.run('workflow.create', [newWorkflow]);
await ExternalHooks().run('workflow.create', [newWorkflow]);
const { tags: tagIds } = req.body;
@@ -103,7 +103,7 @@ workflowsController.post(
});
}
await externalHooks.run('workflow.afterCreate', [savedWorkflow]);
await ExternalHooks().run('workflow.afterCreate', [savedWorkflow]);
void InternalHooksManager.getInstance().onWorkflowCreated(req.user.id, newWorkflow, false);
const { id, ...rest } = savedWorkflow;
@@ -273,7 +273,7 @@ workflowsController.delete(
ResponseHelper.send(async (req: WorkflowRequest.Delete) => {
const { id: workflowId } = req.params;
await externalHooks.run('workflow.delete', [workflowId]);
await ExternalHooks().run('workflow.delete', [workflowId]);
const shared = await Db.collections.SharedWorkflow.findOne({
relations: ['workflow', 'role'],
@@ -303,7 +303,7 @@ workflowsController.delete(
await Db.collections.Workflow.delete(workflowId);
void InternalHooksManager.getInstance().onWorkflowDeleted(req.user.id, workflowId, false);
await externalHooks.run('workflow.afterDelete', [workflowId]);
await ExternalHooks().run('workflow.afterDelete', [workflowId]);
return true;
}),

View File

@@ -13,7 +13,7 @@ import { SharedWorkflow } from '@db/entities/SharedWorkflow';
import { User } from '@db/entities/User';
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { validateEntity } from '@/GenericHelpers';
import { externalHooks } from '@/Server';
import { ExternalHooks } from '@/ExternalHooks';
import * as TagHelpers from '@/TagHelpers';
import { WorkflowRequest } from '@/requests';
import { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
@@ -246,7 +246,7 @@ export class WorkflowsService {
WorkflowHelpers.addNodeIds(workflow);
await externalHooks.run('workflow.update', [workflow]);
await ExternalHooks().run('workflow.update', [workflow]);
if (shared.workflow.active) {
// When workflow gets saved always remove it as the triggers could have been
@@ -332,13 +332,13 @@ export class WorkflowsService {
});
}
await externalHooks.run('workflow.afterUpdate', [updatedWorkflow]);
await ExternalHooks().run('workflow.afterUpdate', [updatedWorkflow]);
void InternalHooksManager.getInstance().onWorkflowSaved(user.id, updatedWorkflow, false);
if (updatedWorkflow.active) {
// When the workflow is supposed to be active add it again
try {
await externalHooks.run('workflow.activate', [updatedWorkflow]);
await ExternalHooks().run('workflow.activate', [updatedWorkflow]);
await ActiveWorkflowRunner.getInstance().add(
workflowId,
shared.workflow.active ? 'update' : 'activate',