mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Use an IoC container to manage singleton classes [Part-1] (no-changelog) (#5509)
* add typedi * convert ActiveWorkflowRunner into an injectable service * convert ExternalHooks into an injectable service * convert InternalHooks into an injectable service * convert LoadNodesAndCredentials into an injectable service * convert NodeTypes and CredentialTypes into an injectable service * convert ActiveExecutions into an injectable service * convert WaitTracker into an injectable service * convert Push into an injectable service * convert ActiveWebhooks and TestWebhooks into an injectable services * handle circular references, and log errors when a circular dependency is found
This commit is contained in:
committed by
GitHub
parent
aca94bb995
commit
52f740b9e8
@@ -8,12 +8,13 @@ import {
|
||||
deleteExecution,
|
||||
getExecutionsCount,
|
||||
} from './executions.service';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { ActiveExecutions } from '@/ActiveExecutions';
|
||||
import { authorize, validCursor } from '../../shared/middlewares/global.middleware';
|
||||
import type { ExecutionRequest } from '../../../types';
|
||||
import { getSharedWorkflowIds } from '../workflows/workflows.service';
|
||||
import { encodeNextCursor } from '../../shared/services/pagination.service';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { Container } from 'typedi';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
|
||||
export = {
|
||||
deleteExecution: [
|
||||
@@ -66,7 +67,7 @@ export = {
|
||||
return res.status(404).json({ message: 'Not Found' });
|
||||
}
|
||||
|
||||
void InternalHooksManager.getInstance().onUserRetrievedExecution({
|
||||
void Container.get(InternalHooks).onUserRetrievedExecution({
|
||||
user_id: req.user.id,
|
||||
public_api: true,
|
||||
});
|
||||
@@ -95,7 +96,7 @@ export = {
|
||||
}
|
||||
|
||||
// get running workflows so we exclude them from the result
|
||||
const runningExecutionsIds = ActiveExecutions.getInstance()
|
||||
const runningExecutionsIds = Container.get(ActiveExecutions)
|
||||
.getActiveExecutions()
|
||||
.map(({ id }) => id);
|
||||
|
||||
@@ -116,7 +117,7 @@ export = {
|
||||
|
||||
const count = await getExecutionsCount(filters);
|
||||
|
||||
void InternalHooksManager.getInstance().onUserRetrievedAllExecutions({
|
||||
void Container.get(InternalHooks).onUserRetrievedAllExecutions({
|
||||
user_id: req.user.id,
|
||||
public_api: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user