mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Refactor nodes loading (no-changelog) (#7283)
fixes PAY-605
This commit is contained in:
committed by
GitHub
parent
789e1e7ed4
commit
c5ee06cc61
@@ -1,14 +1,17 @@
|
||||
import config from '@/config';
|
||||
import { Service } from 'typedi';
|
||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
import { deepCopy, LoggerProxy as Logger, jsonParse, ICredentialTypes } from 'n8n-workflow';
|
||||
import { deepCopy, LoggerProxy as Logger, jsonParse } from 'n8n-workflow';
|
||||
import config from '@/config';
|
||||
import type { ICredentialsOverwrite } from '@/Interfaces';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
|
||||
class CredentialsOverwritesClass {
|
||||
@Service()
|
||||
export class CredentialsOverwrites {
|
||||
private overwriteData: ICredentialsOverwrite = {};
|
||||
|
||||
private resolvedTypes: string[] = [];
|
||||
|
||||
constructor(private credentialTypes: ICredentialTypes) {
|
||||
constructor(private credentialTypes: CredentialTypes) {
|
||||
const data = config.getEnv('credentials.overwrite.data');
|
||||
const overwriteData = jsonParse<ICredentialsOverwrite>(data, {
|
||||
errorMessage: 'The credentials-overwrite is not valid JSON.',
|
||||
@@ -96,20 +99,3 @@ class CredentialsOverwritesClass {
|
||||
return this.overwriteData;
|
||||
}
|
||||
}
|
||||
|
||||
let credentialsOverwritesInstance: CredentialsOverwritesClass | undefined;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function CredentialsOverwrites(
|
||||
credentialTypes?: ICredentialTypes,
|
||||
): CredentialsOverwritesClass {
|
||||
if (!credentialsOverwritesInstance) {
|
||||
if (credentialTypes) {
|
||||
credentialsOverwritesInstance = new CredentialsOverwritesClass(credentialTypes);
|
||||
} else {
|
||||
throw new Error('CredentialsOverwrites not initialized yet');
|
||||
}
|
||||
}
|
||||
|
||||
return credentialsOverwritesInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user