@onlineapps/conn-orch-orchestrator 1.0.4 → 1.0.6

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.4",
3
+ "version": "1.0.6",
4
4
  "description": "Workflow orchestration connector for OA Drive - handles message routing and workflow execution",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -95,6 +95,7 @@ class WorkflowOrchestrator {
95
95
  const { publishToMonitoringWorkflow } = require('@onlineapps/mq-client-core').monitoring;
96
96
  try {
97
97
  const stepIndex = cookbookDef.steps.findIndex(s => s.id === current_step);
98
+ console.log(`[WorkflowOrchestrator] [PROGRESS] Publishing progress for ${workflow_id}, step: ${current_step}, index: ${stepIndex}`);
98
99
  await publishToMonitoringWorkflow(this.mqClient, {
99
100
  event_type: 'progress',
100
101
  workflow_id: workflow_id,
@@ -106,11 +107,13 @@ class WorkflowOrchestrator {
106
107
  status: 'in_progress',
107
108
  timestamp: new Date().toISOString()
108
109
  }, this.logger, { workflow_id, step_id: current_step });
110
+ console.log(`[WorkflowOrchestrator] [PROGRESS] ✓ Progress published for ${workflow_id}`);
109
111
  } catch (monitoringError) {
110
112
  // Don't fail workflow if monitoring publish fails (helper already logs)
113
+ console.error(`[WorkflowOrchestrator] [PROGRESS] ✗ Failed to publish progress:`, monitoringError);
111
114
  this.logger.warn('Failed to publish workflow.progress to monitoring', {
112
115
  workflow_id,
113
- error: monitoringError.message
116
+ error: monitoringError.message || String(monitoringError)
114
117
  });
115
118
  }
116
119
 
@@ -149,8 +152,8 @@ class WorkflowOrchestrator {
149
152
  // Route to next step
150
153
  await this._routeToNextStep(nextStep, cookbookDef, updatedContext, workflow_id);
151
154
  } else {
152
- // Workflow completed - pass serviceName for monitoring
153
- await this._completeWorkflow(workflow_id, updatedContext, serviceName);
155
+ // Workflow completed - pass serviceName and last step info for monitoring
156
+ await this._completeWorkflow(workflow_id, updatedContext, serviceName, current_step, currentIndex);
154
157
  }
155
158
 
156
159
  return {
@@ -326,13 +329,17 @@ class WorkflowOrchestrator {
326
329
  * @param {string} workflow_id - Workflow ID
327
330
  * @param {Object} finalContext - Final workflow context
328
331
  * @param {string} serviceName - Service name that completed the workflow
332
+ * @param {string} lastStepId - ID of the last completed step
333
+ * @param {number} lastStepIndex - Index of the last completed step
329
334
  */
330
- async _completeWorkflow(workflow_id, finalContext, serviceName = 'unknown') {
335
+ async _completeWorkflow(workflow_id, finalContext, serviceName = 'unknown', lastStepId = null, lastStepIndex = 0) {
331
336
  try {
332
337
  console.log(`[WorkflowOrchestrator] [PUBLISH] Preparing to publish workflow.completed for ${workflow_id}`);
333
338
  this.logger.info(`[WorkflowOrchestrator] [PUBLISH] Preparing to publish workflow.completed`, {
334
339
  workflow_id,
335
340
  serviceName,
341
+ lastStepId,
342
+ lastStepIndex,
336
343
  hasMqClient: !!this.mqClient,
337
344
  mqClientConnected: this.mqClient?._connected
338
345
  });
@@ -346,6 +353,8 @@ class WorkflowOrchestrator {
346
353
  workflow_id,
347
354
  status: 'completed',
348
355
  service: serviceName, // Service that completed the workflow (for monitoring)
356
+ step_id: lastStepId, // Last step ID for monitoring
357
+ step_index: lastStepIndex, // Last step index for monitoring
349
358
  delivery: delivery, // Delivery configuration from Gateway context (must be object)
350
359
  context: finalContext, // Full context for output resolution
351
360
  steps: finalContext?.steps || {}, // Steps results for output resolution