n8n-nodes-supermachine 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.
@@ -429,7 +429,9 @@ class Supermachine {
429
429
  if (!model) {
430
430
  throw new Error(`Model "${modelTitle}" not found`);
431
431
  }
432
- requestOptions.url = `https://dev.supermachine.art/v1/models/gems/id/${model.id}`;
432
+ // FIX v1.2.3: Return model detail directly instead of wrong endpoint
433
+ returnData.push({ json: model });
434
+ continue;
433
435
  }
434
436
  else if (operation === 'listModelCategories') {
435
437
  requestOptions.url = 'https://dev.supermachine.art/v1/models/categories';
@@ -455,6 +457,38 @@ class Supermachine {
455
457
  if (operation === 'listModels' || operation === 'listLoras') {
456
458
  jsonData = responseData;
457
459
  }
460
+ else if (operation === 'customApiCall') {
461
+ const method = this.getNodeParameter('method', i);
462
+ const path = this.getNodeParameter('path', i);
463
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
464
+ const baseUrl = 'https://dev.supermachine.art';
465
+ const fullUrl = path.startsWith('/') ? `${baseUrl}${path}` : `${baseUrl}/${path}`;
466
+ const requestOptions = {
467
+ method: method,
468
+ url: fullUrl,
469
+ json: true,
470
+ };
471
+ if (additionalFields.queryParameters) {
472
+ try {
473
+ const queryParams = JSON.parse(additionalFields.queryParameters);
474
+ requestOptions.qs = queryParams;
475
+ }
476
+ catch (error) {
477
+ throw new Error('Invalid JSON in Query Parameters field');
478
+ }
479
+ }
480
+ if (['POST', 'PUT', 'PATCH'].includes(method) && additionalFields.body) {
481
+ try {
482
+ const bodyData = JSON.parse(additionalFields.body);
483
+ requestOptions.body = bodyData;
484
+ }
485
+ catch (error) {
486
+ throw new Error('Invalid JSON in Body field');
487
+ }
488
+ }
489
+ const responseData = await this.helpers.requestWithAuthentication.call(this, 'supermachineApi', requestOptions);
490
+ returnData.push({ json: responseData });
491
+ }
458
492
  else {
459
493
  jsonData = responseData.items || responseData;
460
494
  }
@@ -13,6 +13,12 @@ exports.getAccountOperations = [
13
13
  },
14
14
  },
15
15
  options: [
16
+ {
17
+ name: 'Custom API Call',
18
+ value: 'customApiCall',
19
+ description: 'Make a custom API call to any Supermachine endpoint',
20
+ action: 'Make a custom API call',
21
+ },
16
22
  {
17
23
  name: 'Get Profile',
18
24
  value: 'getProfile',
@@ -66,6 +72,82 @@ exports.getAccountOperations = [
66
72
  },
67
73
  ];
68
74
  exports.getAccountFields = [
75
+ // ═══════════════════════════════════════════════════════════
76
+ // CUSTOM API CALL
77
+ // ═══════════════════════════════════════════════════════════
78
+ {
79
+ displayName: 'Method',
80
+ name: 'method',
81
+ type: 'options',
82
+ displayOptions: {
83
+ show: {
84
+ resource: ['account'],
85
+ operation: ['customApiCall'],
86
+ },
87
+ },
88
+ options: [
89
+ { name: 'DELETE', value: 'DELETE' },
90
+ { name: 'GET', value: 'GET' },
91
+ { name: 'PATCH', value: 'PATCH' },
92
+ { name: 'POST', value: 'POST' },
93
+ { name: 'PUT', value: 'PUT' },
94
+ ],
95
+ default: 'GET',
96
+ description: 'HTTP method to use',
97
+ required: true,
98
+ },
99
+ {
100
+ displayName: 'Path',
101
+ name: 'path',
102
+ type: 'string',
103
+ displayOptions: {
104
+ show: {
105
+ resource: ['account'],
106
+ operation: ['customApiCall'],
107
+ },
108
+ },
109
+ default: '/v1/',
110
+ placeholder: '/v1/models',
111
+ description: 'API endpoint path (e.g., /v1/models or /v1/images)',
112
+ required: true,
113
+ },
114
+ {
115
+ displayName: 'Additional Fields',
116
+ name: 'additionalFields',
117
+ type: 'collection',
118
+ placeholder: 'Add Field',
119
+ default: {},
120
+ displayOptions: {
121
+ show: {
122
+ resource: ['account'],
123
+ operation: ['customApiCall'],
124
+ },
125
+ },
126
+ options: [
127
+ {
128
+ displayName: 'Query Parameters',
129
+ name: 'queryParameters',
130
+ type: 'string',
131
+ typeOptions: {
132
+ rows: 4,
133
+ },
134
+ default: '{}',
135
+ placeholder: '{"limit": 20, "page": 1}',
136
+ description: 'Query parameters as JSON object',
137
+ },
138
+ {
139
+ displayName: 'Body',
140
+ name: 'body',
141
+ type: 'string',
142
+ typeOptions: {
143
+ rows: 6,
144
+ },
145
+ default: '{}',
146
+ placeholder: '{"prompt": "a cat", "model": "flux"}',
147
+ description: 'Request body as JSON object (for POST/PUT/PATCH)',
148
+ },
149
+ ],
150
+ },
69
151
  // ═══════════════════════════════════════════════════════════
70
152
  // GET TOKEN (LOGIN)
71
153
  // ═══════════════════════════════════════════════════════════
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-supermachine",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "n8n community node for Supermachine AI Image API — Generate images, manage models, LoRAs, and characters",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",