n8n-nodes-tareno 1.2.0 → 1.3.0
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.
|
@@ -6,7 +6,7 @@ class Tareno {
|
|
|
6
6
|
this.description = {
|
|
7
7
|
displayName: 'Tareno',
|
|
8
8
|
name: 'tareno',
|
|
9
|
-
icon: 'file:tareno.
|
|
9
|
+
icon: 'file:tareno.png',
|
|
10
10
|
group: ['transform'],
|
|
11
11
|
version: 1,
|
|
12
12
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
@@ -241,7 +241,39 @@ class Tareno {
|
|
|
241
241
|
],
|
|
242
242
|
default: 'upload',
|
|
243
243
|
},
|
|
244
|
-
//
|
|
244
|
+
// Upload Mode
|
|
245
|
+
{
|
|
246
|
+
displayName: 'Upload Mode',
|
|
247
|
+
name: 'uploadMode',
|
|
248
|
+
type: 'options',
|
|
249
|
+
displayOptions: {
|
|
250
|
+
show: {
|
|
251
|
+
resource: ['media'],
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
options: [
|
|
255
|
+
{ name: 'File (Binary)', value: 'file' },
|
|
256
|
+
{ name: 'URL', value: 'url' },
|
|
257
|
+
],
|
|
258
|
+
default: 'file',
|
|
259
|
+
description: 'Whether to upload a binary file or provide a URL',
|
|
260
|
+
},
|
|
261
|
+
// Binary Property (when Mode is File)
|
|
262
|
+
{
|
|
263
|
+
displayName: 'Input Data Field Name',
|
|
264
|
+
name: 'binaryPropertyName',
|
|
265
|
+
type: 'string',
|
|
266
|
+
default: 'data',
|
|
267
|
+
required: true,
|
|
268
|
+
displayOptions: {
|
|
269
|
+
show: {
|
|
270
|
+
resource: ['media'],
|
|
271
|
+
uploadMode: ['file'],
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
description: 'The name of the binary property to upload',
|
|
275
|
+
},
|
|
276
|
+
// Media URL (when Mode is URL)
|
|
245
277
|
{
|
|
246
278
|
displayName: 'Media URL',
|
|
247
279
|
name: 'mediaUrl',
|
|
@@ -250,6 +282,7 @@ class Tareno {
|
|
|
250
282
|
displayOptions: {
|
|
251
283
|
show: {
|
|
252
284
|
resource: ['media'],
|
|
285
|
+
uploadMode: ['url'],
|
|
253
286
|
},
|
|
254
287
|
},
|
|
255
288
|
default: '',
|
|
@@ -266,7 +299,7 @@ class Tareno {
|
|
|
266
299
|
},
|
|
267
300
|
},
|
|
268
301
|
default: '',
|
|
269
|
-
description: 'Optional name for the file',
|
|
302
|
+
description: 'Optional name for the file (e.g., example.jpg)',
|
|
270
303
|
},
|
|
271
304
|
// ========================
|
|
272
305
|
// ACCOUNT OPERATIONS
|
|
@@ -442,21 +475,51 @@ class Tareno {
|
|
|
442
475
|
// MEDIA LIBRARY RESOURCE
|
|
443
476
|
// ========================
|
|
444
477
|
if (resource === 'media' && operation === 'upload') {
|
|
445
|
-
const
|
|
478
|
+
const uploadMode = this.getNodeParameter('uploadMode', i);
|
|
446
479
|
const fileName = this.getNodeParameter('fileName', i);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
480
|
+
if (uploadMode === 'url') {
|
|
481
|
+
const mediaUrl = this.getNodeParameter('mediaUrl', i);
|
|
482
|
+
responseData = await this.helpers.httpRequest({
|
|
483
|
+
method: 'POST',
|
|
484
|
+
url: `${baseUrl}/api/external/media`,
|
|
485
|
+
headers: {
|
|
486
|
+
'Content-Type': 'application/json',
|
|
487
|
+
'X-Tareno-API-Key': credentials.apiKey,
|
|
488
|
+
},
|
|
489
|
+
body: {
|
|
490
|
+
mediaUrl,
|
|
491
|
+
fileName: fileName || undefined,
|
|
492
|
+
},
|
|
493
|
+
json: true,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
// Binary Upload
|
|
498
|
+
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
499
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
500
|
+
const binaryBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
501
|
+
// Use FormData for multipart upload
|
|
502
|
+
// Note: N8N helpers.httpRequest has native multipart support
|
|
503
|
+
responseData = await this.helpers.httpRequest({
|
|
504
|
+
method: 'POST',
|
|
505
|
+
url: `${baseUrl}/api/external/media`,
|
|
506
|
+
headers: {
|
|
507
|
+
'X-Tareno-API-Key': credentials.apiKey,
|
|
508
|
+
},
|
|
509
|
+
body: undefined, // ensure body is not set
|
|
510
|
+
// @ts-ignore
|
|
511
|
+
formData: {
|
|
512
|
+
file: {
|
|
513
|
+
value: binaryBuffer,
|
|
514
|
+
options: {
|
|
515
|
+
filename: fileName || binaryData.fileName || 'upload',
|
|
516
|
+
contentType: binaryData.mimeType,
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
json: true,
|
|
521
|
+
});
|
|
522
|
+
}
|
|
460
523
|
}
|
|
461
524
|
// ========================
|
|
462
525
|
// ACCOUNT RESOURCE
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-tareno",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "N8N community nodes for Tareno - Social Media Management Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://tareno.co",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"main": "dist/nodes/Tareno/Tareno.node.js",
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc && npm run copy-icons",
|
|
32
|
-
"copy-icons": "cp nodes/Tareno/*.svg dist/nodes/Tareno/ 2>/dev/null || true",
|
|
32
|
+
"copy-icons": "cp nodes/Tareno/*.svg nodes/Tareno/*.png dist/nodes/Tareno/ 2>/dev/null || true",
|
|
33
33
|
"dev": "tsc --watch",
|
|
34
34
|
"prepublishOnly": "npm run build"
|
|
35
35
|
},
|