n8n-mcp 2.96.1 → 2.97.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.
Files changed (53) hide show
  1. package/dist/http-server.d.ts.map +1 -1
  2. package/dist/http-server.js +3 -1
  3. package/dist/http-server.js.map +1 -1
  4. package/dist/mcp/native-first.d.ts +5 -0
  5. package/dist/mcp/native-first.d.ts.map +1 -0
  6. package/dist/mcp/native-first.js +28 -0
  7. package/dist/mcp/native-first.js.map +1 -0
  8. package/dist/mcp/server.d.ts +2 -1
  9. package/dist/mcp/server.d.ts.map +1 -1
  10. package/dist/mcp/server.js +50 -48
  11. package/dist/mcp/server.js.map +1 -1
  12. package/dist/mcp/tool-docs/discovery/search-nodes.d.ts.map +1 -1
  13. package/dist/mcp/tool-docs/discovery/search-nodes.js +5 -4
  14. package/dist/mcp/tool-docs/discovery/search-nodes.js.map +1 -1
  15. package/dist/mcp/tool-docs/guides/expression-helpers.d.ts +20 -0
  16. package/dist/mcp/tool-docs/guides/expression-helpers.d.ts.map +1 -0
  17. package/dist/mcp/tool-docs/guides/expression-helpers.js +164 -0
  18. package/dist/mcp/tool-docs/guides/expression-helpers.js.map +1 -0
  19. package/dist/mcp/tool-docs/system/tools-documentation.d.ts.map +1 -1
  20. package/dist/mcp/tool-docs/system/tools-documentation.js +6 -4
  21. package/dist/mcp/tool-docs/system/tools-documentation.js.map +1 -1
  22. package/dist/mcp/tools-documentation.d.ts.map +1 -1
  23. package/dist/mcp/tools-documentation.js +11 -7
  24. package/dist/mcp/tools-documentation.js.map +1 -1
  25. package/dist/mcp-tools-engine.js +3 -2
  26. package/dist/mcp-tools-engine.js.map +1 -1
  27. package/dist/parsers/version-display-gate.js +2 -0
  28. package/dist/parsers/version-display-gate.js.map +1 -1
  29. package/dist/services/property-filter.d.ts +23 -1
  30. package/dist/services/property-filter.d.ts.map +1 -1
  31. package/dist/services/property-filter.js +273 -17
  32. package/dist/services/property-filter.js.map +1 -1
  33. package/dist/services/search-intents.d.ts +9 -0
  34. package/dist/services/search-intents.d.ts.map +1 -0
  35. package/dist/services/search-intents.js +161 -0
  36. package/dist/services/search-intents.js.map +1 -0
  37. package/dist/services/workflow-validator.d.ts.map +1 -1
  38. package/dist/services/workflow-validator.js +0 -8
  39. package/dist/services/workflow-validator.js.map +1 -1
  40. package/dist/templates/template-repository.d.ts.map +1 -1
  41. package/dist/templates/template-repository.js +22 -26
  42. package/dist/templates/template-repository.js.map +1 -1
  43. package/dist/utils/template-node-resolver.js +2 -2
  44. package/dist/utils/template-node-resolver.js.map +1 -1
  45. package/package.json +2 -2
  46. package/dist/services/example-generator.d.ts +0 -14
  47. package/dist/services/example-generator.d.ts.map +0 -1
  48. package/dist/services/example-generator.js +0 -983
  49. package/dist/services/example-generator.js.map +0 -1
  50. package/dist/services/task-templates.d.ts +0 -27
  51. package/dist/services/task-templates.d.ts.map +0 -1
  52. package/dist/services/task-templates.js +0 -1414
  53. package/dist/services/task-templates.js.map +0 -1
@@ -1,983 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExampleGenerator = void 0;
4
- class ExampleGenerator {
5
- static getExamples(nodeType, essentials) {
6
- const examples = this.NODE_EXAMPLES[nodeType];
7
- if (examples) {
8
- return examples;
9
- }
10
- return this.generateBasicExamples(nodeType, essentials);
11
- }
12
- static generateBasicExamples(nodeType, essentials) {
13
- const minimal = {};
14
- if (essentials?.required) {
15
- for (const prop of essentials.required) {
16
- minimal[prop.name] = this.getDefaultValue(prop);
17
- }
18
- }
19
- if (Object.keys(minimal).length === 0 && essentials?.common?.length > 0) {
20
- const firstCommon = essentials.common[0];
21
- minimal[firstCommon.name] = this.getDefaultValue(firstCommon);
22
- }
23
- return { minimal };
24
- }
25
- static getDefaultValue(prop) {
26
- if (prop.default !== undefined) {
27
- return prop.default;
28
- }
29
- switch (prop.type) {
30
- case 'string':
31
- return this.getStringDefault(prop);
32
- case 'number':
33
- return prop.name.includes('port') ? 80 :
34
- prop.name.includes('timeout') ? 30000 :
35
- prop.name.includes('limit') ? 10 : 0;
36
- case 'boolean':
37
- return false;
38
- case 'options':
39
- case 'multiOptions':
40
- return prop.options?.[0]?.value || '';
41
- case 'json':
42
- return '{\n "key": "value"\n}';
43
- case 'collection':
44
- case 'fixedCollection':
45
- return {};
46
- default:
47
- return '';
48
- }
49
- }
50
- static getStringDefault(prop) {
51
- const name = prop.name.toLowerCase();
52
- if (name.includes('url') || name === 'endpoint') {
53
- return 'https://api.example.com';
54
- }
55
- if (name.includes('email')) {
56
- return name.includes('from') ? 'sender@example.com' : 'recipient@example.com';
57
- }
58
- if (name.includes('path')) {
59
- return name.includes('webhook') ? 'my-webhook' : '/path/to/file';
60
- }
61
- if (name === 'name' || name.includes('username')) {
62
- return 'John Doe';
63
- }
64
- if (name.includes('key')) {
65
- return 'myKey';
66
- }
67
- if (name === 'query' || name.includes('sql')) {
68
- return 'SELECT * FROM table_name LIMIT 10';
69
- }
70
- if (name === 'collection' || name === 'table') {
71
- return 'users';
72
- }
73
- if (prop.placeholder) {
74
- return prop.placeholder;
75
- }
76
- return '';
77
- }
78
- static getTaskExample(nodeType, task) {
79
- const examples = this.NODE_EXAMPLES[nodeType];
80
- if (!examples)
81
- return undefined;
82
- const taskMap = {
83
- 'basic': 'minimal',
84
- 'simple': 'minimal',
85
- 'typical': 'common',
86
- 'standard': 'common',
87
- 'complex': 'advanced',
88
- 'full': 'advanced'
89
- };
90
- const exampleType = taskMap[task] || 'common';
91
- return examples[exampleType] || examples.minimal;
92
- }
93
- }
94
- exports.ExampleGenerator = ExampleGenerator;
95
- ExampleGenerator.NODE_EXAMPLES = {
96
- 'nodes-base.httpRequest': {
97
- minimal: {
98
- url: 'https://api.example.com/data'
99
- },
100
- common: {
101
- method: 'POST',
102
- url: 'https://api.example.com/users',
103
- sendBody: true,
104
- contentType: 'json',
105
- specifyBody: 'json',
106
- jsonBody: '{\n "name": "John Doe",\n "email": "john@example.com"\n}'
107
- },
108
- advanced: {
109
- method: 'POST',
110
- url: 'https://api.example.com/protected/resource',
111
- authentication: 'genericCredentialType',
112
- genericAuthType: 'headerAuth',
113
- sendHeaders: true,
114
- headerParameters: {
115
- parameters: [
116
- {
117
- name: 'X-API-Version',
118
- value: 'v2'
119
- }
120
- ]
121
- },
122
- sendBody: true,
123
- contentType: 'json',
124
- specifyBody: 'json',
125
- jsonBody: '{\n "action": "update",\n "data": {}\n}',
126
- onError: 'continueRegularOutput',
127
- retryOnFail: true,
128
- maxTries: 3,
129
- waitBetweenTries: 1000,
130
- alwaysOutputData: true
131
- }
132
- },
133
- 'nodes-base.webhook': {
134
- minimal: {
135
- path: 'my-webhook',
136
- httpMethod: 'POST'
137
- },
138
- common: {
139
- path: 'webhook-endpoint',
140
- httpMethod: 'POST',
141
- responseMode: 'lastNode',
142
- responseData: 'allEntries',
143
- responseCode: 200,
144
- onError: 'continueRegularOutput',
145
- alwaysOutputData: true
146
- }
147
- },
148
- 'nodes-base.code.webhookProcessing': {
149
- minimal: {
150
- language: 'javaScript',
151
- jsCode: `// ⚠️ CRITICAL: Webhook data is nested under 'body' property!
152
- // This Code node should be connected after a Webhook node
153
-
154
- // ❌ WRONG - This will be undefined:
155
- // const command = items[0].json.testCommand;
156
-
157
- // ✅ CORRECT - Access webhook data through body:
158
- const webhookData = items[0].json.body;
159
- const headers = items[0].json.headers;
160
- const query = items[0].json.query;
161
-
162
- // Process webhook payload
163
- return [{
164
- json: {
165
- // Extract data from webhook body
166
- command: webhookData.testCommand,
167
- userId: webhookData.userId,
168
- data: webhookData.data,
169
-
170
- // Add metadata
171
- timestamp: DateTime.now().toISO(),
172
- requestId: headers['x-request-id'] || crypto.randomUUID(),
173
- source: query.source || 'webhook',
174
-
175
- // Original webhook info
176
- httpMethod: items[0].json.httpMethod,
177
- webhookPath: items[0].json.webhookPath
178
- }
179
- }];`
180
- }
181
- },
182
- 'nodes-base.code': {
183
- minimal: {
184
- language: 'javaScript',
185
- jsCode: 'return [{json: {result: "success"}}];'
186
- },
187
- common: {
188
- language: 'javaScript',
189
- jsCode: `// Process each item and add timestamp
190
- return items.map(item => ({
191
- json: {
192
- ...item.json,
193
- processed: true,
194
- timestamp: DateTime.now().toISO()
195
- }
196
- }));`,
197
- onError: 'continueRegularOutput'
198
- },
199
- advanced: {
200
- language: 'javaScript',
201
- jsCode: `// Advanced data processing with proper helper checks
202
- const crypto = require('crypto');
203
- const results = [];
204
-
205
- for (const item of items) {
206
- try {
207
- // Validate required fields
208
- if (!item.json.email || !item.json.name) {
209
- throw new Error('Missing required fields: email or name');
210
- }
211
-
212
- // Generate secure API key
213
- const apiKey = crypto.randomBytes(16).toString('hex');
214
-
215
- // Check if $helpers is available before using
216
- let response;
217
- if (typeof $helpers !== 'undefined' && $helpers.httpRequest) {
218
- response = await $helpers.httpRequest({
219
- method: 'POST',
220
- url: 'https://api.example.com/process',
221
- body: {
222
- email: item.json.email,
223
- name: item.json.name,
224
- apiKey
225
- },
226
- headers: {
227
- 'Content-Type': 'application/json'
228
- }
229
- });
230
- } else {
231
- // Fallback if $helpers not available
232
- response = { message: 'HTTP requests not available in this n8n version' };
233
- }
234
-
235
- // Add to results with response data
236
- results.push({
237
- json: {
238
- ...item.json,
239
- apiResponse: response,
240
- processedAt: DateTime.now().toISO(),
241
- status: 'success'
242
- }
243
- });
244
-
245
- } catch (error) {
246
- // Include failed items with error info
247
- results.push({
248
- json: {
249
- ...item.json,
250
- error: error.message,
251
- status: 'failed',
252
- processedAt: DateTime.now().toISO()
253
- }
254
- });
255
- }
256
- }
257
-
258
- return results;`,
259
- onError: 'continueRegularOutput',
260
- retryOnFail: true,
261
- maxTries: 2
262
- }
263
- },
264
- 'nodes-base.code.dataTransform': {
265
- minimal: {
266
- language: 'javaScript',
267
- jsCode: `// Transform CSV-like data to JSON
268
- return items.map(item => {
269
- const lines = item.json.data.split('\\n');
270
- const headers = lines[0].split(',');
271
- const rows = lines.slice(1).map(line => {
272
- const values = line.split(',');
273
- return headers.reduce((obj, header, i) => {
274
- obj[header.trim()] = values[i]?.trim() || '';
275
- return obj;
276
- }, {});
277
- });
278
-
279
- return {json: {rows, count: rows.length}};
280
- });`
281
- }
282
- },
283
- 'nodes-base.code.aggregation': {
284
- minimal: {
285
- language: 'javaScript',
286
- jsCode: `// Aggregate data from all items
287
- const totals = items.reduce((acc, item) => {
288
- acc.count++;
289
- acc.sum += item.json.amount || 0;
290
- acc.categories[item.json.category] = (acc.categories[item.json.category] || 0) + 1;
291
- return acc;
292
- }, {count: 0, sum: 0, categories: {}});
293
-
294
- return [{
295
- json: {
296
- totalItems: totals.count,
297
- totalAmount: totals.sum,
298
- averageAmount: totals.sum / totals.count,
299
- categoryCounts: totals.categories,
300
- processedAt: DateTime.now().toISO()
301
- }
302
- }];`
303
- }
304
- },
305
- 'nodes-base.code.filtering': {
306
- minimal: {
307
- language: 'javaScript',
308
- jsCode: `// Filter items based on conditions
309
- return items
310
- .filter(item => {
311
- const amount = item.json.amount || 0;
312
- const status = item.json.status || '';
313
- return amount > 100 && status === 'active';
314
- })
315
- .map(item => ({json: item.json}));`
316
- }
317
- },
318
- 'nodes-base.code.jmespathFiltering': {
319
- minimal: {
320
- language: 'javaScript',
321
- jsCode: `// JMESPath filtering - IMPORTANT: Use backticks for numeric literals!
322
- const allItems = items.map(item => item.json);
323
-
324
- // ✅ CORRECT - Filter with numeric literals using backticks
325
- const expensiveItems = $jmespath(allItems, '[?price >= \`100\`]');
326
- const lowStock = $jmespath(allItems, '[?inventory < \`10\`]');
327
- const highPriority = $jmespath(allItems, '[?priority == \`1\`]');
328
-
329
- // Combine multiple conditions
330
- const urgentExpensive = $jmespath(allItems, '[?price >= \`100\` && priority == \`1\`]');
331
-
332
- // Raw strings use single quotes; double quotes name a field
333
- const activeItems = $jmespath(allItems, "[?status == 'active']");
334
-
335
- // Return filtered results
336
- return expensiveItems.map(item => ({json: item}));`
337
- }
338
- },
339
- 'nodes-base.code.pythonExample': {
340
- minimal: {
341
- language: 'pythonNative',
342
- pythonCode: `# Native Python (pythonNative): _items is the list of input item dicts.
343
- # Imports are blocked unless this instance allowlists the module, so this
344
- # checks the address with builtins only.
345
- results = []
346
-
347
- for item in _items:
348
- data = item["json"]
349
- email = (data.get("email") or "").strip().lower()
350
- local, sep, domain = email.partition("@")
351
- labels = domain.split(".")
352
- valid = (
353
- sep == "@"
354
- and bool(local)
355
- and "@" not in domain
356
- and len(labels) > 1
357
- and all(labels)
358
- and not any(ch.isspace() for ch in email)
359
- )
360
-
361
- cleaned = dict(data)
362
- cleaned["email"] = email
363
- cleaned["name"] = (data.get("name") or "").title()
364
- cleaned["validated"] = valid
365
- if not valid:
366
- cleaned["error"] = "Invalid email format"
367
-
368
- results.append({"json": cleaned})
369
-
370
- return results`
371
- }
372
- },
373
- 'nodes-base.code.aiTool': {
374
- minimal: {
375
- language: 'javaScript',
376
- mode: 'runOnceForEachItem',
377
- jsCode: `// Code node as AI tool - calculate discount
378
- const quantity = $json.quantity || 1;
379
- const price = $json.price || 0;
380
-
381
- let discountRate = 0;
382
- if (quantity >= 100) discountRate = 0.20;
383
- else if (quantity >= 50) discountRate = 0.15;
384
- else if (quantity >= 20) discountRate = 0.10;
385
- else if (quantity >= 10) discountRate = 0.05;
386
-
387
- const subtotal = price * quantity;
388
- const discount = subtotal * discountRate;
389
- const total = subtotal - discount;
390
-
391
- return [{
392
- json: {
393
- quantity,
394
- price,
395
- subtotal,
396
- discountRate: discountRate * 100,
397
- discountAmount: discount,
398
- total,
399
- savings: discount
400
- }
401
- }];`
402
- }
403
- },
404
- 'nodes-base.code.crypto': {
405
- minimal: {
406
- language: 'javaScript',
407
- jsCode: `// Using crypto in Code nodes - it IS available!
408
- const crypto = require('crypto');
409
-
410
- // Generate secure tokens
411
- const token = crypto.randomBytes(32).toString('hex');
412
- const uuid = crypto.randomUUID();
413
-
414
- // Create hashes
415
- const hash = crypto.createHash('sha256')
416
- .update(items[0].json.data || 'test')
417
- .digest('hex');
418
-
419
- return [{
420
- json: {
421
- token,
422
- uuid,
423
- hash,
424
- timestamp: DateTime.now().toISO()
425
- }
426
- }];`
427
- }
428
- },
429
- 'nodes-base.code.staticData': {
430
- minimal: {
431
- language: 'javaScript',
432
- jsCode: `// Using workflow static data correctly
433
- // IMPORTANT: $getWorkflowStaticData is a standalone function!
434
- const staticData = $getWorkflowStaticData('global');
435
-
436
- // Initialize counter if not exists
437
- if (!staticData.processCount) {
438
- staticData.processCount = 0;
439
- staticData.firstRun = DateTime.now().toISO();
440
- }
441
-
442
- // Update counter
443
- staticData.processCount++;
444
- staticData.lastRun = DateTime.now().toISO();
445
-
446
- // Process items
447
- const results = items.map(item => ({
448
- json: {
449
- ...item.json,
450
- runNumber: staticData.processCount,
451
- processed: true
452
- }
453
- }));
454
-
455
- return results;`
456
- }
457
- },
458
- 'nodes-base.set': {
459
- minimal: {
460
- mode: 'manual',
461
- assignments: {
462
- assignments: [
463
- {
464
- id: '1',
465
- name: 'status',
466
- value: 'active',
467
- type: 'string'
468
- }
469
- ]
470
- }
471
- },
472
- common: {
473
- mode: 'manual',
474
- includeOtherFields: true,
475
- assignments: {
476
- assignments: [
477
- {
478
- id: '1',
479
- name: 'status',
480
- value: 'processed',
481
- type: 'string'
482
- },
483
- {
484
- id: '2',
485
- name: 'processedAt',
486
- value: '={{ $now.toISO() }}',
487
- type: 'string'
488
- },
489
- {
490
- id: '3',
491
- name: 'itemCount',
492
- value: '={{ $items().length }}',
493
- type: 'number'
494
- }
495
- ]
496
- }
497
- }
498
- },
499
- 'nodes-base.if': {
500
- minimal: {
501
- conditions: {
502
- options: {
503
- version: 2,
504
- leftValue: '',
505
- caseSensitive: true,
506
- typeValidation: 'strict'
507
- },
508
- combinator: 'and',
509
- conditions: [
510
- {
511
- id: '1',
512
- leftValue: '={{ $json.status }}',
513
- rightValue: 'active',
514
- operator: {
515
- type: 'string',
516
- operation: 'equals'
517
- }
518
- }
519
- ]
520
- }
521
- },
522
- common: {
523
- conditions: {
524
- options: {
525
- version: 2,
526
- leftValue: '',
527
- caseSensitive: true,
528
- typeValidation: 'strict'
529
- },
530
- combinator: 'and',
531
- conditions: [
532
- {
533
- id: '1',
534
- leftValue: '={{ $json.status }}',
535
- rightValue: 'active',
536
- operator: {
537
- type: 'string',
538
- operation: 'equals'
539
- }
540
- },
541
- {
542
- id: '2',
543
- leftValue: '={{ $json.count }}',
544
- rightValue: 10,
545
- operator: {
546
- type: 'number',
547
- operation: 'gt'
548
- }
549
- }
550
- ]
551
- },
552
- combineOperation: 'all'
553
- }
554
- },
555
- 'nodes-base.postgres': {
556
- minimal: {
557
- operation: 'executeQuery',
558
- query: 'SELECT * FROM users LIMIT 10'
559
- },
560
- common: {
561
- operation: 'insert',
562
- table: 'users',
563
- columns: 'name,email,created_at',
564
- additionalFields: {}
565
- },
566
- advanced: {
567
- operation: 'executeQuery',
568
- query: `INSERT INTO users (name, email, status)
569
- VALUES ($1, $2, $3)
570
- ON CONFLICT (email)
571
- DO UPDATE SET
572
- name = EXCLUDED.name,
573
- updated_at = NOW()
574
- RETURNING *;`,
575
- additionalFields: {
576
- queryParams: '={{ $json.name }},{{ $json.email }},active'
577
- },
578
- retryOnFail: true,
579
- maxTries: 3,
580
- waitBetweenTries: 2000,
581
- onError: 'continueErrorOutput'
582
- }
583
- },
584
- 'nodes-base.openAi': {
585
- minimal: {
586
- resource: 'chat',
587
- operation: 'message',
588
- modelId: 'gpt-3.5-turbo',
589
- messages: {
590
- values: [
591
- {
592
- role: 'user',
593
- content: 'Hello, how can you help me?'
594
- }
595
- ]
596
- }
597
- },
598
- common: {
599
- resource: 'chat',
600
- operation: 'message',
601
- modelId: 'gpt-4',
602
- messages: {
603
- values: [
604
- {
605
- role: 'system',
606
- content: 'You are a helpful assistant that summarizes text concisely.'
607
- },
608
- {
609
- role: 'user',
610
- content: '={{ $json.text }}'
611
- }
612
- ]
613
- },
614
- options: {
615
- maxTokens: 150,
616
- temperature: 0.7
617
- },
618
- retryOnFail: true,
619
- maxTries: 3,
620
- waitBetweenTries: 5000,
621
- onError: 'continueRegularOutput',
622
- alwaysOutputData: true
623
- }
624
- },
625
- 'nodes-base.googleSheets': {
626
- minimal: {
627
- operation: 'read',
628
- documentId: {
629
- __rl: true,
630
- value: 'https://docs.google.com/spreadsheets/d/your-sheet-id',
631
- mode: 'url'
632
- },
633
- sheetName: 'Sheet1'
634
- },
635
- common: {
636
- operation: 'append',
637
- documentId: {
638
- __rl: true,
639
- value: 'your-sheet-id',
640
- mode: 'id'
641
- },
642
- sheetName: 'Sheet1',
643
- dataStartRow: 2,
644
- columns: {
645
- mappingMode: 'defineBelow',
646
- value: {
647
- 'Name': '={{ $json.name }}',
648
- 'Email': '={{ $json.email }}',
649
- 'Date': '={{ $now.toISO() }}'
650
- }
651
- }
652
- }
653
- },
654
- 'nodes-base.slack': {
655
- minimal: {
656
- resource: 'message',
657
- operation: 'post',
658
- channel: '#general',
659
- text: 'Hello from n8n!'
660
- },
661
- common: {
662
- resource: 'message',
663
- operation: 'post',
664
- channel: '#notifications',
665
- text: 'New order received!',
666
- attachments: [
667
- {
668
- color: '#36a64f',
669
- title: 'Order #{{ $json.orderId }}',
670
- fields: {
671
- item: [
672
- {
673
- title: 'Customer',
674
- value: '{{ $json.customerName }}',
675
- short: true
676
- },
677
- {
678
- title: 'Amount',
679
- value: '${{ $json.amount }}',
680
- short: true
681
- }
682
- ]
683
- }
684
- }
685
- ],
686
- retryOnFail: true,
687
- maxTries: 2,
688
- waitBetweenTries: 3000,
689
- onError: 'continueRegularOutput'
690
- }
691
- },
692
- 'nodes-base.emailSend': {
693
- minimal: {
694
- fromEmail: 'sender@example.com',
695
- toEmail: 'recipient@example.com',
696
- subject: 'Test Email',
697
- text: 'This is a test email from n8n.'
698
- },
699
- common: {
700
- fromEmail: 'notifications@company.com',
701
- toEmail: '={{ $json.email }}',
702
- subject: 'Welcome to our service, {{ $json.name }}!',
703
- html: `<h1>Welcome!</h1>
704
- <p>Hi {{ $json.name }},</p>
705
- <p>Thank you for signing up. We're excited to have you on board!</p>
706
- <p>Best regards,<br>The Team</p>`,
707
- options: {
708
- ccEmail: 'admin@company.com'
709
- },
710
- retryOnFail: true,
711
- maxTries: 3,
712
- waitBetweenTries: 2000,
713
- onError: 'continueRegularOutput'
714
- }
715
- },
716
- 'nodes-base.merge': {
717
- minimal: {
718
- mode: 'append'
719
- },
720
- common: {
721
- mode: 'mergeByKey',
722
- propertyName1: 'id',
723
- propertyName2: 'userId'
724
- }
725
- },
726
- 'nodes-base.function': {
727
- minimal: {
728
- functionCode: 'return items;'
729
- },
730
- common: {
731
- functionCode: `// Add a timestamp to each item
732
- const processedItems = items.map(item => {
733
- return {
734
- ...item,
735
- json: {
736
- ...item.json,
737
- processedAt: new Date().toISOString()
738
- }
739
- };
740
- });
741
-
742
- return processedItems;`
743
- }
744
- },
745
- 'nodes-base.splitInBatches': {
746
- minimal: {
747
- batchSize: 10
748
- },
749
- common: {
750
- batchSize: 100,
751
- options: {
752
- reset: false
753
- }
754
- }
755
- },
756
- 'nodes-base.redis': {
757
- minimal: {
758
- operation: 'set',
759
- key: 'myKey',
760
- value: 'myValue'
761
- },
762
- common: {
763
- operation: 'set',
764
- key: 'user:{{ $json.userId }}',
765
- value: '={{ JSON.stringify($json) }}',
766
- expire: true,
767
- ttl: 3600
768
- }
769
- },
770
- 'nodes-base.mongoDb': {
771
- minimal: {
772
- operation: 'find',
773
- collection: 'users'
774
- },
775
- common: {
776
- operation: 'findOneAndUpdate',
777
- collection: 'users',
778
- query: '{ "email": "{{ $json.email }}" }',
779
- update: '{ "$set": { "lastLogin": "{{ $now.toISO() }}" } }',
780
- options: {
781
- upsert: true,
782
- returnNewDocument: true
783
- },
784
- retryOnFail: true,
785
- maxTries: 3,
786
- waitBetweenTries: 1000,
787
- onError: 'continueErrorOutput'
788
- }
789
- },
790
- 'nodes-base.mySql': {
791
- minimal: {
792
- operation: 'executeQuery',
793
- query: 'SELECT * FROM products WHERE active = 1'
794
- },
795
- common: {
796
- operation: 'insert',
797
- table: 'orders',
798
- columns: 'customer_id,product_id,quantity,order_date',
799
- options: {
800
- queryBatching: 'independently'
801
- },
802
- retryOnFail: true,
803
- maxTries: 3,
804
- waitBetweenTries: 2000,
805
- onError: 'stopWorkflow'
806
- }
807
- },
808
- 'nodes-base.ftp': {
809
- minimal: {
810
- operation: 'download',
811
- path: '/files/data.csv'
812
- },
813
- common: {
814
- operation: 'upload',
815
- path: '/uploads/',
816
- fileName: 'report_{{ $now.format("yyyy-MM-dd") }}.csv',
817
- binaryData: true,
818
- binaryPropertyName: 'data'
819
- }
820
- },
821
- 'nodes-base.ssh': {
822
- minimal: {
823
- resource: 'command',
824
- operation: 'execute',
825
- command: 'ls -la'
826
- },
827
- common: {
828
- resource: 'command',
829
- operation: 'execute',
830
- command: 'cd /var/logs && tail -n 100 app.log | grep ERROR',
831
- cwd: '/home/user'
832
- }
833
- },
834
- 'nodes-base.executeCommand': {
835
- minimal: {
836
- command: 'echo "Hello from n8n"'
837
- },
838
- common: {
839
- command: 'node process-data.js --input "{{ $json.filename }}"',
840
- cwd: '/app/scripts'
841
- }
842
- },
843
- 'nodes-base.github': {
844
- minimal: {
845
- resource: 'issue',
846
- operation: 'get',
847
- owner: 'n8n-io',
848
- repository: 'n8n',
849
- issueNumber: 123
850
- },
851
- common: {
852
- resource: 'issue',
853
- operation: 'create',
854
- owner: '={{ $json.organization }}',
855
- repository: '={{ $json.repo }}',
856
- title: 'Bug: {{ $json.title }}',
857
- body: `## Description
858
- {{ $json.description }}
859
-
860
- ## Steps to Reproduce
861
- {{ $json.steps }}
862
-
863
- ## Expected Behavior
864
- {{ $json.expected }}`,
865
- assignees: ['maintainer'],
866
- labels: ['bug', 'needs-triage']
867
- }
868
- },
869
- 'error-handling.modern-patterns': {
870
- minimal: {
871
- onError: 'continueRegularOutput'
872
- },
873
- common: {
874
- onError: 'continueErrorOutput',
875
- alwaysOutputData: true
876
- },
877
- advanced: {
878
- onError: 'stopWorkflow',
879
- retryOnFail: true,
880
- maxTries: 3,
881
- waitBetweenTries: 2000
882
- }
883
- },
884
- 'error-handling.api-with-retry': {
885
- minimal: {
886
- url: 'https://api.example.com/data',
887
- retryOnFail: true,
888
- maxTries: 3,
889
- waitBetweenTries: 1000
890
- },
891
- common: {
892
- method: 'GET',
893
- url: 'https://api.example.com/users/{{ $json.userId }}',
894
- retryOnFail: true,
895
- maxTries: 5,
896
- waitBetweenTries: 2000,
897
- alwaysOutputData: true,
898
- sendHeaders: true,
899
- headerParameters: {
900
- parameters: [
901
- {
902
- name: 'X-Request-ID',
903
- value: '={{ $workflow.id }}-{{ $execution.id }}'
904
- }
905
- ]
906
- }
907
- },
908
- advanced: {
909
- method: 'POST',
910
- url: 'https://api.example.com/critical-operation',
911
- sendBody: true,
912
- contentType: 'json',
913
- specifyBody: 'json',
914
- jsonBody: '{{ JSON.stringify($json) }}',
915
- retryOnFail: true,
916
- maxTries: 5,
917
- waitBetweenTries: 1000,
918
- alwaysOutputData: true,
919
- onError: 'stopWorkflow'
920
- }
921
- },
922
- 'error-handling.fault-tolerant': {
923
- minimal: {
924
- onError: 'continueRegularOutput'
925
- },
926
- common: {
927
- onError: 'continueRegularOutput',
928
- alwaysOutputData: true
929
- },
930
- advanced: {
931
- onError: 'continueRegularOutput',
932
- retryOnFail: true,
933
- maxTries: 2,
934
- waitBetweenTries: 500,
935
- alwaysOutputData: true
936
- }
937
- },
938
- 'error-handling.database-patterns': {
939
- minimal: {
940
- onError: 'continueRegularOutput',
941
- alwaysOutputData: true
942
- },
943
- common: {
944
- retryOnFail: true,
945
- maxTries: 3,
946
- waitBetweenTries: 2000,
947
- onError: 'stopWorkflow'
948
- },
949
- advanced: {
950
- onError: 'continueErrorOutput',
951
- retryOnFail: false,
952
- alwaysOutputData: true
953
- }
954
- },
955
- 'error-handling.webhook-patterns': {
956
- minimal: {
957
- onError: 'continueRegularOutput',
958
- alwaysOutputData: true
959
- },
960
- common: {
961
- onError: 'continueErrorOutput',
962
- alwaysOutputData: true,
963
- responseCode: 200,
964
- responseData: 'allEntries'
965
- }
966
- },
967
- 'error-handling.ai-patterns': {
968
- minimal: {
969
- retryOnFail: true,
970
- maxTries: 3,
971
- waitBetweenTries: 5000,
972
- onError: 'continueRegularOutput'
973
- },
974
- common: {
975
- retryOnFail: true,
976
- maxTries: 5,
977
- waitBetweenTries: 2000,
978
- onError: 'continueRegularOutput',
979
- alwaysOutputData: true
980
- }
981
- }
982
- };
983
- //# sourceMappingURL=example-generator.js.map