@onlineapps/conn-orch-orchestrator 1.0.40 → 1.0.41
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 -6
package/package.json
CHANGED
|
@@ -62,21 +62,28 @@ class WorkflowOrchestrator {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Get steps as array (
|
|
66
|
-
* V2 FORMAT: steps is an
|
|
67
|
-
*
|
|
65
|
+
* Get steps as array (V2.1 is array, V2.0 object is deprecated)
|
|
66
|
+
* V2.1 FORMAT (required): steps is an ARRAY with step_id
|
|
67
|
+
* V2.0 FORMAT (deprecated): steps is an object keyed by step_id
|
|
68
|
+
* V1 FORMAT (banned): steps is an array with 'id' instead of 'step_id'
|
|
68
69
|
* @private
|
|
69
70
|
* @param {Object} cookbookDef - Cookbook definition
|
|
70
71
|
* @returns {Array} Array of step objects
|
|
71
72
|
*/
|
|
72
73
|
_getStepsArray(cookbookDef) {
|
|
73
74
|
if (!cookbookDef?.steps) return [];
|
|
75
|
+
|
|
74
76
|
if (Array.isArray(cookbookDef.steps)) {
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
+
// V2.1 format - steps is an array with step_id
|
|
78
|
+
// Check if it's actually V1 (array with 'id' instead of 'step_id')
|
|
79
|
+
if (cookbookDef.steps.length > 0 && cookbookDef.steps[0].id && !cookbookDef.steps[0].step_id) {
|
|
80
|
+
throw new Error('FAIL-FAST: V1 format (array with "id") is BANNED. Use V2.1 format with "step_id".');
|
|
81
|
+
}
|
|
77
82
|
return cookbookDef.steps;
|
|
78
83
|
}
|
|
79
|
-
|
|
84
|
+
|
|
85
|
+
// V2.0 format (deprecated) - steps is an object keyed by step_id
|
|
86
|
+
this.logger.warn('Using deprecated V2.0 cookbook format (steps as object). Please migrate to V2.1 (steps as array with step_id).');
|
|
80
87
|
return Object.values(cookbookDef.steps);
|
|
81
88
|
}
|
|
82
89
|
|