@stravigor/workflow 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/workflow.ts +3 -1
package/package.json
CHANGED
package/src/workflow.ts
CHANGED
|
@@ -149,8 +149,10 @@ export class Workflow {
|
|
|
149
149
|
private async runLoop(step: LoopStep, ctx: WorkflowContext): Promise<void> {
|
|
150
150
|
let currentInput: unknown = step.mapInput ? step.mapInput(ctx) : ctx.input
|
|
151
151
|
let lastResult: unknown
|
|
152
|
+
let ran = false
|
|
152
153
|
|
|
153
154
|
for (let i = 0; i < step.maxIterations; i++) {
|
|
155
|
+
ran = true
|
|
154
156
|
lastResult = await step.handler(currentInput, ctx)
|
|
155
157
|
|
|
156
158
|
if (step.until?.(lastResult, i + 1)) break
|
|
@@ -160,7 +162,7 @@ export class Workflow {
|
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
|
|
163
|
-
if (
|
|
165
|
+
if (ran) {
|
|
164
166
|
ctx.results[step.name] = lastResult
|
|
165
167
|
}
|
|
166
168
|
}
|