@neosapience/n8n-nodes-typecast 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/nodes/Typecast/Typecast.node.js +20 -9
- package/dist/nodes/Typecast/Typecast.node.js.map +1 -1
- package/dist/nodes/Typecast/resources/speech/index.js +8 -0
- package/dist/nodes/Typecast/resources/speech/index.js.map +1 -1
- package/dist/nodes/Typecast/resources/subscription/index.js.map +1 -1
- package/dist/nodes/Typecast/resources/voice/index.js +1 -1
- package/dist/nodes/Typecast/shared/output.d.ts +2 -0
- package/dist/nodes/Typecast/shared/output.js +12 -0
- package/dist/nodes/Typecast/shared/output.js.map +1 -0
- package/dist/nodes/Typecast/shared/transport.js +6 -3
- package/dist/nodes/Typecast/shared/transport.js.map +1 -1
- package/dist/package.json +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/Typecast/Typecast.node.ts +20 -10
- package/nodes/Typecast/resources/speech/index.ts +9 -0
- package/nodes/Typecast/resources/subscription/index.ts +1 -2
- package/nodes/Typecast/resources/voice/index.ts +1 -1
- package/nodes/Typecast/shared/output.ts +9 -0
- package/nodes/Typecast/shared/transport.ts +6 -2
- package/package.json +5 -5
|
@@ -21,9 +21,20 @@ import {
|
|
|
21
21
|
import { voiceDescription } from './resources/voice';
|
|
22
22
|
import { speechDescription } from './resources/speech';
|
|
23
23
|
import { subscriptionDescription } from './resources/subscription';
|
|
24
|
+
import { silenceOutput } from './shared/output';
|
|
24
25
|
|
|
25
26
|
const CLONING_MAX_FILE_SIZE = 25 * 1024 * 1024;
|
|
26
27
|
|
|
28
|
+
function voiceDisplayName(voice: IDataObject): string {
|
|
29
|
+
const name = voice.voice_name;
|
|
30
|
+
if (typeof name === 'string') return name;
|
|
31
|
+
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
32
|
+
const localized = name as IDataObject;
|
|
33
|
+
return (localized.eng || localized.kor || Object.values(localized)[0] || voice.voice_id) as string;
|
|
34
|
+
}
|
|
35
|
+
return voice.voice_id as string;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
function guessAudioMime(filename: string, fallback: string | undefined, node: INode): string {
|
|
28
39
|
const lower = filename.toLowerCase();
|
|
29
40
|
if (lower.endsWith('.wav')) return 'audio/wav';
|
|
@@ -130,15 +141,14 @@ export class Typecast implements INodeType {
|
|
|
130
141
|
qs.model = model;
|
|
131
142
|
}
|
|
132
143
|
|
|
133
|
-
|
|
134
|
-
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v2');
|
|
144
|
+
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v3');
|
|
135
145
|
|
|
136
146
|
// Process the response - it could be an array directly or wrapped in a result object
|
|
137
147
|
const voices = Array.isArray(response) ? response : response.result || [];
|
|
138
148
|
|
|
139
149
|
for (const voice of voices) {
|
|
140
150
|
const voiceId = voice.voice_id;
|
|
141
|
-
const voiceName = voice
|
|
151
|
+
const voiceName = voiceDisplayName(voice);
|
|
142
152
|
const gender = voice.gender
|
|
143
153
|
? voice.gender.charAt(0).toUpperCase() + voice.gender.slice(1)
|
|
144
154
|
: 'Unknown';
|
|
@@ -288,7 +298,7 @@ export class Typecast implements INodeType {
|
|
|
288
298
|
const response = (await typecastApiRequestFormData.call(
|
|
289
299
|
this,
|
|
290
300
|
'POST',
|
|
291
|
-
'/voices/clone',
|
|
301
|
+
'/custom-voices/instant-clone',
|
|
292
302
|
form,
|
|
293
303
|
{},
|
|
294
304
|
'v1',
|
|
@@ -321,7 +331,7 @@ export class Typecast implements INodeType {
|
|
|
321
331
|
await typecastApiRequestNoContent.call(
|
|
322
332
|
this,
|
|
323
333
|
'DELETE',
|
|
324
|
-
`/voices/${encodeURIComponent(voiceId)}`,
|
|
334
|
+
`/custom-voices/${encodeURIComponent(voiceId)}`,
|
|
325
335
|
{},
|
|
326
336
|
'v1',
|
|
327
337
|
);
|
|
@@ -357,7 +367,7 @@ export class Typecast implements INodeType {
|
|
|
357
367
|
qs.use_cases = filters.use_cases;
|
|
358
368
|
}
|
|
359
369
|
|
|
360
|
-
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, '
|
|
370
|
+
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v3');
|
|
361
371
|
returnData.push(
|
|
362
372
|
...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), {
|
|
363
373
|
itemData: { item: i },
|
|
@@ -398,7 +408,7 @@ export class Typecast implements INodeType {
|
|
|
398
408
|
`/voices/${encodeURIComponent(voiceId)}`,
|
|
399
409
|
{},
|
|
400
410
|
{},
|
|
401
|
-
'
|
|
411
|
+
'v3',
|
|
402
412
|
);
|
|
403
413
|
returnData.push(
|
|
404
414
|
...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), {
|
|
@@ -513,7 +523,7 @@ export class Typecast implements INodeType {
|
|
|
513
523
|
}
|
|
514
524
|
|
|
515
525
|
// Add output settings (target_lufs is mutually exclusive with volume)
|
|
516
|
-
const output: IDataObject =
|
|
526
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
517
527
|
const targetLufs = additionalOptions.targetLufs;
|
|
518
528
|
const volumeOpt = additionalOptions.volume;
|
|
519
529
|
if (targetLufs !== undefined && volumeOpt !== undefined && volumeOpt !== 100) {
|
|
@@ -643,7 +653,7 @@ export class Typecast implements INodeType {
|
|
|
643
653
|
}
|
|
644
654
|
|
|
645
655
|
// Streaming output rejects volume, but supports target_lufs.
|
|
646
|
-
const output: IDataObject =
|
|
656
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
647
657
|
if (
|
|
648
658
|
additionalOptions.targetLufs !== undefined &&
|
|
649
659
|
additionalOptions.volume !== undefined &&
|
|
@@ -775,7 +785,7 @@ export class Typecast implements INodeType {
|
|
|
775
785
|
|
|
776
786
|
// with-timestamps accepts the same Output object as textToSpeech.
|
|
777
787
|
// Volume and target_lufs are mutually exclusive at the server.
|
|
778
|
-
const output: IDataObject =
|
|
788
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
779
789
|
const targetLufs = additionalOptions.targetLufs;
|
|
780
790
|
const volume = additionalOptions.volume;
|
|
781
791
|
if (targetLufs !== undefined && volume !== undefined && volume !== 100) {
|
|
@@ -602,6 +602,15 @@ export const speechDescription: INodeProperties[] = [
|
|
|
602
602
|
description:
|
|
603
603
|
'Language code following ISO 639-3 standard Case-insensitive (both "ENG" and "eng" are accepted). If not provided, language will be auto-detected based on text content. ssfm-v30 supports 37 languages, ssfm-v21 supports 27 languages.',
|
|
604
604
|
},
|
|
605
|
+
{
|
|
606
|
+
displayName: 'Remaining Silence (Ms)',
|
|
607
|
+
name: 'removeSilenceMs',
|
|
608
|
+
type: 'number',
|
|
609
|
+
typeOptions: { minValue: 0, maxValue: 1000, numberPrecision: 0 },
|
|
610
|
+
default: 300,
|
|
611
|
+
description:
|
|
612
|
+
'Remaining detected silence in milliseconds (0–1000). Zero removes silence; omit this option to disable. Streaming playback may need additional buffering.',
|
|
613
|
+
},
|
|
605
614
|
{
|
|
606
615
|
displayName: 'Seed',
|
|
607
616
|
name: 'seed',
|
|
@@ -17,8 +17,7 @@ export const subscriptionDescription: INodeProperties[] = [
|
|
|
17
17
|
{
|
|
18
18
|
name: 'Get My Subscription',
|
|
19
19
|
value: 'getMy',
|
|
20
|
-
description:
|
|
21
|
-
'Return the authenticated user plan tier, credits, and concurrency limit',
|
|
20
|
+
description: 'Return the authenticated user plan tier, credits, and concurrency limit',
|
|
22
21
|
action: 'Get my subscription',
|
|
23
22
|
},
|
|
24
23
|
],
|
|
@@ -141,7 +141,7 @@ export const voiceDescription: INodeProperties[] = [
|
|
|
141
141
|
},
|
|
142
142
|
default: '',
|
|
143
143
|
placeholder: 'e.g., tc_672c5f5ce59fac2a48faeaee',
|
|
144
|
-
description: 'The voice ID to look up via the
|
|
144
|
+
description: 'The voice ID to look up via the V3 voices endpoint',
|
|
145
145
|
},
|
|
146
146
|
// ----------------------------------
|
|
147
147
|
// voice:recommend
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
export function silenceOutput(value: unknown): IDataObject {
|
|
4
|
+
if (value === undefined || value === null) return {};
|
|
5
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 0 || value > 1000) {
|
|
6
|
+
throw new Error('Remaining Silence must be an integer between 0 and 1000 ms');
|
|
7
|
+
}
|
|
8
|
+
return { remove_silence_ms: value };
|
|
9
|
+
}
|
|
@@ -17,10 +17,14 @@ function throwTypecastApiError(
|
|
|
17
17
|
const errorData = error as {
|
|
18
18
|
message?: string;
|
|
19
19
|
httpCode?: number | string;
|
|
20
|
-
errorResponse?: { error_code?: string };
|
|
20
|
+
errorResponse?: { error_code?: string; message?: string; detail?: string };
|
|
21
21
|
error_code?: string;
|
|
22
22
|
};
|
|
23
|
-
const errorMessage =
|
|
23
|
+
const errorMessage =
|
|
24
|
+
errorData.errorResponse?.message ||
|
|
25
|
+
errorData.errorResponse?.detail ||
|
|
26
|
+
errorData.message ||
|
|
27
|
+
'Unknown error';
|
|
24
28
|
const statusCode = errorData.httpCode;
|
|
25
29
|
const errorCode = errorData.errorResponse?.error_code || errorData.error_code;
|
|
26
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neosapience/n8n-nodes-typecast",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "n8n node for Typecast TTS API integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@n8n/node-cli": "^0.
|
|
63
|
-
"@types/node": "^26.
|
|
64
|
-
"eslint": "
|
|
62
|
+
"@n8n/node-cli": "^0.46.1",
|
|
63
|
+
"@types/node": "^26.1.1",
|
|
64
|
+
"eslint": "9.39.5",
|
|
65
65
|
"n8n-workflow": "^2.16.0",
|
|
66
|
-
"prettier": "^3.
|
|
66
|
+
"prettier": "^3.9.5",
|
|
67
67
|
"typescript": "^6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|