export declare const WORKFLOW_PATTERNS_DETAILED = "\n```javascript\nimport { workflow, node, trigger, sticky, placeholder, newCredential, ifElse, switchCase, merge, splitInBatches, nextBatch, languageModel, memory, tool, outputParser, embedding, embeddings, vectorStore, retriever, documentLoader, textSplitter, reranker, fromAi, expr } from '@n8n/workflow-sdk';\n\n// 1. Define all nodes first\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start', position: [240, 300] },\n output: [{}]\n});\n\nconst fetchData = node({\n type: 'n8n-nodes-base.httpRequest',\n version: 4.3,\n config: { name: 'Fetch Data', parameters: { method: 'GET', url: '...' }, position: [540, 300] },\n output: [{ id: 1, title: 'Item 1' }]\n});\n\nconst processData = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Process Data', parameters: {}, position: [840, 300] },\n output: [{ id: 1, title: 'Item 1', processed: true }]\n});\n\n// 2. Compose workflow\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(fetchData)\n .to(processData);\n```\n\n\n\n\nWhen nodes return more than 1 item, chaining causes item multiplication: if Source A returns N items, a chained Source B runs N times instead of once.\n\nFix with `executeOnce: true` (simplest) or parallel branches + Merge (when combining results):\n\n```javascript\n// sourceA outputs 10 items. sourceB outputs 10 items.\n// sourceB runs once per item from sourceA.\n// WRONG - processResults runs 100 times\n// startTrigger.to(sourceA.to(sourceB.to(processResults)))\n\n// FIX 1 - executeOnce: sourceB runs once regardless of input items\nconst sourceB = node({ ..., config: { ..., executeOnce: true } });\nstartTrigger.to(sourceA.to(sourceB.to(processResults)));\n\n// FIX 2 - parallel branches + Merge (combine by position)\n// Pairs items by index, merging fields from both inputs into one item.\n// @example input0: [{ a: 1 }, { a: 2 }] input1: [{ b: 10, c: 'x' }, { b: 20 }]\n// output: [{ a: 1, b: 10, c: 'x' }, { a: 2, b: 20, c: undefined }]\n// .input(n) is 0-based: .input(0) = first input, .input(1) = second input.\nconst combineResults = merge({\n version: 3.2,\n config: { name: 'Combine Results', parameters: { mode: 'combine', combineBy: 'combineByPosition' } }\n});\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(sourceA.to(combineResults.input(0))) // first input (index 0)\n .add(startTrigger)\n .to(sourceB.to(combineResults.input(1))) // second input (index 1)\n .add(combineResults)\n .to(processResults);\n\n// FIX 3 - parallel branches + Merge (append)\n// Concatenates all items from all inputs into one list sequentially.\n// @example input0: [{ a: 1 }, { a: 2 }] input1: [{ b: 10 }]\n// output: [{ a: 1 }, { a: 2 }, { b: 10 }]\nconst allResults = merge({\n version: 3.2,\n config: { name: 'All Results', parameters: { mode: 'append' } }\n});\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(sourceA.to(allResults.input(0))) // first input (index 0)\n .add(startTrigger)\n .to(sourceB.to(allResults.input(1))) // second input (index 1)\n .add(allResults)\n .to(processResults);\n```\n\n\n\n\n\n**CRITICAL:** Each branch defines a COMPLETE processing path. Chain multiple steps INSIDE the branch using .to().\n\n```javascript\n// Assume other nodes are declared\nconst checkValid = ifElse({ version: 2.2, config: { name: 'Check Valid', parameters: {...} } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(checkValid\n .onTrue(formatData.to(enrichData.to(saveToDb))) // Chain 3 nodes on true branch\n .onFalse(logError));\n```\n\n\n\n\n\n```javascript\n// Assume other nodes are declared\nconst routeByPriority = switchCase({ version: 3.2, config: { name: 'Route by Priority', parameters: {...} } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(routeByPriority\n .onCase(0, processUrgent.to(notifyTeam.to(escalate))) // Chain of 3 nodes\n .onCase(1, processNormal)\n .onCase(2, archive));\n```\n\n\n\n\n```javascript\nconst combineResults = merge({\n version: 3.2,\n config: {\n name: 'Combine Results',\n parameters: { mode: 'combine' },\n position: [840, 300]\n }\n});\n\nconst branch1 = node({ type: 'n8n-nodes-base.httpRequest', ... });\nconst branch2 = node({ type: 'n8n-nodes-base.httpRequest', ... });\nconst processResults = node({ type: 'n8n-nodes-base.set', ... });\n\n// Connect branches to specific merge inputs using .input(n).\n// Indices are 0-based: .input(0) is the FIRST input, .input(1) is the SECOND.\nexport default workflow('id', 'name')\n .add(trigger({ ... }))\n .to(branch1.to(combineResults.input(0))) // first input (index 0)\n .add(trigger({ ... }))\n .to(branch2.to(combineResults.input(1))) // second input (index 1)\n .add(combineResults)\n .to(processResults);\n```\n\n\n\n\n```javascript\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger', version: 1,\n config: { name: 'Start', position: [240, 300] },\n output: [{}]\n});\n\nconst fetchRecords = node({\n type: 'n8n-nodes-base.httpRequest', version: 4.3,\n config: { name: 'Fetch Records', parameters: { method: 'GET', url: '...' }, position: [540, 300] },\n output: [{ id: 1 }, { id: 2 }, { id: 3 }]\n});\n\nconst finalizeResults = node({\n type: 'n8n-nodes-base.set', version: 3.4,\n config: { name: 'Finalize', parameters: {}, position: [1140, 200] },\n output: [{ summary: 'Processed 3 records' }]\n});\n\nconst processRecord = node({\n type: 'n8n-nodes-base.httpRequest', version: 4.3,\n config: { name: 'Process Record', parameters: { method: 'POST', url: '...' }, position: [1140, 400] },\n output: [{ id: 1, status: 'processed' }]\n});\n\nconst sibNode = splitInBatches({ version: 3, config: { name: 'Batch Process', parameters: { batchSize: 10 }, position: [840, 300] } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(fetchRecords)\n .to(sibNode\n .onDone(finalizeResults)\n .onEachBatch(processRecord.to(nextBatch(sibNode)))\n );\n```\n\n\n\n\n```javascript\nconst webhookTrigger = trigger({\n type: 'n8n-nodes-base.webhook', version: 2.1,\n config: { name: 'Webhook', position: [240, 200] },\n output: [{ body: { data: 'webhook payload' } }]\n});\n\nconst processWebhook = node({\n type: 'n8n-nodes-base.set', version: 3.4,\n config: { name: 'Process Webhook', parameters: {}, position: [540, 200] },\n output: [{ data: 'webhook payload', processed: true }]\n});\n\nconst scheduleTrigger = trigger({\n type: 'n8n-nodes-base.scheduleTrigger', version: 1.3,\n config: { name: 'Daily Schedule', parameters: {}, position: [240, 500] },\n output: [{}]\n});\n\nconst processSchedule = node({\n type: 'n8n-nodes-base.set', version: 3.4,\n config: { name: 'Process Schedule', parameters: {}, position: [540, 500] },\n output: [{ scheduled: true }]\n});\n\nexport default workflow('id', 'name')\n .add(webhookTrigger)\n .to(processWebhook)\n .add(scheduleTrigger)\n .to(processSchedule);\n```\n\n\n\n\n```javascript\n// Each trigger's execution runs in COMPLETE ISOLATION.\n// Different branches have no effect on each other.\n// Never duplicate chains for \"isolation\" - it's already guaranteed.\n\nconst webhookTrigger = trigger({\n type: 'n8n-nodes-base.webhook', version: 2.1,\n config: { name: 'Webhook Trigger', position: [240, 200] },\n output: [{ source: 'webhook' }]\n});\n\nconst scheduleTrigger = trigger({\n type: 'n8n-nodes-base.scheduleTrigger', version: 1.3,\n config: { name: 'Daily Schedule', position: [240, 500] },\n output: [{ source: 'schedule' }]\n});\n\nconst processData = node({\n type: 'n8n-nodes-base.set', version: 3.4,\n config: { name: 'Process Data', parameters: {}, position: [540, 350] },\n output: [{ processed: true }]\n});\n\nconst sendNotification = node({\n type: 'n8n-nodes-base.slack', version: 2.3,\n config: { name: 'Notify Slack', parameters: {}, position: [840, 350] },\n output: [{ ok: true }]\n});\n\nexport default workflow('id', 'name')\n .add(webhookTrigger)\n .to(processData)\n .to(sendNotification)\n .add(scheduleTrigger)\n .to(processData);\n```\n\n\n\n\n```javascript\nconst openAiModel = languageModel({\n type: '@n8n/n8n-nodes-langchain.lmChatOpenAi', version: 1.3,\n config: { name: 'OpenAI Model', parameters: {}, position: [540, 500] }\n});\n\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger', version: 1,\n config: { name: 'Start', position: [240, 300] },\n output: [{}]\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent', version: 3.1,\n config: {\n name: 'AI Assistant',\n parameters: { promptType: 'define', text: 'You are a helpful assistant' },\n subnodes: { model: openAiModel },\n position: [540, 300]\n },\n output: [{ output: 'AI response text' }]\n});\n\nexport default workflow('ai-assistant', 'AI Assistant')\n .add(startTrigger)\n .to(aiAgent);\n```\n\n\n\n\n```javascript\nconst openAiModel = languageModel({\n type: '@n8n/n8n-nodes-langchain.lmChatOpenAi', version: 1.3,\n config: {\n name: 'OpenAI Model', parameters: {},\n credentials: { openAiApi: newCredential('OpenAI') },\n position: [540, 500]\n }\n});\n\nconst calculatorTool = tool({\n type: '@n8n/n8n-nodes-langchain.toolCalculator', version: 1,\n config: { name: 'Calculator', parameters: {}, position: [700, 500] }\n});\n\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger', version: 1,\n config: { name: 'Start', position: [240, 300] },\n output: [{}]\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent', version: 3.1,\n config: {\n name: 'Math Agent',\n parameters: { promptType: 'define', text: 'You can use tools to help users' },\n subnodes: { model: openAiModel, tools: [calculatorTool] },\n position: [540, 300]\n },\n output: [{ output: '42' }]\n});\n\nexport default workflow('ai-calculator', 'AI Calculator')\n .add(startTrigger)\n .to(aiAgent);\n```\n\n\n\n\n```javascript\nconst gmailTool = tool({\n type: 'n8n-nodes-base.gmailTool', version: 1,\n config: {\n name: 'Gmail Tool',\n parameters: {\n sendTo: fromAi('recipient', 'Email address'),\n subject: fromAi('subject', 'Email subject'),\n message: fromAi('body', 'Email content')\n },\n credentials: { gmailOAuth2: newCredential('Gmail') },\n position: [700, 500]\n }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent', version: 3.1,\n config: {\n name: 'Email Agent',\n parameters: { promptType: 'define', text: 'You can send emails' },\n subnodes: { model: openAiModel, tools: [gmailTool] },\n position: [540, 300]\n },\n output: [{ output: 'Email sent successfully' }]\n});\n\nexport default workflow('ai-email', 'AI Email Sender')\n .add(startTrigger)\n .to(aiAgent);\n```\n\n\n\n```javascript\nconst structuredParser = outputParser({\n type: '@n8n/n8n-nodes-langchain.outputParserStructured', version: 1.3,\n config: {\n name: 'Structured Output Parser',\n parameters: {\n schemaType: 'fromJson',\n jsonSchemaExample: '{ \"sentiment\": \"positive\", \"confidence\": 0.95, \"summary\": \"brief summary\" }'\n },\n position: [700, 500]\n }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent', version: 3.1,\n config: {\n name: 'Sentiment Analyzer',\n parameters: { promptType: 'define', text: 'Analyze the sentiment of the input text', hasOutputParser: true },\n subnodes: { model: openAiModel, outputParser: structuredParser },\n position: [540, 300]\n },\n output: [{ sentiment: 'positive', confidence: 0.95, summary: 'The text expresses satisfaction' }]\n});\n\nexport default workflow('ai-sentiment', 'AI Sentiment Analyzer')\n .add(startTrigger)\n .to(aiAgent);\n```\n";