@onlineapps/conn-orch-orchestrator 1.0.50 → 1.0.51
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 +15 -14
package/package.json
CHANGED
|
@@ -192,10 +192,11 @@ class WorkflowOrchestrator {
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
// Build UPDATED UNIFIED COOKBOOK
|
|
195
|
+
// After last step -> pointer to dispatcher (not null)
|
|
195
196
|
const updatedCookbook = {
|
|
196
197
|
...cookbookDef,
|
|
197
198
|
steps: updatedSteps,
|
|
198
|
-
_pointer: { next: nextStep ? this._getStepId(nextStep) :
|
|
199
|
+
_pointer: { next: nextStep ? this._getStepId(nextStep) : 'api_delivery_dispatcher' }
|
|
199
200
|
};
|
|
200
201
|
|
|
201
202
|
// Publish workflow.progress with UNIFIED COOKBOOK
|
|
@@ -234,7 +235,7 @@ class WorkflowOrchestrator {
|
|
|
234
235
|
};
|
|
235
236
|
|
|
236
237
|
} catch (error) {
|
|
237
|
-
// UNIFIED COOKBOOK:
|
|
238
|
+
// UNIFIED COOKBOOK: retry_history is stored in _execution.retry_history
|
|
238
239
|
const crypto = require('crypto');
|
|
239
240
|
|
|
240
241
|
// Find current step index
|
|
@@ -242,8 +243,8 @@ class WorkflowOrchestrator {
|
|
|
242
243
|
const currentIndex = stepsArray.findIndex(s => this._getStepId(s) === current_step);
|
|
243
244
|
const currentStepDef = stepsArray[currentIndex] || {};
|
|
244
245
|
|
|
245
|
-
// Get existing retry history from
|
|
246
|
-
const stepRetryHistory = currentStepDef.
|
|
246
|
+
// Get existing retry history from _execution.retry_history
|
|
247
|
+
const stepRetryHistory = currentStepDef._execution?.retry_history || [];
|
|
247
248
|
const attemptNumber = stepRetryHistory.length + 1;
|
|
248
249
|
|
|
249
250
|
// Generate error reference for log lookup (instead of full stack trace)
|
|
@@ -259,7 +260,7 @@ class WorkflowOrchestrator {
|
|
|
259
260
|
stack: error.stack
|
|
260
261
|
});
|
|
261
262
|
|
|
262
|
-
// Add attempt record to
|
|
263
|
+
// Add attempt record to _execution.retry_history
|
|
263
264
|
const attemptRecord = {
|
|
264
265
|
attempt: attemptNumber,
|
|
265
266
|
error: error.message,
|
|
@@ -267,15 +268,15 @@ class WorkflowOrchestrator {
|
|
|
267
268
|
at: new Date().toISOString()
|
|
268
269
|
};
|
|
269
270
|
|
|
270
|
-
// Update steps array with retry history
|
|
271
|
+
// Update steps array with retry history inside _execution
|
|
271
272
|
const updatedSteps = [...stepsArray];
|
|
272
273
|
updatedSteps[currentIndex] = {
|
|
273
274
|
...currentStepDef,
|
|
274
275
|
_execution: {
|
|
275
276
|
...currentStepDef._execution,
|
|
276
|
-
status: 'retrying'
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
status: 'retrying',
|
|
278
|
+
retry_history: [...stepRetryHistory, attemptRecord]
|
|
279
|
+
}
|
|
279
280
|
};
|
|
280
281
|
|
|
281
282
|
// Build updated UNIFIED COOKBOOK
|
|
@@ -303,7 +304,7 @@ class WorkflowOrchestrator {
|
|
|
303
304
|
service_name: serviceName,
|
|
304
305
|
step_index: currentIndex,
|
|
305
306
|
step_id: current_step,
|
|
306
|
-
cookbook: updatedCookbook, // UNIFIED cookbook with
|
|
307
|
+
cookbook: updatedCookbook, // UNIFIED cookbook with _execution.retry_history
|
|
307
308
|
error: { message: error.message, error_ref: errorRef },
|
|
308
309
|
status: 'retry',
|
|
309
310
|
attempt: attemptNumber,
|
|
@@ -363,9 +364,9 @@ class WorkflowOrchestrator {
|
|
|
363
364
|
_execution: {
|
|
364
365
|
...updatedSteps[currentIndex]._execution,
|
|
365
366
|
status: 'failed',
|
|
366
|
-
failed_at: new Date().toISOString()
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
failed_at: new Date().toISOString(),
|
|
368
|
+
retry_history: [...(updatedSteps[currentIndex]._execution?.retry_history || []), dlqEntryRecord]
|
|
369
|
+
}
|
|
369
370
|
};
|
|
370
371
|
|
|
371
372
|
const finalCookbook = {
|
|
@@ -384,7 +385,7 @@ class WorkflowOrchestrator {
|
|
|
384
385
|
});
|
|
385
386
|
|
|
386
387
|
// Publish to workflow.failed (DLQ queue - message stays until manual requeue/discard)
|
|
387
|
-
// UNIFIED COOKBOOK contains everything including
|
|
388
|
+
// UNIFIED COOKBOOK contains everything including _execution.retry_history
|
|
388
389
|
await this.mqClient.publish('workflow.failed', {
|
|
389
390
|
workflow_id,
|
|
390
391
|
current_step,
|