Add all workflow blocks to server and remove concept of workflow environment

This commit is contained in:
Andrew Kingston 2020-09-10 11:29:35 +01:00
parent 98ffd6f971
commit 766d8ac8fc
3 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,5 @@
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
module.exports = async function delay({ args }) {
await wait(args.time)
}

View File

@ -0,0 +1,10 @@
module.exports = async function filter({ args }) {
const { field, condition, value } = args
switch (condition) {
case "equals":
if (field !== value) return
break
default:
return
}
}

View File

@ -37,8 +37,6 @@ exports.serverStrategy = () => ({
},
run: async function(workflow, context) {
for (let block of workflow.steps) {
if (block.type === "CLIENT") continue
const action = require(`../api/controllers/workflow/actions/${block.actionId}`)
const response = await action({
args: this.bindContextArgs(block.args),