Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'prerequisites' for workflows #5

Open
capablemonkey opened this issue Sep 28, 2015 · 1 comment
Open

Add 'prerequisites' for workflows #5

capablemonkey opened this issue Sep 28, 2015 · 1 comment

Comments

@capablemonkey
Copy link
Collaborator

Some workflows depend on particular info being available in the context. In other words, they may depend on some previous step having been run already.

For example, CreateTransferFromMainAccountToCustomer requires context.account to be set, but this is only set when the GetAccountData workflow is run.

I propose adding a prerequisites parameter to workflows, like so:

var helpers = require("../lib/helpers.js");

module.exports.description = "Creates a balance sourced transfer to a customer.";
module.exports.nextSteps = [];
module.exports.prerequisites = ['GetAccountData'];  // looky here
module.exports.steps = [
    {
        endpoint : "transfers",
        method : "post",
        model : "CreateBalanceSourcedTransferFromMainAccountToCustomer",
        extractor : function(response, context) {
            context.transfer = {};
            context.transfer.id = response.headers['location'].split('/')[4];
        }
    }
];

So, we can either have prerequisites be other Workflows, or we can have prerequisites be particular keynames of context which we'd check to make sure they aren't undefined.

@Sammons
Copy link
Owner

Sammons commented Sep 28, 2015

I've been thinking about this too - and this is a good approach, but I'm not sure its what we should use - because other routes may fulfill the prerequisite or multiple separate routes may be prerequisites.

Instead I think it would be more exact to specify which properties need to be set, and specify for each workflow what properties are set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants