@neosapience/n8n-nodes-typecast 1.2.2 → 1.2.4

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.
@@ -35,10 +35,17 @@ function guessAudioMime(filename: string, fallback: string | undefined, node: IN
35
35
  );
36
36
  }
37
37
 
38
- function normalizeClonedVoiceResponse(response: IDataObject, fallbackName: string, fallbackModel: string) {
38
+ function normalizeClonedVoiceResponse(
39
+ response: IDataObject,
40
+ fallbackName: string,
41
+ fallbackModel: string,
42
+ ) {
39
43
  const payload = (response.result || response.data || response) as IDataObject;
40
44
  const voiceId = (payload.voice_id || payload.voiceId) as string | undefined;
41
- const voiceName = (payload.name || payload.voice_name || payload.voiceName || fallbackName) as string;
45
+ const voiceName = (payload.name ||
46
+ payload.voice_name ||
47
+ payload.voiceName ||
48
+ fallbackName) as string;
42
49
  const model = (payload.model || fallbackModel) as string;
43
50
 
44
51
  return {
@@ -278,20 +285,23 @@ export class Typecast implements INodeType {
278
285
  form.append('model', model);
279
286
  form.append('file', new Blob([audioBytes], { type: mimeType }), filename);
280
287
 
281
- const response = await typecastApiRequestFormData.call(
288
+ const response = (await typecastApiRequestFormData.call(
282
289
  this,
283
290
  'POST',
284
291
  '/voices/clone',
285
292
  form,
286
293
  {},
287
294
  'v1',
288
- ) as IDataObject;
295
+ )) as IDataObject;
289
296
  const clonedVoice = normalizeClonedVoiceResponse(response, name, model);
290
297
 
291
298
  returnData.push(
292
- ...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(clonedVoice), {
293
- itemData: { item: i },
294
- }),
299
+ ...this.helpers.constructExecutionMetaData(
300
+ this.helpers.returnJsonArray(clonedVoice),
301
+ {
302
+ itemData: { item: i },
303
+ },
304
+ ),
295
305
  );
296
306
  }
297
307
 
@@ -355,6 +365,28 @@ export class Typecast implements INodeType {
355
365
  );
356
366
  }
357
367
 
368
+ // ----------------------------------
369
+ // voice:recommend
370
+ // ----------------------------------
371
+ if (operation === 'recommend') {
372
+ const query = this.getNodeParameter('recommendQuery', i) as string;
373
+ const count = this.getNodeParameter('recommendCount', i) as number;
374
+ const qs: IDataObject = { query, count };
375
+ const response = await typecastApiRequest.call(
376
+ this,
377
+ 'GET',
378
+ '/voices/recommendations',
379
+ {},
380
+ qs,
381
+ 'v1',
382
+ );
383
+ returnData.push(
384
+ ...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), {
385
+ itemData: { item: i },
386
+ }),
387
+ );
388
+ }
389
+
358
390
  // ----------------------------------
359
391
  // voice:getOne
360
392
  // ----------------------------------
@@ -484,11 +516,7 @@ export class Typecast implements INodeType {
484
516
  const output: IDataObject = {};
485
517
  const targetLufs = additionalOptions.targetLufs;
486
518
  const volumeOpt = additionalOptions.volume;
487
- if (
488
- targetLufs !== undefined &&
489
- volumeOpt !== undefined &&
490
- volumeOpt !== 100
491
- ) {
519
+ if (targetLufs !== undefined && volumeOpt !== undefined && volumeOpt !== 100) {
492
520
  throw new NodeOperationError(
493
521
  this.getNode(),
494
522
  'target_lufs is mutually exclusive with a custom volume; leave Volume unset (default 100) or unset Target LUFS.',
@@ -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
  ],
@@ -38,6 +38,12 @@ export const voiceDescription: INodeProperties[] = [
38
38
  description: 'Get detailed information about a single voice by ID',
39
39
  action: 'Get a voice',
40
40
  },
41
+ {
42
+ name: 'Recommend Voices',
43
+ value: 'recommend',
44
+ description: 'Recommend voices from a text description',
45
+ action: 'Recommend voices',
46
+ },
41
47
  ],
42
48
  default: 'getMany',
43
49
  },
@@ -138,6 +144,44 @@ export const voiceDescription: INodeProperties[] = [
138
144
  description: 'The voice ID to look up via the V2 voices endpoint',
139
145
  },
140
146
  // ----------------------------------
147
+ // voice:recommend
148
+ // ----------------------------------
149
+ {
150
+ displayName: 'Query',
151
+ name: 'recommendQuery',
152
+ type: 'string',
153
+ required: true,
154
+ displayOptions: {
155
+ show: {
156
+ resource: ['voice'],
157
+ operation: ['recommend'],
158
+ },
159
+ },
160
+ default: '',
161
+ placeholder: 'e.g., warm female voice for product tutorial',
162
+ description:
163
+ 'Text description of the desired voice style, mood, language, use case, or content context',
164
+ },
165
+ {
166
+ displayName: 'Count',
167
+ name: 'recommendCount',
168
+ type: 'number',
169
+ required: true,
170
+ displayOptions: {
171
+ show: {
172
+ resource: ['voice'],
173
+ operation: ['recommend'],
174
+ },
175
+ },
176
+ typeOptions: {
177
+ minValue: 1,
178
+ maxValue: 10,
179
+ },
180
+ default: 5,
181
+ description:
182
+ 'Maximum number of recommended voices to return. The response contains voice_id, voice_name, and score only; use Get Voice or Get All Voices for detailed metadata.',
183
+ },
184
+ // ----------------------------------
141
185
  // voice:getMany
142
186
  // ----------------------------------
143
187
  {
@@ -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 = errorData.message || 'Unknown error';
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.2",
3
+ "version": "1.2.4",
4
4
  "description": "n8n node for Typecast TTS API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -59,12 +59,12 @@
59
59
  ]
60
60
  },
61
61
  "devDependencies": {
62
- "@n8n/node-cli": "^0.32.1",
63
- "@types/node": "^25.6.2",
64
- "eslint": "^9.32.0",
62
+ "@n8n/node-cli": "^0.40.3",
63
+ "@types/node": "^26.1.1",
64
+ "eslint": "9.39.5",
65
65
  "n8n-workflow": "^2.16.0",
66
- "prettier": "^3.8.3",
67
- "typescript": "^5.9.2"
66
+ "prettier": "^3.9.5",
67
+ "typescript": "^6.0.3"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "n8n-workflow": "*"