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
@@ -1,9 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line max-classes-per-file
|
||||
import * as express from 'express';
|
||||
import * as FormData from 'form-data';
|
||||
import type * as express from 'express';
|
||||
import type * as FormData from 'form-data';
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
import type { URLSearchParams } from 'url';
|
||||
import type { IDeferredPromise } from './DeferredPromise';
|
||||
@@ -311,6 +309,7 @@ export interface ICredentialType {
|
||||
name: string;
|
||||
displayName: string;
|
||||
icon?: string;
|
||||
iconUrl?: string;
|
||||
extends?: string[];
|
||||
properties: INodeProperties[];
|
||||
documentationUrl?: string;
|
||||
@@ -325,9 +324,7 @@ export interface ICredentialType {
|
||||
}
|
||||
|
||||
export interface ICredentialTypes {
|
||||
credentialTypes?: ICredentialTypeData;
|
||||
init(credentialTypes?: ICredentialTypeData): Promise<void>;
|
||||
getAll(): ICredentialType[];
|
||||
recognizes(credentialType: string): boolean;
|
||||
getByName(credentialType: string): ICredentialType;
|
||||
}
|
||||
|
||||
@@ -1257,6 +1254,7 @@ export interface INodeTypeBaseDescription {
|
||||
displayName: string;
|
||||
name: string;
|
||||
icon?: string;
|
||||
iconUrl?: string;
|
||||
group: string[];
|
||||
description: string;
|
||||
documentationUrl?: string;
|
||||
@@ -1473,24 +1471,37 @@ export type WebhookResponseData = 'allEntries' | 'firstEntryJson' | 'firstEntryB
|
||||
export type WebhookResponseMode = 'onReceived' | 'lastNode';
|
||||
|
||||
export interface INodeTypes {
|
||||
nodeTypes: INodeTypeData;
|
||||
init(nodeTypes?: INodeTypeData): Promise<void>;
|
||||
getAll(): Array<INodeType | IVersionedNodeType>;
|
||||
getByNameAndVersion(nodeType: string, version?: number): INodeType | undefined;
|
||||
}
|
||||
|
||||
export interface ICredentialTypeData {
|
||||
[key: string]: {
|
||||
type: ICredentialType;
|
||||
sourcePath: string;
|
||||
};
|
||||
export type LoadingDetails = {
|
||||
className: string;
|
||||
sourcePath: string;
|
||||
};
|
||||
|
||||
export type KnownNodesAndCredentials = {
|
||||
nodes: Record<string, LoadingDetails>;
|
||||
credentials: Record<string, LoadingDetails>;
|
||||
};
|
||||
|
||||
export interface LoadedClass<T> {
|
||||
sourcePath: string;
|
||||
type: T;
|
||||
}
|
||||
|
||||
export interface INodeTypeData {
|
||||
[key: string]: {
|
||||
type: INodeType | IVersionedNodeType;
|
||||
sourcePath: string;
|
||||
};
|
||||
type LoadedData<T> = Record<string, LoadedClass<T>>;
|
||||
export type ICredentialTypeData = LoadedData<ICredentialType>;
|
||||
export type INodeTypeData = LoadedData<INodeType | IVersionedNodeType>;
|
||||
|
||||
export type LoadedNodesAndCredentials = {
|
||||
nodes: INodeTypeData;
|
||||
credentials: ICredentialTypeData;
|
||||
};
|
||||
|
||||
export interface INodesAndCredentials {
|
||||
known: KnownNodesAndCredentials;
|
||||
loaded: LoadedNodesAndCredentials;
|
||||
}
|
||||
|
||||
export interface IRun {
|
||||
|
||||
Reference in New Issue
Block a user