Add all workflow blocks to server and remove concept of workflow environment
This commit is contained in:
parent
45791b68c9
commit
20dfc87ab2
|
@ -0,0 +1,5 @@
|
||||||
|
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
||||||
|
module.exports = async function delay({ args }) {
|
||||||
|
await wait(args.time)
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,8 +37,6 @@ exports.serverStrategy = () => ({
|
||||||
},
|
},
|
||||||
run: async function(workflow, context) {
|
run: async function(workflow, context) {
|
||||||
for (let block of workflow.steps) {
|
for (let block of workflow.steps) {
|
||||||
if (block.type === "CLIENT") continue
|
|
||||||
|
|
||||||
const action = require(`../api/controllers/workflow/actions/${block.actionId}`)
|
const action = require(`../api/controllers/workflow/actions/${block.actionId}`)
|
||||||
const response = await action({
|
const response = await action({
|
||||||
args: this.bindContextArgs(block.args),
|
args: this.bindContextArgs(block.args),
|
||||||
|
|
Loading…
Reference in New Issue