(loopDef, variables, client)
| 239 | } |
| 240 | |
| 241 | async executeLoop(loopDef, variables, client) { |
| 242 | const loopVarName = loopDef.as; |
| 243 | const loopVariables = {...variables}; |
| 244 | |
| 245 | let iterable; |
| 246 | if (loopDef.over !== undefined) { |
| 247 | iterable = loopDef.over; |
| 248 | } else if (loopDef.range !== undefined) { |
| 249 | const {start, end} = loopDef.range; |
| 250 | iterable = Array.from({length: end - start + 1}, (_, i) => start + i); |
| 251 | } else { |
| 252 | throw new Error("Loop must have 'over' or 'range' defined."); |
| 253 | } |
| 254 | |
| 255 | for (const item of iterable) { |
| 256 | loopVariables[loopVarName] = item; |
| 257 | await this.executeSteps(loopDef.steps, loopVariables, client); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | async executeStep(step, variables, client) { |
| 262 | const queryTemplate = step.query; |
no test coverage detected