@onlineapps/conn-orch-orchestrator 1.0.6 → 1.0.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/WorkflowOrchestrator.js +20 -7
package/package.json
CHANGED
|
@@ -135,17 +135,30 @@ class WorkflowOrchestrator {
|
|
|
135
135
|
result = await this._executeStep(step, enrichedContext, cookbookDef);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// Update context with result (
|
|
138
|
+
// Update context with result - steps as ARRAY (consistent with cookbook.steps)
|
|
139
|
+
// Each step preserves its definition (id, type, service, operation, input) and adds output
|
|
140
|
+
const currentIndex = cookbookDef.steps.findIndex(s => s.id === current_step);
|
|
141
|
+
const stepDefinition = cookbookDef.steps[currentIndex];
|
|
142
|
+
|
|
143
|
+
// Initialize steps array from cookbook if not present
|
|
144
|
+
const existingSteps = Array.isArray(enrichedContext.steps)
|
|
145
|
+
? [...enrichedContext.steps]
|
|
146
|
+
: cookbookDef.steps.map(s => ({ ...s })); // Deep copy of step definitions
|
|
147
|
+
|
|
148
|
+
// Update the current step with output (preserve id, type, service, operation, input)
|
|
149
|
+
existingSteps[currentIndex] = {
|
|
150
|
+
...stepDefinition, // id, type, service, operation, input
|
|
151
|
+
output: result, // Add output from operation
|
|
152
|
+
status: 'completed',
|
|
153
|
+
completed_at: new Date().toISOString()
|
|
154
|
+
};
|
|
155
|
+
|
|
139
156
|
const updatedContext = {
|
|
140
157
|
...enrichedContext,
|
|
141
|
-
steps:
|
|
142
|
-
...enrichedContext.steps,
|
|
143
|
-
[current_step]: result
|
|
144
|
-
}
|
|
158
|
+
steps: existingSteps
|
|
145
159
|
};
|
|
146
160
|
|
|
147
|
-
// Find next step
|
|
148
|
-
const currentIndex = cookbookDef.steps.findIndex(s => s.id === current_step);
|
|
161
|
+
// Find next step (currentIndex already defined above)
|
|
149
162
|
const nextStep = cookbookDef.steps[currentIndex + 1];
|
|
150
163
|
|
|
151
164
|
if (nextStep) {
|