🔀 Merge branch 'master' into oauth-support

This commit is contained in:
Jan Oberhauser 2020-06-04 09:44:21 +02:00
commit f9b3cced5c
4 changed files with 24 additions and 20 deletions

View file

@ -97,24 +97,28 @@ class LoadNodesAndCredentialsClass {
* @memberof LoadNodesAndCredentialsClass * @memberof LoadNodesAndCredentialsClass
*/ */
async getN8nNodePackages(): Promise<string[]> { async getN8nNodePackages(): Promise<string[]> {
const packages: string[] = []; const getN8nNodePackagesRecursive = async (relativePath: string): Promise<string[]> => {
for (const file of await fsReaddirAsync(this.nodeModulesPath)) { const results: string[] = [];
if (file.indexOf('n8n-nodes-') !== 0) { const nodeModulesPath = `${this.nodeModulesPath}/${relativePath}`;
continue; 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;
// Check if it is really a folder };
if (!(await fsStatAsync(path.join(this.nodeModulesPath, file))).isDirectory()) { return getN8nNodePackagesRecursive('');
continue;
}
packages.push(file);
}
return packages;
} }
/** /**
* Loads credentials from a file * Loads credentials from a file
* *

View file

@ -573,7 +573,7 @@ class App {
const nodeTypes = NodeTypes(); const nodeTypes = NodeTypes();
const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, JSON.parse('' + req.query.currentNodeParameters), credentials); const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, JSON.parse('' + req.query.currentNodeParameters), credentials!);
const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase; const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase;
const workflowCredentials = await WorkflowCredentials(workflowData.nodes); const workflowCredentials = await WorkflowCredentials(workflowData.nodes);
@ -607,8 +607,8 @@ class App {
// Returns the node icon // Returns the node icon
this.app.get('/rest/node-icon/:nodeType', async (req: express.Request, res: express.Response): Promise<void> => { this.app.get(['/rest/node-icon/:nodeType', '/rest/node-icon/:scope/:nodeType'], async (req: express.Request, res: express.Response): Promise<void> => {
const nodeTypeName = req.params.nodeType; const nodeTypeName = `${req.params.scope ? `${req.params.scope}/` : ''}${req.params.nodeType}`;
const nodeTypes = NodeTypes(); const nodeTypes = NodeTypes();
const nodeType = nodeTypes.getByName(nodeTypeName); const nodeType = nodeTypes.getByName(nodeTypeName);

View file

@ -246,7 +246,7 @@ export class GraphQL implements INodeType {
} }
} }
if (requestOptions.body.operationName === '') { if (requestOptions.body.operationName === '') {
requestOptions.body.operation = null; requestOptions.body.operationName = null;
} }
requestOptions.json = true; requestOptions.json = true;
} else { } else {

View file

@ -32,7 +32,7 @@ export class Switch implements INodeType {
{ {
name: 'Expression', name: 'Expression',
value: 'expression', value: 'expression',
description: 'Expression decides how to route date.', description: 'Expression decides how to route data.',
}, },
{ {
name: 'Rules', name: 'Rules',