n8n-nodes-commandos-image 0.1.5 → 0.1.6

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.
@@ -31,13 +31,14 @@ const mapRatio = (model, ratio) => {
31
31
  * Maps standard formats to specific model requirements (jpeg vs jpg)
32
32
  */
33
33
  const mapFormat = (model, format) => {
34
+ const f = String(format || 'png').toLowerCase().trim();
34
35
  if (model === 'nano-banana-pro') {
35
- return format === 'jpeg' ? 'jpg' : format;
36
+ return (f === 'jpeg' || f === 'jpg') ? 'jpg' : f;
36
37
  }
37
38
  if (model.includes('google/nano-banana')) {
38
- return format === 'jpg' ? 'jpeg' : format;
39
+ return (f === 'jpeg' || f === 'jpg') ? 'jpeg' : f;
39
40
  }
40
- return format;
41
+ return f;
41
42
  };
42
43
  const buildGenerationRequest = ({ model, prompt, ratio, references, outputFormat = 'png', quality = 'basic', resolution = '1K', }) => {
43
44
  const hasReferences = references.length > 0;
@@ -371,22 +372,16 @@ class CommandosImage {
371
372
  const prompt = String(this.getNodeParameter('prompt', i) || '').trim();
372
373
  const ratio = String(this.getNodeParameter('ratio', i));
373
374
  const references = extractReferences(this.getNodeParameter('references', i, {}), model);
374
- // Get optional parameters with safe fallback
375
- let outputFormat = 'png';
376
- try {
377
- outputFormat = String(this.getNodeParameter('outputFormat', i));
378
- }
379
- catch (e) { }
380
- let quality = 'basic';
381
- try {
382
- quality = String(this.getNodeParameter('quality', i));
383
- }
384
- catch (e) { }
385
- let resolution = '1K';
386
- try {
387
- resolution = String(this.getNodeParameter('resolution', i));
388
- }
389
- catch (e) { }
375
+ // Get optional parameters safely
376
+ const outputFormat = ['nano-banana', 'nano-banana-pro'].includes(model)
377
+ ? String(this.getNodeParameter('outputFormat', i, 'png'))
378
+ : 'png';
379
+ const quality = ['seedream', 'gpt4o-image', 'flux-pro'].includes(model)
380
+ ? String(this.getNodeParameter('quality', i, 'basic'))
381
+ : 'basic';
382
+ const resolution = ['flux-pro', 'nano-banana-pro'].includes(model)
383
+ ? String(this.getNodeParameter('resolution', i, '1K'))
384
+ : '1K';
390
385
  if (!prompt) {
391
386
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Prompt is required', { itemIndex: i });
392
387
  }
@@ -57,13 +57,14 @@ const mapRatio = (model: string, ratio: string): string => {
57
57
  * Maps standard formats to specific model requirements (jpeg vs jpg)
58
58
  */
59
59
  const mapFormat = (model: string, format: string): string => {
60
+ const f = String(format || 'png').toLowerCase().trim();
60
61
  if (model === 'nano-banana-pro') {
61
- return format === 'jpeg' ? 'jpg' : format;
62
+ return (f === 'jpeg' || f === 'jpg') ? 'jpg' : f;
62
63
  }
63
64
  if (model.includes('google/nano-banana')) {
64
- return format === 'jpg' ? 'jpeg' : format;
65
+ return (f === 'jpeg' || f === 'jpg') ? 'jpeg' : f;
65
66
  }
66
- return format;
67
+ return f;
67
68
  };
68
69
 
69
70
  const buildGenerationRequest = ({
@@ -405,15 +406,18 @@ export class CommandosImage implements INodeType {
405
406
  const ratio = String(this.getNodeParameter('ratio', i));
406
407
  const references = extractReferences(this.getNodeParameter('references', i, {}), model);
407
408
 
408
- // Get optional parameters with safe fallback
409
- let outputFormat = 'png';
410
- try { outputFormat = String(this.getNodeParameter('outputFormat', i)); } catch (e) {}
409
+ // Get optional parameters safely
410
+ const outputFormat = ['nano-banana', 'nano-banana-pro'].includes(model)
411
+ ? String(this.getNodeParameter('outputFormat', i, 'png'))
412
+ : 'png';
411
413
 
412
- let quality = 'basic';
413
- try { quality = String(this.getNodeParameter('quality', i)); } catch (e) {}
414
+ const quality = ['seedream', 'gpt4o-image', 'flux-pro'].includes(model)
415
+ ? String(this.getNodeParameter('quality', i, 'basic'))
416
+ : 'basic';
414
417
 
415
- let resolution = '1K';
416
- try { resolution = String(this.getNodeParameter('resolution', i)); } catch (e) {}
418
+ const resolution = ['flux-pro', 'nano-banana-pro'].includes(model)
419
+ ? String(this.getNodeParameter('resolution', i, '1K'))
420
+ : '1K';
417
421
 
418
422
  if (!prompt) {
419
423
  throw new NodeOperationError(this.getNode(), 'Prompt is required', { itemIndex: i });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-commandos-image",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Commandos Image custom node",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",