@onlineapps/conn-orch-orchestrator 1.0.111 → 1.0.112
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 +13 -0
package/package.json
CHANGED
|
@@ -1120,6 +1120,18 @@ class WorkflowOrchestrator {
|
|
|
1120
1120
|
// at top level — not buried inside cookbook._system.
|
|
1121
1121
|
const sys = cookbook._system || {};
|
|
1122
1122
|
|
|
1123
|
+
// Extract api_output from the last executed step's output.
|
|
1124
|
+
// Canonical source: cookbook.steps[lastStepIndex].output.
|
|
1125
|
+
// Downstream (DeliveryDispatcher, monitoring, Admin UI) needs a flat
|
|
1126
|
+
// api_output field to surface workflow results to clients without
|
|
1127
|
+
// having to traverse the cookbook graph.
|
|
1128
|
+
let apiOutput = null;
|
|
1129
|
+
const steps = Array.isArray(finalCookbook.steps) ? finalCookbook.steps : [];
|
|
1130
|
+
const lastStep = steps[lastStepIndex] || (steps.length > 0 ? steps[steps.length - 1] : null);
|
|
1131
|
+
if (lastStep && typeof lastStep === 'object' && Object.prototype.hasOwnProperty.call(lastStep, 'output')) {
|
|
1132
|
+
apiOutput = lastStep.output ?? null;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1123
1135
|
const workflowCompletedMessage = {
|
|
1124
1136
|
workflow_id,
|
|
1125
1137
|
tenant_id: sys.tenant_id,
|
|
@@ -1129,6 +1141,7 @@ class WorkflowOrchestrator {
|
|
|
1129
1141
|
service: serviceName,
|
|
1130
1142
|
step_id: lastStepId,
|
|
1131
1143
|
step_index: lastStepIndex,
|
|
1144
|
+
api_output: apiOutput,
|
|
1132
1145
|
cookbook: finalCookbook,
|
|
1133
1146
|
delivery: cookbook.delivery || { handler: 'none' },
|
|
1134
1147
|
completed_at: new Date().toISOString()
|