From 8698e020798c419e86be1c9673e0b95fe9893296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 30 Nov 2022 18:17:57 +0100 Subject: [PATCH] fix: Register community nodes as known nodes (no-changelog) (#4775) --- packages/cli/src/LoadNodesAndCredentials.ts | 4 ++-- packages/core/src/DirectoryLoader.ts | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/LoadNodesAndCredentials.ts b/packages/cli/src/LoadNodesAndCredentials.ts index 4a1c0eff29..af6b6a1460 100644 --- a/packages/cli/src/LoadNodesAndCredentials.ts +++ b/packages/cli/src/LoadNodesAndCredentials.ts @@ -354,12 +354,12 @@ export class LoadNodesAndCredentialsClass implements INodesAndCredentials { } // Nodes and credentials that will be lazy loaded - if (loader instanceof LazyPackageDirectoryLoader) { + if (loader instanceof PackageDirectoryLoader) { const { packageName, known } = loader; for (const type in known.nodes) { const { className, sourcePath } = known.nodes[type]; - this.known.nodes[`${packageName}.${type}`] = { + this.known.nodes[type] = { className, sourcePath: path.join(dir, sourcePath), }; diff --git a/packages/core/src/DirectoryLoader.ts b/packages/core/src/DirectoryLoader.ts index 854e6742a6..57bd66619e 100644 --- a/packages/core/src/DirectoryLoader.ts +++ b/packages/core/src/DirectoryLoader.ts @@ -104,6 +104,11 @@ export abstract class DirectoryLoader { : tmpNode.description.version; } + this.known.nodes[fullNodeName] = { + className: nodeName, + sourcePath: filePath, + }; + this.nodeTypes[fullNodeName] = { type: tempNode, sourcePath: filePath, @@ -139,6 +144,11 @@ export abstract class DirectoryLoader { } } + this.known.credentials[tempCredential.name] = { + className: credentialName, + sourcePath: filePath, + }; + this.credentialTypes[tempCredential.name] = { type: tempCredential, sourcePath: filePath, @@ -319,7 +329,10 @@ export class LazyPackageDirectoryLoader extends PackageDirectoryLoader { await this.readPackageJson(); 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.types.nodes = await this.readJSON('dist/types/nodes.json');