mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 13:33:11 +00:00
feat: implement smart parameters (branch, case) for multi-output nodes (Phase 1, Task 2)
Add intuitive semantic parameters for working with IF and Switch nodes: - branch='true'|'false' for IF nodes (maps to sourceOutput) - case=N for Switch nodes (maps to sourceIndex) - Smart parameters resolve to technical parameters automatically - Explicit parameters always override smart parameters Implementation: - Added branch and case parameters to AddConnectionOperation and RewireConnectionOperation interfaces - Created resolveSmartParameters() helper method to map semantic to technical parameters - Updated applyAddConnection() to use smart parameter resolution - Updated applyRewireConnection() to use smart parameter resolution - Updated validateRewireConnection() to validate with resolved smart parameters Tests: - Added 8 comprehensive tests for smart parameters feature - All 141 workflow diff engine tests passing - Coverage: 91.7% overall 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,9 @@ export interface AddConnectionOperation extends DiffOperation {
|
||||
targetInput?: string; // Default: 'main'
|
||||
sourceIndex?: number; // Default: 0
|
||||
targetIndex?: number; // Default: 0
|
||||
// Smart parameters for multi-output nodes (Phase 1 UX improvement)
|
||||
branch?: 'true' | 'false'; // For IF nodes: maps to sourceOutput
|
||||
case?: number; // For Switch nodes: maps to sourceIndex
|
||||
}
|
||||
|
||||
export interface RemoveConnectionOperation extends DiffOperation {
|
||||
@@ -95,6 +98,9 @@ export interface RewireConnectionOperation extends DiffOperation {
|
||||
sourceOutput?: string; // Optional: which output to rewire (default: 'main')
|
||||
targetInput?: string; // Optional: which input type (default: 'main')
|
||||
sourceIndex?: number; // Optional: which source index (default: 0)
|
||||
// Smart parameters for multi-output nodes (Phase 1 UX improvement)
|
||||
branch?: 'true' | 'false'; // For IF nodes: maps to sourceOutput
|
||||
case?: number; // For Switch nodes: maps to sourceIndex
|
||||
}
|
||||
|
||||
// Workflow Metadata Operations
|
||||
|
||||
Reference in New Issue
Block a user