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 {
FileProperties,
} from '../../Interfaces';
import { FileProperties } from '../../Interfaces';
export const fileDownloadDescription: FileProperties = [
{
@@ -10,12 +8,8 @@ export const fileDownloadDescription: FileProperties = [
required: true,
displayOptions: {
show: {
operation: [
'download',
],
resource: [
'file',
],
operation: ['download'],
resource: ['file'],
},
},
default: '',
@@ -30,12 +24,8 @@ export const fileDownloadDescription: FileProperties = [
description: 'The name of the output field to put the binary file data in',
displayOptions: {
show: {
operation: [
'download',
],
resource: [
'file',
],
operation: ['download'],
resource: ['file'],
},
},
},

View File

@@ -1,15 +1,8 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
INodeExecutionData,
} from 'n8n-workflow';
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
import {
apiRequest,
} from '../../../transport';
import { apiRequest } from '../../../transport';
export async function download(this: IExecuteFunctions, index: number) {
const body: IDataObject = {};
@@ -24,11 +17,14 @@ export async function download(this: IExecuteFunctions, index: number) {
const endpoint = `files/${fileId}/`;
//response
const response = await apiRequest.call(this, requestMethod, endpoint, body, {} as IDataObject,
{ encoding: null, json: false, resolveWithFullResponse: true });
const response = await apiRequest.call(this, requestMethod, endpoint, body, {} as IDataObject, {
encoding: null,
json: false,
resolveWithFullResponse: true,
});
let mimeType = response.headers['content-type'] as string | undefined;
mimeType = mimeType ? mimeType.split(';').find(value => value.includes('/')) : undefined;
mimeType = mimeType ? mimeType.split(';').find((value) => value.includes('/')) : undefined;
const contentDisposition = response.headers['content-disposition'];
const fileNameRegex = /(?<=filename=").*\b/;
const match = fileNameRegex.exec(contentDisposition);
@@ -52,7 +48,11 @@ export async function download(this: IExecuteFunctions, index: number) {
}
newItem.binary = {
[output]: await this.helpers.prepareBinaryData(response.body as unknown as Buffer, fileName, mimeType),
[output]: await this.helpers.prepareBinaryData(
response.body as unknown as Buffer,
fileName,
mimeType,
),
};
return this.prepareOutputData(newItem as unknown as INodeExecutionData[]);

View File

@@ -1,7 +1,4 @@
import { download as execute } from './execute';
import { fileDownloadDescription as description } from './description';
export {
description,
execute,
};
export { description, execute };