refactor: Format nodes-base package (A-F) (#3800)

* 🔨 prettier formated nodes - A

* 🔨 prettier formated nodes - B

*  prettier formated nodes - C

*  prettier formated nodes - D

*  prettier formated nodes - E-F

* 🎨 Adjust nodes-base formatting command (#3805)

* Format additional files in nodes A-F (#3811)

*  fixes

* 🎨 Add Mindee to ignored dirs

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Michael Kret
2022-08-01 23:47:55 +03:00
committed by GitHub
parent 2c17e6f3ca
commit 0ecbb4a19d
411 changed files with 12906 additions and 20148 deletions

View File

@@ -1,6 +1,4 @@
import {
readFile as fsReadFile,
} from 'fs/promises';
import { readFile as fsReadFile } from 'fs/promises';
import { IExecuteFunctions } from 'n8n-core';
import {
@@ -12,7 +10,6 @@ import {
NodeOperationError,
} from 'n8n-workflow';
export class ExecuteWorkflow implements INodeType {
description: INodeTypeDescription = {
displayName: 'Execute Workflow',
@@ -68,9 +65,7 @@ export class ExecuteWorkflow implements INodeType {
type: 'string',
displayOptions: {
show: {
source: [
'database',
],
source: ['database'],
},
},
default: '',
@@ -87,9 +82,7 @@ export class ExecuteWorkflow implements INodeType {
type: 'string',
displayOptions: {
show: {
source: [
'localFile',
],
source: ['localFile'],
},
},
default: '',
@@ -112,9 +105,7 @@ export class ExecuteWorkflow implements INodeType {
},
displayOptions: {
show: {
source: [
'parameter',
],
source: ['parameter'],
},
},
default: '\n\n\n',
@@ -131,9 +122,7 @@ export class ExecuteWorkflow implements INodeType {
type: 'string',
displayOptions: {
show: {
source: [
'url',
],
source: ['url'],
},
},
default: '',
@@ -142,7 +131,8 @@ export class ExecuteWorkflow implements INodeType {
description: 'The URL from which to load the workflow from',
},
{
displayName: 'Any data you pass into this node will be output by the start node of the workflow to be executed. <a href="https://docs.n8n.io/nodes/n8n-nodes-base.executeworkflow/" target="_blank">More info</a>',
displayName:
'Any data you pass into this node will be output by the start node of the workflow to be executed. <a href="https://docs.n8n.io/nodes/n8n-nodes-base.executeworkflow/" target="_blank">More info</a>',
name: 'executeWorkflowNotice',
type: 'notice',
default: '',
@@ -157,21 +147,22 @@ export class ExecuteWorkflow implements INodeType {
const workflowInfo: IExecuteWorkflowInfo = {};
try {
if (source === 'database') {
// Read workflow from database
workflowInfo.id = this.getNodeParameter('workflowId', 0) as string;
} else if (source === 'localFile') {
// Read workflow from filesystem
const workflowPath = this.getNodeParameter('workflowPath', 0) as string;
let workflowJson;
try {
workflowJson = await fsReadFile(workflowPath, { encoding: 'utf8' }) as string;
workflowJson = (await fsReadFile(workflowPath, { encoding: 'utf8' })) as string;
} catch (error) {
if (error.code === 'ENOENT') {
throw new NodeOperationError(this.getNode(), `The file "${workflowPath}" could not be found.`);
throw new NodeOperationError(
this.getNode(),
`The file "${workflowPath}" could not be found.`,
);
}
throw error;
@@ -182,15 +173,13 @@ export class ExecuteWorkflow implements INodeType {
// Read workflow from parameter
const workflowJson = this.getNodeParameter('workflowJson', 0) as string;
workflowInfo.code = JSON.parse(workflowJson) as IWorkflowBase;
} else if (source === 'url') {
// Read workflow from url
const workflowUrl = this.getNodeParameter('workflowUrl', 0) as string;
const requestOptions = {
headers: {
'accept': 'application/json,text/*;q=0.99',
accept: 'application/json,text/*;q=0.99',
},
method: 'GET',
uri: workflowUrl,
@@ -200,16 +189,14 @@ export class ExecuteWorkflow implements INodeType {
const response = await this.helpers.request(requestOptions);
workflowInfo.code = response;
}
const receivedData = await this.executeWorkflow(workflowInfo, items);
return receivedData;
} catch (error) {
if (this.continueOnFail()) {
return this.prepareOutputData([{json:{ error: error.message }}]);
return this.prepareOutputData([{ json: { error: error.message } }]);
}
throw error;