From ffeb2f8b6241933f5829f9160189e92d79d0441e Mon Sep 17 00:00:00 2001 From: ALEXANDER MA COTE Date: Tue, 2 Jun 2020 17:24:01 -0400 Subject: [PATCH 1/4] :zap: Fix Switch Node description (#611) --- packages/nodes-base/nodes/Switch.node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Switch.node.ts b/packages/nodes-base/nodes/Switch.node.ts index 3702a7c598..80b3845bca 100644 --- a/packages/nodes-base/nodes/Switch.node.ts +++ b/packages/nodes-base/nodes/Switch.node.ts @@ -32,7 +32,7 @@ export class Switch implements INodeType { { name: 'Expression', value: 'expression', - description: 'Expression decides how to route date.', + description: 'Expression decides how to route data.', }, { name: 'Rules', From a1da8425e41a5bffcb88e89028575036843ef557 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Wed, 3 Jun 2020 15:25:43 +0200 Subject: [PATCH 2/4] :bug: Fix operationName bug in GraphQL-Node --- packages/nodes-base/nodes/GraphQL/GraphQL.node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts index ac4b1f80e3..e9ba60b6dd 100644 --- a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts +++ b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts @@ -246,7 +246,7 @@ export class GraphQL implements INodeType { } } if (requestOptions.body.operationName === '') { - requestOptions.body.operation = null; + requestOptions.body.operationName = null; } requestOptions.json = true; } else { From e19cd9c11818335d2da787f597bab6c16d789657 Mon Sep 17 00:00:00 2001 From: Tei1988 Date: Thu, 4 Jun 2020 02:40:39 +0900 Subject: [PATCH 3/4] :sparkles: Add support for scoped npm packages (#612) --- packages/cli/src/LoadNodesAndCredentials.ts | 34 ++++++++++++--------- packages/cli/src/Server.ts | 4 +-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/packages/cli/src/LoadNodesAndCredentials.ts b/packages/cli/src/LoadNodesAndCredentials.ts index 0d0eb21df3..f66fdd5e95 100644 --- a/packages/cli/src/LoadNodesAndCredentials.ts +++ b/packages/cli/src/LoadNodesAndCredentials.ts @@ -97,24 +97,28 @@ class LoadNodesAndCredentialsClass { * @memberof LoadNodesAndCredentialsClass */ async getN8nNodePackages(): Promise { - const packages: string[] = []; - for (const file of await fsReaddirAsync(this.nodeModulesPath)) { - if (file.indexOf('n8n-nodes-') !== 0) { - continue; - } - - // Check if it is really a folder - if (!(await fsStatAsync(path.join(this.nodeModulesPath, file))).isDirectory()) { - continue; - } - - packages.push(file); + const getN8nNodePackagesRecursive = async (relativePath: string): Promise => { + const results: string[] = []; + const nodeModulesPath = `${this.nodeModulesPath}/${relativePath}`; + for (const file of await fsReaddirAsync(nodeModulesPath)) { + const isN8nNodesPackage = file.indexOf('n8n-nodes-') === 0; + const isNpmScopedPackage = file.indexOf('@') === 0; + if (!isN8nNodesPackage && !isNpmScopedPackage) { + continue; + } + if (!(await fsStatAsync(nodeModulesPath)).isDirectory()) { + continue; + } + if (isN8nNodesPackage) { results.push(`${relativePath}${file}`); } + if (isNpmScopedPackage) { + results.push(...await getN8nNodePackagesRecursive(`${relativePath}${file}/`)); + } + } + return results; } - - return packages; + return getN8nNodePackagesRecursive(''); } - /** * Loads credentials from a file * diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index d078c8594e..6d071a85a0 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -597,8 +597,8 @@ class App { // Returns the node icon - this.app.get('/rest/node-icon/:nodeType', async (req: express.Request, res: express.Response): Promise => { - const nodeTypeName = req.params.nodeType; + this.app.get(['/rest/node-icon/:nodeType', '/rest/node-icon/:scope/:nodeType'], async (req: express.Request, res: express.Response): Promise => { + const nodeTypeName = `${req.params.scope ? `${req.params.scope}/` : ''}${req.params.nodeType}`; const nodeTypes = NodeTypes(); const nodeType = nodeTypes.getByName(nodeTypeName); From 35c149c7b1afa5e6b4380663f2d01ad7959747ca Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Wed, 3 Jun 2020 19:58:55 +0200 Subject: [PATCH 4/4] :zap: Fix small issue --- packages/cli/src/LoadNodesAndCredentials.ts | 4 ++-- packages/cli/src/Server.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/LoadNodesAndCredentials.ts b/packages/cli/src/LoadNodesAndCredentials.ts index f66fdd5e95..512c689233 100644 --- a/packages/cli/src/LoadNodesAndCredentials.ts +++ b/packages/cli/src/LoadNodesAndCredentials.ts @@ -113,9 +113,9 @@ class LoadNodesAndCredentialsClass { if (isNpmScopedPackage) { results.push(...await getN8nNodePackagesRecursive(`${relativePath}${file}/`)); } - } + } return results; - } + }; return getN8nNodePackagesRecursive(''); } diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 6d071a85a0..02b4afb29e 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -563,7 +563,7 @@ class App { const nodeTypes = NodeTypes(); - const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, credentials); + const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, credentials!); const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase; const workflowCredentials = await WorkflowCredentials(workflowData.nodes);