feat(core): Lazy-load nodes and credentials to reduce baseline memory usage (#4577)
This commit is contained in:
committed by
GitHub
parent
f63cd3b89e
commit
b6c57e19fc
@@ -7,9 +7,11 @@ import {
|
||||
INodeCredentialTestRequest,
|
||||
INodeCredentialTestResult,
|
||||
} from 'n8n-workflow';
|
||||
import axios from 'axios';
|
||||
|
||||
export async function getCredentialTypes(context: IRestApiContext): Promise<ICredentialType[]> {
|
||||
return await makeRestApiRequest(context, 'GET', '/credential-types');
|
||||
export async function getCredentialTypes(baseUrl: string): Promise<ICredentialType[]> {
|
||||
const { data } = await axios.get(baseUrl + 'types/credentials.json');
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function getCredentialsNewName(context: IRestApiContext, name?: string): Promise<{name: string}> {
|
||||
|
||||
@@ -14,12 +14,11 @@ import type {
|
||||
INodeTypeDescription,
|
||||
INodeTypeNameVersion,
|
||||
} from 'n8n-workflow';
|
||||
import axios from 'axios';
|
||||
|
||||
export async function getNodeTypes(
|
||||
context: IRestApiContext,
|
||||
{ onlyLatest } = { onlyLatest: false },
|
||||
) {
|
||||
return makeRestApiRequest(context, 'GET', '/node-types', { onlyLatest });
|
||||
export async function getNodeTypes(baseUrl: string) {
|
||||
const { data } = await axios.get(baseUrl + 'types/nodes.json');
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function getNodeTranslationHeaders(
|
||||
@@ -55,4 +54,3 @@ export async function getResourceLocatorResults(
|
||||
): Promise<INodeListSearchResult> {
|
||||
return makeRestApiRequest(context, 'GET', '/nodes-list-search', sendData as unknown as IDataObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user