@onlineapps/conn-orch-orchestrator 1.0.21 → 1.0.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-orchestrator",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Workflow orchestration connector for OA Drive - handles message routing and workflow execution",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -280,9 +280,14 @@ class WorkflowOrchestrator {
280
280
  * @returns {Promise<Object>} API call result
281
281
  */
282
282
  async _executeTaskStep(step, context) {
283
- // Resolve variable references in step.input (e.g. ${steps[0].output.message})
284
- // Resolve variable references in step.input (e.g. ${api_input.file}, ${steps[0].output.message})
283
+ // Debug: log context.steps keys
284
+ console.log(`[WorkflowOrchestrator] [RESOLVE] Step ${step.step_id} - context.steps keys:`,
285
+ context.steps ? Object.keys(context.steps) : 'NO STEPS');
286
+
287
+ // Resolve variable references in step.input (e.g. {{steps.step_id.output.field}})
288
+ console.log(`[WorkflowOrchestrator] [RESOLVE] Step ${step.step_id} input BEFORE:`, JSON.stringify(step.input));
285
289
  const resolvedInput = this._resolveInputReferences(step.input, context);
290
+ console.log(`[WorkflowOrchestrator] [RESOLVE] Step ${step.step_id} input AFTER:`, JSON.stringify(resolvedInput));
286
291
 
287
292
  // Use API mapper to call the service with resolved input
288
293
  const result = await this.apiMapper.callOperation(
@@ -517,6 +522,21 @@ class WorkflowOrchestrator {
517
522
  // Delivery Dispatcher requires: workflow_id, status, delivery (must be object, not null)
518
523
  const delivery = finalContext?.delivery || cookbookDef?.delivery || { handler: 'none' };
519
524
 
525
+ // Extract api_output from the last completed step
526
+ // steps is an object keyed by step_id in V2
527
+ let api_output = null;
528
+ if (lastStepId && finalContext?.steps?.[lastStepId]?.output) {
529
+ api_output = finalContext.steps[lastStepId].output;
530
+ } else if (finalContext?.steps) {
531
+ // Fallback: find any step with output
532
+ const stepKeys = Object.keys(finalContext.steps);
533
+ for (const key of stepKeys) {
534
+ if (finalContext.steps[key]?.output) {
535
+ api_output = finalContext.steps[key].output;
536
+ }
537
+ }
538
+ }
539
+
520
540
  // Build message in format expected by Delivery Dispatcher
521
541
  const workflowCompletedMessage = {
522
542
  workflow_id,
@@ -524,10 +544,11 @@ class WorkflowOrchestrator {
524
544
  service: serviceName, // Service that completed the workflow (for monitoring)
525
545
  step_id: lastStepId, // Last step ID for monitoring
526
546
  step_index: lastStepIndex, // Last step index for monitoring
547
+ api_output: api_output, // Output from last step - for frontend/delivery
527
548
  cookbook: cookbookDef, // Full cookbook for monitoring trace
528
549
  delivery: delivery, // Delivery configuration from Gateway context (must be object)
529
550
  context: finalContext, // Full context for output resolution
530
- steps: finalContext?.steps || [], // Steps results (array) for output resolution
551
+ steps: finalContext?.steps || {}, // Steps results (object) for output resolution
531
552
  completed_at: new Date().toISOString()
532
553
  };
533
554