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,18 +1,8 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
INodeExecutionData,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
import {
awsApiRequestREST,
awsApiRequestRESTAllItems,
} from './GenericFunctions';
import { awsApiRequestREST, awsApiRequestRESTAllItems } from './GenericFunctions';
export class AwsTranscribe implements INodeType {
description: INodeTypeDescription = {
@@ -88,14 +78,8 @@ export class AwsTranscribe implements INodeType {
default: '',
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'create',
'get',
'delete',
],
resource: ['transcriptionJob'],
operation: ['create', 'get', 'delete'],
},
},
description: 'The name of the job',
@@ -107,12 +91,8 @@ export class AwsTranscribe implements INodeType {
default: '',
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'create',
],
resource: ['transcriptionJob'],
operation: ['create'],
},
},
description: 'The S3 object location of the input media file',
@@ -123,16 +103,13 @@ export class AwsTranscribe implements INodeType {
type: 'boolean',
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'create',
],
resource: ['transcriptionJob'],
operation: ['create'],
},
},
default: false,
description: 'Whether to set this field to true to enable automatic language identification',
description:
'Whether to set this field to true to enable automatic language identification',
},
{
displayName: 'Language',
@@ -170,15 +147,9 @@ export class AwsTranscribe implements INodeType {
],
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'create',
],
detectLanguage: [
false,
],
resource: ['transcriptionJob'],
operation: ['create'],
detectLanguage: [false],
},
},
default: 'en-US',
@@ -194,9 +165,7 @@ export class AwsTranscribe implements INodeType {
placeholder: 'Add Option',
displayOptions: {
show: {
operation: [
'create',
],
operation: ['create'],
},
},
default: {},
@@ -207,7 +176,8 @@ export class AwsTranscribe implements INodeType {
type: 'boolean',
default: false,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'Instructs Amazon Transcribe to process each audiochannel separately and then merge the transcription output of each channel into a single transcription. You can\'t set both Max Speaker Labels and Channel Identification in the same request. If you set both, your request returns a BadRequestException.',
description:
"Instructs Amazon Transcribe to process each audiochannel separately and then merge the transcription output of each channel into a single transcription. You can't set both Max Speaker Labels and Channel Identification in the same request. If you set both, your request returns a BadRequestException.",
},
{
displayName: 'Max Alternatives',
@@ -229,7 +199,8 @@ export class AwsTranscribe implements INodeType {
minValue: 2,
maxValue: 10,
},
description: 'The maximum number of speakers to identify in the input audio. If there are more speakers in the audio than this number, multiple speakers are identified as a single speaker.',
description:
'The maximum number of speakers to identify in the input audio. If there are more speakers in the audio than this number, multiple speakers are identified as a single speaker.',
},
{
displayName: 'Vocabulary Name',
@@ -243,7 +214,8 @@ export class AwsTranscribe implements INodeType {
name: 'vocabularyFilterName',
type: 'string',
default: '',
description: 'The name of the vocabulary filter to use when transcribing the audio. The filter that you specify must have the same language code as the transcription job.',
description:
'The name of the vocabulary filter to use when transcribing the audio. The filter that you specify must have the same language code as the transcription job.',
},
{
displayName: 'Vocabulary Filter Method',
@@ -262,10 +234,10 @@ export class AwsTranscribe implements INodeType {
name: 'Tag',
value: 'tag',
},
],
default: 'remove',
description: '<p>Set to mask to remove filtered text from the transcript and replace it with three asterisks ("***") as placeholder text.</p><p>Set to remove to remove filtered text from the transcript without using placeholder text. Set to tag to mark the word in the transcription output that matches the vocabulary filter. When you set the filter method to tag, the words matching your vocabulary filter are not masked or removed.</p>',
description:
'<p>Set to mask to remove filtered text from the transcript and replace it with three asterisks ("***") as placeholder text.</p><p>Set to remove to remove filtered text from the transcript without using placeholder text. Set to tag to mark the word in the transcription output that matches the vocabulary filter. When you set the filter method to tag, the words matching your vocabulary filter are not masked or removed.</p>',
},
],
},
@@ -276,16 +248,13 @@ export class AwsTranscribe implements INodeType {
default: true,
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'get',
],
resource: ['transcriptionJob'],
operation: ['get'],
},
},
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'By default, the response only contains metadata about the transcript. Enable this option to retrieve the transcript instead.',
description:
'By default, the response only contains metadata about the transcript. Enable this option to retrieve the transcript instead.',
},
{
displayName: 'Simplify',
@@ -293,19 +262,14 @@ export class AwsTranscribe implements INodeType {
type: 'boolean',
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'get',
],
returnTranscript: [
true,
],
resource: ['transcriptionJob'],
operation: ['get'],
returnTranscript: [true],
},
},
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
description:
'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Return All',
@@ -313,12 +277,8 @@ export class AwsTranscribe implements INodeType {
type: 'boolean',
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'getAll',
],
resource: ['transcriptionJob'],
operation: ['getAll'],
},
},
default: false,
@@ -334,15 +294,9 @@ export class AwsTranscribe implements INodeType {
},
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['transcriptionJob'],
operation: ['getAll'],
returnAll: [false],
},
},
description: 'Max number of results to return',
@@ -355,12 +309,8 @@ export class AwsTranscribe implements INodeType {
default: {},
displayOptions: {
show: {
resource: [
'transcriptionJob',
],
operation: [
'getAll',
],
resource: ['transcriptionJob'],
operation: ['getAll'],
},
},
options: [
@@ -433,7 +383,9 @@ export class AwsTranscribe implements INodeType {
}
if (options.channelIdentification) {
Object.assign(body.Settings, { ChannelIdentification: options.channelIdentification });
Object.assign(body.Settings, {
ChannelIdentification: options.channelIdentification,
});
}
if (options.maxAlternatives) {
@@ -469,7 +421,14 @@ export class AwsTranscribe implements INodeType {
}
const action = 'Transcribe.StartTranscriptionJob';
responseData = await awsApiRequestREST.call(this, 'transcribe', 'POST', '', JSON.stringify(body), { 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' });
responseData = await awsApiRequestREST.call(
this,
'transcribe',
'POST',
'',
JSON.stringify(body),
{ 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
responseData = responseData.TranscriptionJob;
}
//https://docs.aws.amazon.com/transcribe/latest/dg/API_DeleteTranscriptionJob.html
@@ -481,7 +440,14 @@ export class AwsTranscribe implements INodeType {
};
const action = 'Transcribe.DeleteTranscriptionJob';
responseData = await awsApiRequestREST.call(this, 'transcribe', 'POST', '', JSON.stringify(body), { 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' });
responseData = await awsApiRequestREST.call(
this,
'transcribe',
'POST',
'',
JSON.stringify(body),
{ 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
responseData = { success: true };
}
//https://docs.aws.amazon.com/transcribe/latest/dg/API_GetTranscriptionJob.html
@@ -494,14 +460,29 @@ export class AwsTranscribe implements INodeType {
};
const action = 'Transcribe.GetTranscriptionJob';
responseData = await awsApiRequestREST.call(this, 'transcribe', 'POST', '', JSON.stringify(body), { 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' });
responseData = await awsApiRequestREST.call(
this,
'transcribe',
'POST',
'',
JSON.stringify(body),
{ 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
responseData = responseData.TranscriptionJob;
if (resolve === true && responseData.TranscriptionJobStatus === 'COMPLETED') {
responseData = await this.helpers.request({ method: 'GET', uri: responseData.Transcript.TranscriptFileUri, json: true });
responseData = await this.helpers.request({
method: 'GET',
uri: responseData.Transcript.TranscriptFileUri,
json: true,
});
const simple = this.getNodeParameter('simple', 0) as boolean;
if (simple === true) {
responseData = { transcript: responseData.results.transcripts.map((data: IDataObject) => data.transcript).join(' ') };
responseData = {
transcript: responseData.results.transcripts
.map((data: IDataObject) => data.transcript)
.join(' '),
};
}
}
}
@@ -521,12 +502,26 @@ export class AwsTranscribe implements INodeType {
}
if (returnAll === true) {
responseData = await awsApiRequestRESTAllItems.call(this, 'TranscriptionJobSummaries', 'transcribe', 'POST', '', JSON.stringify(body), { 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' });
responseData = await awsApiRequestRESTAllItems.call(
this,
'TranscriptionJobSummaries',
'transcribe',
'POST',
'',
JSON.stringify(body),
{ 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
} else {
const limit = this.getNodeParameter('limit', i) as number;
body['MaxResults'] = limit;
responseData = await awsApiRequestREST.call(this, 'transcribe', 'POST', '', JSON.stringify(body), { 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' });
responseData = await awsApiRequestREST.call(
this,
'transcribe',
'POST',
'',
JSON.stringify(body),
{ 'x-amz-target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
responseData = responseData.TranscriptionJobSummaries;
}
}
@@ -537,7 +532,6 @@ export class AwsTranscribe implements INodeType {
} else {
returnData.push(responseData as IDataObject);
}
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });