mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(core): Live reload node/credential descriptions in development (no-changelog) (#4939)
This commit is contained in:
@@ -32,15 +32,17 @@ export type Types = {
|
||||
};
|
||||
|
||||
export abstract class DirectoryLoader {
|
||||
readonly loadedNodes: INodeTypeNameVersion[] = [];
|
||||
isLazyLoaded = false;
|
||||
|
||||
readonly nodeTypes: INodeTypeData = {};
|
||||
loadedNodes: INodeTypeNameVersion[] = [];
|
||||
|
||||
readonly credentialTypes: ICredentialTypeData = {};
|
||||
nodeTypes: INodeTypeData = {};
|
||||
|
||||
readonly known: KnownNodesAndCredentials = { nodes: {}, credentials: {} };
|
||||
credentialTypes: ICredentialTypeData = {};
|
||||
|
||||
readonly types: Types = { nodes: [], credentials: [] };
|
||||
known: KnownNodesAndCredentials = { nodes: {}, credentials: {} };
|
||||
|
||||
types: Types = { nodes: [], credentials: [] };
|
||||
|
||||
constructor(
|
||||
protected readonly directory: string,
|
||||
@@ -49,8 +51,17 @@ export abstract class DirectoryLoader {
|
||||
) {}
|
||||
|
||||
abstract packageName: string;
|
||||
|
||||
abstract loadAll(): Promise<void>;
|
||||
|
||||
reset() {
|
||||
this.loadedNodes = [];
|
||||
this.nodeTypes = {};
|
||||
this.credentialTypes = {};
|
||||
this.known = { nodes: {}, credentials: {} };
|
||||
this.types = { nodes: [], credentials: [] };
|
||||
}
|
||||
|
||||
protected resolvePath(file: string) {
|
||||
return path.resolve(this.directory, file);
|
||||
}
|
||||
@@ -371,6 +382,8 @@ export class LazyPackageDirectoryLoader extends PackageDirectoryLoader {
|
||||
nodes: this.types.nodes?.length ?? 0,
|
||||
});
|
||||
|
||||
this.isLazyLoaded = true;
|
||||
|
||||
return; // We can load nodes and credentials lazily now
|
||||
} catch {
|
||||
Logger.debug("Can't enable lazy-loading");
|
||||
|
||||
Reference in New Issue
Block a user