1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

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),