mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +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
@@ -30,6 +30,7 @@ import type { OAuthRequest } from '@/requests';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import config from '@/config';
|
||||
import { getInstanceBaseUrl } from '@/UserManagement/UserManagementHelper';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
export const oauth2CredentialController = express.Router();
|
||||
|
||||
@@ -129,7 +130,7 @@ oauth2CredentialController.get(
|
||||
state: stateEncodedStr,
|
||||
};
|
||||
|
||||
await ExternalHooks().run('oauth2.authenticate', [oAuthOptions]);
|
||||
await Container.get(ExternalHooks).run('oauth2.authenticate', [oAuthOptions]);
|
||||
|
||||
const oAuthObj = new ClientOAuth2(oAuthOptions);
|
||||
|
||||
@@ -281,7 +282,7 @@ oauth2CredentialController.get(
|
||||
delete oAuth2Parameters.clientSecret;
|
||||
}
|
||||
|
||||
await ExternalHooks().run('oauth2.callback', [oAuth2Parameters]);
|
||||
await Container.get(ExternalHooks).run('oauth2.callback', [oAuth2Parameters]);
|
||||
|
||||
const oAuthObj = new ClientOAuth2(oAuth2Parameters);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user