@onlineapps/conn-orch-orchestrator 1.0.57 → 1.0.59

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.57",
3
+ "version": "1.0.59",
4
4
  "description": "Workflow orchestration connector for OA Drive - handles message routing and workflow execution",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -152,9 +152,19 @@ class WorkflowOrchestrator {
152
152
  }
153
153
  };
154
154
 
155
- // Execute the step (pass api_input from cookbook as context for operations)
155
+ // Execute the step (build full context for template resolution)
156
+ const stepsArrayCtx = this._getStepsArray(cookbookDef);
157
+ const stepsMap = {};
158
+ stepsArrayCtx.forEach((s) => {
159
+ const id = this._getStepId(s);
160
+ if (id) {
161
+ stepsMap[id] = s;
162
+ }
163
+ });
156
164
  const stepContext = {
157
- ...cookbookDef.api_input,
165
+ api_input: cookbookDef.api_input || {},
166
+ steps: stepsArrayCtx, // array (legacy consumers expect .map)
167
+ steps_by_id: stepsMap, // fast lookup by step_id for templating
158
168
  _system: cookbookDef._system,
159
169
  delivery: cookbookDef.delivery
160
170
  };
@@ -563,13 +573,16 @@ class WorkflowOrchestrator {
563
573
  const part = parts[i];
564
574
  if (current === undefined || current === null) return undefined;
565
575
 
566
- // Special handling for 'steps' array - lookup by step id
567
- // context.steps is an array of {id/step_id: "step_id", output: {...}}
568
- // Path like "steps.greeting.output" should find step with id="greeting"
569
- if (parts[i - 1] === 'steps' && Array.isArray(context.steps)) {
570
- // 'part' is the step_id, find the step in the array (support both 'id' and 'step_id')
571
- const step = context.steps.find(s => s.id === part || s.step_id === part);
572
- current = step;
576
+ // Special handling for 'steps' - support array (legacy) and map (steps_by_id)
577
+ if (parts[i - 1] === 'steps') {
578
+ if (context.steps_by_id && context.steps_by_id[part]) {
579
+ current = context.steps_by_id[part];
580
+ } else if (Array.isArray(context.steps)) {
581
+ const step = context.steps.find(s => s.id === part || s.step_id === part);
582
+ current = step;
583
+ } else {
584
+ current = undefined;
585
+ }
573
586
  } else {
574
587
  current = current[part];
575
588
  }