1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

fix: Register community nodes as known nodes (no-changelog) (#4775)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-11-30 18:17:57 +01:00 committed by GitHub
parent f3202ee0a8
commit 8698e02079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -354,12 +354,12 @@ export class LoadNodesAndCredentialsClass implements INodesAndCredentials {
} }
// Nodes and credentials that will be lazy loaded // Nodes and credentials that will be lazy loaded
if (loader instanceof LazyPackageDirectoryLoader) { if (loader instanceof PackageDirectoryLoader) {
const { packageName, known } = loader; const { packageName, known } = loader;
for (const type in known.nodes) { for (const type in known.nodes) {
const { className, sourcePath } = known.nodes[type]; const { className, sourcePath } = known.nodes[type];
this.known.nodes[`${packageName}.${type}`] = { this.known.nodes[type] = {
className, className,
sourcePath: path.join(dir, sourcePath), sourcePath: path.join(dir, sourcePath),
}; };

View File

@ -104,6 +104,11 @@ export abstract class DirectoryLoader {
: tmpNode.description.version; : tmpNode.description.version;
} }
this.known.nodes[fullNodeName] = {
className: nodeName,
sourcePath: filePath,
};
this.nodeTypes[fullNodeName] = { this.nodeTypes[fullNodeName] = {
type: tempNode, type: tempNode,
sourcePath: filePath, sourcePath: filePath,
@ -139,6 +144,11 @@ export abstract class DirectoryLoader {
} }
} }
this.known.credentials[tempCredential.name] = {
className: credentialName,
sourcePath: filePath,
};
this.credentialTypes[tempCredential.name] = { this.credentialTypes[tempCredential.name] = {
type: tempCredential, type: tempCredential,
sourcePath: filePath, sourcePath: filePath,
@ -319,7 +329,10 @@ export class LazyPackageDirectoryLoader extends PackageDirectoryLoader {
await this.readPackageJson(); await this.readPackageJson();
try { try {
this.known.nodes = await this.readJSON('dist/known/nodes.json'); const knownNodes: typeof this.known.nodes = await this.readJSON('dist/known/nodes.json');
for (const nodeName in knownNodes) {
this.known.nodes[`${this.packageName}.${nodeName}`] = knownNodes[nodeName];
}
this.known.credentials = await this.readJSON('dist/known/credentials.json'); this.known.credentials = await this.readJSON('dist/known/credentials.json');
this.types.nodes = await this.readJSON('dist/types/nodes.json'); this.types.nodes = await this.readJSON('dist/types/nodes.json');