@andresaya/n8n-nodes-edgetts
Version:
n8n node for Edge TTS - Text-to-Speech using Microsoft Edge capabilities
67 lines • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EdgeTts = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const properties_1 = require("./properties");
const execute_1 = require("./execute");
class EdgeTts {
constructor() {
this.description = {
displayName: 'Edge TTS',
name: 'edgeTts',
icon: 'file:edgetts.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Text-to-Speech using Microsoft Edge capabilities',
defaults: {
name: 'Edge TTS',
},
inputs: ['main'],
outputs: ['main'],
properties: properties_1.edgeTTSNodeProperties,
};
}
async execute() {
var _a;
const items = this.getInputData();
const returnData = [];
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
try {
const fn = (_a = execute_1.operationsFunctions[resource]) === null || _a === void 0 ? void 0 : _a[operation];
if (!fn) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported for resource "${resource}"`);
}
for (let i = 0; i < items.length; i++) {
try {
const responseData = await fn.call(this, i);
if (Array.isArray(responseData)) {
returnData.push(...responseData);
}
else {
returnData.push({ json: responseData });
}
}
catch (error) {
if (this.continueOnFail()) {
returnData.push({
json: {
error: error.message,
},
pairedItem: { item: i },
});
continue;
}
throw error;
}
}
return [returnData];
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
}
exports.EdgeTts = EdgeTts;
//# sourceMappingURL=EdgeTts.node.js.map