Parameters transmision between steps

Sometimes we need to emit generated parameter from a step into another step.

Define output parameters

There is a special stage in steps called 'emit'. The emit behavior is wide different from other stages behaviors.

  1. Allways has to return an key:value object with the parameters we want to expose to others steps.
  2. emit doesn't recive resolve and reject method so allways is synchronous
  3. Parameters emitted replace any previously parameter definition by configuration See parameters for more information.
  4. Parameters are emitted only for the contexts defined on config.json of the step. See steps for more information.

As other stages emit is optional

Example in any steps/stepName/index.js:

  emit: function() {
    return {
      param1: "any text value",
      param2: {
        param3: "thing",
        param4: []
      }
    }
  }

Input in other steps.

All parameters emitted are going to be available on this.params object of all upper steps.

So, any other upper step on any flow in our example have this code:

  run: function() {
    console.log(this.params.param1);
  }

That results in the console:

any text value

DEPRECATED: DO NOT USE - Connect outputs with inputs in other steps. (Just back compatibility mode)

Example:

The following code in flows/flowName/config.json file:

  "steps" : {
    "test1" : {},
    "test2" : {
      "inputs" : {
        "param5" : {"test1": "param1"}
      }
    }
  }

Sets this.params.param5 parameter of test2 step, with the value of this.params.param1 parameter emit by test1.

So, the step steps/step2/index.js could have this code:

  run: function() {
    console.log(this.params.param5);
  }

That results in the console:

any text value