Files
patel-lyzr 1766bdf497 feat: Implement AI Gateway page with feature tiles and descriptions
feat: Update AppSidebar to include new Environments and Credentials sections

feat: Enhance node form with branch selection for triggers and deployment

feat: Create CredentialForm and CredentialRow components for managing credentials

feat: Add API endpoints for credential management

fix: Update node catalog defaults for deploy and promote nodes
2026-05-13 22:15:08 +05:30

50 lines
1.4 KiB
Go

package executors
import (
"context"
"github.com/lyzrai/flow/pkg/engine"
"github.com/lyzrai/flow/pkg/models"
)
// TriggerExecutor is a universal trigger node that passes through the trigger data
// injected by the runner. All n8n trigger types are mapped to this single executor.
//
// In addition, it stamps `fromBranch` and `toBranch` from the node's parameters
// onto every output item (without overwriting incoming values from a webhook
// payload). Downstream nodes — Build (for clone) and Promote (for the PR) —
// read those keys, so the Trigger node is the single place to change the
// branch pair for a pipeline.
type TriggerExecutor struct{}
func (e *TriggerExecutor) Execute(_ context.Context, node models.NodeDef, inputs [][]models.Item, _ *engine.ExecutionContext) (map[int][]models.Item, error) {
var items []models.Item
for _, input := range inputs {
items = append(items, input...)
}
if len(items) == 0 {
items = []models.Item{{}}
}
fromBranch := strParam(node.Parameters, "fromBranch", "")
toBranch := strParam(node.Parameters, "toBranch", "")
for i, it := range items {
if it == nil {
it = models.Item{}
}
if fromBranch != "" {
if _, ok := it["fromBranch"]; !ok {
it["fromBranch"] = fromBranch
}
}
if toBranch != "" {
if _, ok := it["toBranch"]; !ok {
it["toBranch"] = toBranch
}
}
items[i] = it
}
return map[int][]models.Item{0: items}, nil
}