mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +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
@@ -5,7 +5,6 @@ import type { INodeCredentialTestResult } from 'n8n-workflow';
|
||||
import { deepCopy, LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import config from '@/config';
|
||||
import { getLogger } from '@/Logger';
|
||||
@@ -14,6 +13,8 @@ import { CredentialsService } from './credentials.service';
|
||||
|
||||
import type { ICredentialsDb } from '@/Interfaces';
|
||||
import type { CredentialRequest } from '@/requests';
|
||||
import { Container } from 'typedi';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
|
||||
export const credentialsController = express.Router();
|
||||
|
||||
@@ -130,7 +131,7 @@ credentialsController.post(
|
||||
const encryptedData = CredentialsService.createEncryptedData(key, null, newCredential);
|
||||
const credential = await CredentialsService.save(newCredential, encryptedData, req.user);
|
||||
|
||||
void InternalHooksManager.getInstance().onUserCreatedCredentials({
|
||||
void Container.get(InternalHooks).onUserCreatedCredentials({
|
||||
user: req.user,
|
||||
credential_name: newCredential.name,
|
||||
credential_type: credential.type,
|
||||
|
||||
Reference in New Issue
Block a user