@onlineapps/conn-orch-orchestrator 1.0.3 → 1.0.5

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.3",
3
+ "version": "1.0.5",
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
153
- await this._completeWorkflow(workflow_id, updatedContext);
155
+ // Workflow completed - pass serviceName for monitoring
156
+ await this._completeWorkflow(workflow_id, updatedContext, serviceName);
154
157
  }
155
158
 
156
159
  return {
@@ -325,12 +328,14 @@ class WorkflowOrchestrator {
325
328
  * @async
326
329
  * @param {string} workflow_id - Workflow ID
327
330
  * @param {Object} finalContext - Final workflow context
331
+ * @param {string} serviceName - Service name that completed the workflow
328
332
  */
329
- async _completeWorkflow(workflow_id, finalContext) {
333
+ async _completeWorkflow(workflow_id, finalContext, serviceName = 'unknown') {
330
334
  try {
331
335
  console.log(`[WorkflowOrchestrator] [PUBLISH] Preparing to publish workflow.completed for ${workflow_id}`);
332
336
  this.logger.info(`[WorkflowOrchestrator] [PUBLISH] Preparing to publish workflow.completed`, {
333
337
  workflow_id,
338
+ serviceName,
334
339
  hasMqClient: !!this.mqClient,
335
340
  mqClientConnected: this.mqClient?._connected
336
341
  });
@@ -343,6 +348,7 @@ class WorkflowOrchestrator {
343
348
  const workflowCompletedMessage = {
344
349
  workflow_id,
345
350
  status: 'completed',
351
+ service: serviceName, // Service that completed the workflow (for monitoring)
346
352
  delivery: delivery, // Delivery configuration from Gateway context (must be object)
347
353
  context: finalContext, // Full context for output resolution
348
354
  steps: finalContext?.steps || {}, // Steps results for output resolution