( templateSteps: BuiltTemplateNextStep[], responseParamsMap: NextStepParamsMap | undefined, )
| 105 | } |
| 106 | |
| 107 | function mergeTemplateAndResponseNextSteps( |
| 108 | templateSteps: BuiltTemplateNextStep[], |
| 109 | responseParamsMap: NextStepParamsMap | undefined, |
| 110 | ): NextStep[] { |
| 111 | const consumedCounts = new Map<string, number>(); |
| 112 | |
| 113 | return templateSteps.map((builtTemplateStep) => { |
| 114 | const templateStep = builtTemplateStep.step; |
| 115 | if (!builtTemplateStep.templateToolId || !templateStep.tool) { |
| 116 | return templateStep; |
| 117 | } |
| 118 | |
| 119 | const paramsFromMap = consumeDynamicParams( |
| 120 | responseParamsMap, |
| 121 | builtTemplateStep.templateToolId, |
| 122 | consumedCounts, |
| 123 | ); |
| 124 | if (!paramsFromMap) { |
| 125 | return templateStep; |
| 126 | } |
| 127 | |
| 128 | return { |
| 129 | ...templateStep, |
| 130 | params: { |
| 131 | ...(templateStep.params ?? {}), |
| 132 | ...paramsFromMap, |
| 133 | }, |
| 134 | }; |
| 135 | }); |
| 136 | } |
| 137 | |
| 138 | function getNextStepTarget(params: { |
| 139 | catalog: ToolCatalog; |
no test coverage detected