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

@@ -3,12 +3,11 @@ import {
INodeExecutionData,
INodeType,
INodeTypeDescription,
NodeOperationError
NodeOperationError,
} from 'n8n-workflow';
import { exec } from 'child_process';
export interface IExecReturnData {
exitCode: number;
error?: Error;
@@ -16,7 +15,6 @@ export interface IExecReturnData {
stdout: string;
}
/**
* Promisifiy exec manually to also get the exit code
*
@@ -41,11 +39,12 @@ function execPromise(command: string): Promise<IExecReturnData> {
}
resolve(returnData);
}).on('exit', code => { returnData.exitCode = code || 0; });
}).on('exit', (code) => {
returnData.exitCode = code || 0;
});
});
}
export class ExecuteCommand implements INodeType {
description: INodeTypeDescription = {
displayName: 'Execute Command',
@@ -82,9 +81,7 @@ export class ExecuteCommand implements INodeType {
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
let items = this.getInputData();
let command: string;
@@ -96,35 +93,25 @@ export class ExecuteCommand implements INodeType {
const returnItems: INodeExecutionData[] = [];
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
try{
try {
command = this.getNodeParameter('command', itemIndex) as string;
const {
error,
exitCode,
stdout,
stderr,
} = await execPromise(command);
const { error, exitCode, stdout, stderr } = await execPromise(command);
if (error !== undefined) {
throw new NodeOperationError(this.getNode(), error.message, { itemIndex });
}
returnItems.push(
{
json: {
exitCode,
stderr,
stdout,
},
pairedItem: {
item: itemIndex,
},
returnItems.push({
json: {
exitCode,
stderr,
stdout,
},
);
pairedItem: {
item: itemIndex,
},
});
} catch (error) {
if (this.continueOnFail()) {
returnItems.push({