|
7 | 7 | preValidateConditionExpression, |
8 | 8 | validateConditionExpression, |
9 | 9 | } from "@/lib/condition-validator"; |
| 10 | +import { findActionById, flattenConfigFields } from "@/plugins/registry"; |
10 | 11 | import { |
11 | 12 | getActionLabel, |
12 | 13 | getStepImporter, |
@@ -222,6 +223,7 @@ async function executeActionStep(input: { |
222 | 223 | }) { |
223 | 224 | const { actionType, config, outputs, context } = input; |
224 | 225 |
|
| 226 | + // Config is already filtered before this function is called |
225 | 227 | // Build step input WITHOUT credentials, but WITH integrationId reference and logging context |
226 | 228 | const stepInput: Record<string, unknown> = { |
227 | 229 | ...config, |
@@ -539,9 +541,27 @@ export async function executeWorkflow(input: WorkflowExecutionInput) { |
539 | 541 | return; |
540 | 542 | } |
541 | 543 |
|
| 544 | + // Filter config to only include fields defined in the action's configFields |
| 545 | + // This must happen BEFORE processTemplates to prevent extra fields from being processed |
| 546 | + let filteredConfig = config; |
| 547 | + const action = findActionById(actionType); |
| 548 | + if (action) { |
| 549 | + const validKeys = new Set( |
| 550 | + flattenConfigFields(action.configFields).map((field) => field.key) |
| 551 | + ); |
| 552 | + // Always include integrationId and actionType |
| 553 | + validKeys.add("integrationId"); |
| 554 | + validKeys.add("actionType"); |
| 555 | + validKeys.add("condition"); // Keep condition for special handling |
| 556 | + |
| 557 | + filteredConfig = Object.fromEntries( |
| 558 | + Object.entries(config).filter(([key]) => validKeys.has(key)) |
| 559 | + ); |
| 560 | + } |
| 561 | + |
542 | 562 | // Process templates in config, but keep condition unprocessed for special handling |
543 | | - const configWithoutCondition = { ...config }; |
544 | | - const originalCondition = config.condition; |
| 563 | + const configWithoutCondition = { ...filteredConfig }; |
| 564 | + const originalCondition = filteredConfig.condition; |
545 | 565 | configWithoutCondition.condition = undefined; |
546 | 566 |
|
547 | 567 | const processedConfig = processTemplates( |
|
0 commit comments