n8n-nodes-tareno 1.0.0 → 1.1.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.
@@ -1,5 +1,10 @@
1
- import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
1
+ import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
2
  export declare class Tareno implements INodeType {
3
3
  description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getAccounts(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ };
8
+ };
4
9
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
10
  }
@@ -77,42 +77,22 @@ class Tareno {
77
77
  ],
78
78
  default: 'publish',
79
79
  },
80
- // Platform Selection
80
+ // Account Selection (Dynamic from API)
81
81
  {
82
- displayName: 'Platform',
83
- name: 'platform',
82
+ displayName: 'Account',
83
+ name: 'accountId',
84
84
  type: 'options',
85
85
  required: true,
86
- displayOptions: {
87
- show: {
88
- resource: ['post'],
89
- },
86
+ typeOptions: {
87
+ loadOptionsMethod: 'getAccounts',
90
88
  },
91
- options: [
92
- { name: 'Instagram', value: 'instagram' },
93
- { name: 'Facebook', value: 'facebook' },
94
- { name: 'YouTube', value: 'youtube' },
95
- { name: 'TikTok', value: 'tiktok' },
96
- { name: 'Twitter/X', value: 'twitter' },
97
- { name: 'Threads', value: 'threads' },
98
- { name: 'Pinterest', value: 'pinterest' },
99
- ],
100
- default: 'instagram',
101
- description: 'The platform to post to',
102
- },
103
- // Account ID
104
- {
105
- displayName: 'Account ID',
106
- name: 'accountId',
107
- type: 'string',
108
- required: true,
109
89
  displayOptions: {
110
90
  show: {
111
91
  resource: ['post'],
112
92
  },
113
93
  },
114
94
  default: '',
115
- description: 'The ID of your connected social account. Use "Get Accounts" to find this.',
95
+ description: 'Select a connected social media account',
116
96
  },
117
97
  // Post Text
118
98
  {
@@ -253,6 +233,42 @@ class Tareno {
253
233
  },
254
234
  ],
255
235
  };
236
+ this.methods = {
237
+ loadOptions: {
238
+ // Dynamically load connected accounts from API
239
+ async getAccounts() {
240
+ const credentials = await this.getCredentials('tarenoApi');
241
+ const baseUrl = credentials.baseUrl || 'https://tareno.co';
242
+ try {
243
+ const response = await this.helpers.httpRequest({
244
+ method: 'GET',
245
+ url: `${baseUrl}/api/external/accounts`,
246
+ headers: {
247
+ 'X-Tareno-API-Key': credentials.apiKey,
248
+ },
249
+ json: true,
250
+ });
251
+ if (response.accounts && Array.isArray(response.accounts)) {
252
+ return response.accounts.map((account) => ({
253
+ name: `${account.platform.charAt(0).toUpperCase() + account.platform.slice(1)} - ${account.username || account.displayName || 'Unknown'}`,
254
+ value: account.id,
255
+ description: `Platform: ${account.platform}`,
256
+ }));
257
+ }
258
+ return [];
259
+ }
260
+ catch (error) {
261
+ console.error('Failed to load accounts:', error);
262
+ return [
263
+ {
264
+ name: 'Error loading accounts - check API key',
265
+ value: '',
266
+ },
267
+ ];
268
+ }
269
+ },
270
+ },
271
+ };
256
272
  }
257
273
  async execute() {
258
274
  const items = this.getInputData();
@@ -268,16 +284,16 @@ class Tareno {
268
284
  // POST RESOURCE
269
285
  // ========================
270
286
  if (resource === 'post') {
271
- const platform = this.getNodeParameter('platform', i);
272
287
  const accountId = this.getNodeParameter('accountId', i);
273
288
  const text = this.getNodeParameter('text', i);
274
289
  const mediaUrlsRaw = this.getNodeParameter('mediaUrls', i);
275
290
  const additionalOptions = this.getNodeParameter('additionalOptions', i);
291
+ // We need to get the platform from the account
292
+ // For now, we'll include it in the API call and let the backend figure it out
276
293
  const mediaUrls = mediaUrlsRaw
277
294
  ? mediaUrlsRaw.split(',').map(url => url.trim()).filter(Boolean)
278
295
  : [];
279
296
  const body = {
280
- platform,
281
297
  accountId,
282
298
  text,
283
299
  mediaUrls,
@@ -1,6 +1,12 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
2
- <rect width="100" height="100" rx="20" fill="#10B981"/>
3
- <path d="M30 35h40v5H30zM30 47h35v5H30zM30 59h40v5H30z" fill="white"/>
4
- <circle cx="70" cy="70" r="15" fill="white"/>
5
- <path d="M65 70l5 5 8-10" stroke="#10B981" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
2
+ <defs>
3
+ <linearGradient id="tarenoGrad" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#10B981"/>
5
+ <stop offset="100%" style="stop-color:#059669"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="100" height="100" rx="22" fill="url(#tarenoGrad)"/>
9
+ <path d="M25 30 L50 20 L75 30 L75 45 L50 55 L25 45 Z" fill="white" opacity="0.9"/>
10
+ <path d="M25 50 L50 60 L75 50 L75 65 L50 75 L25 65 Z" fill="white" opacity="0.7"/>
11
+ <path d="M50 20 L50 75" stroke="white" stroke-width="3" opacity="0.3"/>
6
12
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tareno",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "N8N community nodes for Tareno - Social Media Management Platform",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tareno.co",