import { IExecuteFunctions, } from 'n8n-core'; import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription, } from 'n8n-workflow'; import { awsApiRequestREST, awsApiRequestRESTAllItems, } from './GenericFunctions'; export class AwsTranscribe implements INodeType { description: INodeTypeDescription = { displayName: 'AWS Transcribe', name: 'awsTranscribe', icon: 'file:transcribe.svg', group: ['output'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Sends data to AWS Transcribe', defaults: { name: 'AWS Transcribe', }, inputs: ['main'], outputs: ['main'], credentials: [ { name: 'aws', required: true, }, ], properties: [ { displayName: 'Resource', name: 'resource', type: 'options', noDataExpression: true, options: [ { name: 'Transcription Job', value: 'transcriptionJob', }, ], default: 'transcriptionJob', }, { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, options: [ { name: 'Create', value: 'create', description: 'Create a transcription job', }, { name: 'Delete', value: 'delete', description: 'Delete a transcription job', }, { name: 'Get', value: 'get', description: 'Get a transcription job', }, { name: 'Get All', value: 'getAll', description: 'Get all transcription jobs', }, ], default: 'create', }, { displayName: 'Job Name', name: 'transcriptionJobName', type: 'string', default: '', displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'create', 'get', 'delete', ], }, }, description: 'The name of the job', }, { displayName: 'Media File URI', name: 'mediaFileUri', type: 'string', default: '', displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'create', ], }, }, description: 'The S3 object location of the input media file', }, { displayName: 'Detect Language', name: 'detectLanguage', type: 'boolean', displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'create', ], }, }, default: false, description: 'Set this field to true to enable automatic language identification', }, { displayName: 'Language', name: 'languageCode', type: 'options', options: [ { name: 'American English', value: 'en-US', }, { name: 'British English', value: 'en-GB', }, { name: 'Irish English', value: 'en-IE', }, { name: 'Indian English', value: 'en-IN', }, { name: 'Spanish', value: 'es-ES', }, { name: 'German', value: 'de-DE', }, { name: 'Russian', value: 'ru-RU', }, ], displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'create', ], detectLanguage: [ false, ], }, }, default: 'en-US', description: 'Language used in the input media file', }, // ---------------------------------- // Transcription Job Settings // ---------------------------------- { displayName: 'Options', name: 'options', type: 'collection', placeholder: 'Add Option', displayOptions: { show: { operation: [ 'create', ], }, }, default: {}, options: [ { displayName: 'Channel Identification', name: 'channelIdentification', type: 'boolean', default: false, 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', name: 'maxAlternatives', type: 'number', default: 2, typeOptions: { minValue: 2, maxValue: 10, }, description: 'The number of alternative transcriptions that the service should return', }, { displayName: 'Max Speaker Labels', name: 'maxSpeakerLabels', type: 'number', default: 2, typeOptions: { 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.', }, { displayName: 'Vocabulary Name', name: 'vocabularyName', type: 'string', default: '', description: 'Name of vocabulary to use when processing the transcription job', }, { displayName: 'Vocabulary Filter Name', 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.', }, { displayName: 'Vocabulary Filter Method', name: 'vocabularyFilterMethod', type: 'options', options: [ { name: 'Remove', value: 'remove', }, { name: 'Mask', value: 'mask', }, { name: 'Tag', value: 'tag', }, ], default: 'remove', description: '
Set to mask to remove filtered text from the transcript and replace it with three asterisks ("***") as placeholder text.
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.
', }, ], }, { displayName: 'Return Transcript', name: 'returnTranscript', type: 'boolean', default: true, displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'get', ], }, }, description: 'By default, the response only contains metadata about the transcript. Enable this option to retrieve the transcript instead.', }, { displayName: 'Simplify', name: 'simple', type: 'boolean', displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'get', ], returnTranscript: [ true, ], }, }, default: true, description: 'Whether to return a simplified version of the response instead of the raw data', }, { displayName: 'Return All', name: 'returnAll', type: 'boolean', displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'getAll', ], }, }, default: false, description: 'Whether to return all results or only up to a given limit', }, { displayName: 'Limit', name: 'limit', type: 'number', default: 20, typeOptions: { minValue: 1, }, displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'getAll', ], returnAll: [ false, ], }, }, description: 'Max number of results to return', }, { displayName: 'Filters', name: 'filters', type: 'collection', placeholder: 'Add Filter', default: {}, displayOptions: { show: { resource: [ 'transcriptionJob', ], operation: [ 'getAll', ], }, }, options: [ { displayName: 'Job Name Contains', name: 'jobNameContains', type: 'string', description: 'Return only transcription jobs whose name contains the specified string', default: '', }, { displayName: 'Status', name: 'status', type: 'options', options: [ { name: 'Completed', value: 'COMPLETED', }, { name: 'Failed', value: 'FAILED', }, { name: 'In Progress', value: 'IN_PROGRESS', }, { name: 'Queued', value: 'QUEUED', }, ], description: 'Return only transcription jobs with the specified status', default: 'COMPLETED', }, ], }, ], }; async execute(this: IExecuteFunctions): Promise