Fix small issue with conditions in branches
This commit is contained in:
parent
d550aad63a
commit
acdcd02fcd
|
@ -32,25 +32,25 @@ describe("Branching automations", () => {
|
||||||
steps: stepBuilder =>
|
steps: stepBuilder =>
|
||||||
stepBuilder.serverLog({ text: "Branch 1.1" }),
|
stepBuilder.serverLog({ text: "Branch 1.1" }),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "steps.1.success": true },
|
equal: { "{{steps.1.success}}": true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
branch2: {
|
branch2: {
|
||||||
steps: stepBuilder =>
|
steps: stepBuilder =>
|
||||||
stepBuilder.serverLog({ text: "Branch 1.2" }),
|
stepBuilder.serverLog({ text: "Branch 1.2" }),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "steps.1.success": false },
|
equal: { "{{steps.1.success}}": false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "steps.1.success": true },
|
equal: { "{{steps.1.success}}": true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
topLevelBranch2: {
|
topLevelBranch2: {
|
||||||
steps: stepBuilder => stepBuilder.serverLog({ text: "Branch 2" }),
|
steps: stepBuilder => stepBuilder.serverLog({ text: "Branch 2" }),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "steps.1.success": false },
|
equal: { "{{steps.1.success}}": false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -70,14 +70,14 @@ describe("Branching automations", () => {
|
||||||
activeBranch: {
|
activeBranch: {
|
||||||
steps: stepBuilder => stepBuilder.serverLog({ text: "Active user" }),
|
steps: stepBuilder => stepBuilder.serverLog({ text: "Active user" }),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "trigger.fields.status": "active" },
|
equal: { "{{trigger.fields.status}}": "active" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inactiveBranch: {
|
inactiveBranch: {
|
||||||
steps: stepBuilder =>
|
steps: stepBuilder =>
|
||||||
stepBuilder.serverLog({ text: "Inactive user" }),
|
stepBuilder.serverLog({ text: "Inactive user" }),
|
||||||
condition: {
|
condition: {
|
||||||
equal: { "trigger.fields.status": "inactive" },
|
equal: { "{{trigger.fields.status}}": "inactive" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -102,8 +102,8 @@ describe("Branching automations", () => {
|
||||||
condition: {
|
condition: {
|
||||||
$and: {
|
$and: {
|
||||||
conditions: [
|
conditions: [
|
||||||
{ equal: { "trigger.fields.status": "active" } },
|
{ equal: { "{{trigger.fields.status}}": "active" } },
|
||||||
{ equal: { "trigger.fields.role": "admin" } },
|
{ equal: { "{{trigger.fields.role}}": "admin" } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -111,7 +111,7 @@ describe("Branching automations", () => {
|
||||||
otherBranch: {
|
otherBranch: {
|
||||||
steps: stepBuilder => stepBuilder.serverLog({ text: "Other user" }),
|
steps: stepBuilder => stepBuilder.serverLog({ text: "Other user" }),
|
||||||
condition: {
|
condition: {
|
||||||
notEqual: { "trigger.fields.status": "active" },
|
notEqual: { "{{trigger.fields.status}}": "active" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -133,8 +133,8 @@ describe("Branching automations", () => {
|
||||||
condition: {
|
condition: {
|
||||||
$or: {
|
$or: {
|
||||||
conditions: [
|
conditions: [
|
||||||
{ equal: { "trigger.fields.status": "test" } },
|
{ equal: { "{{trigger.fields.status}}": "test" } },
|
||||||
{ equal: { "trigger.fields.role": "admin" } },
|
{ equal: { "{{trigger.fields.role}}": "admin" } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -144,8 +144,8 @@ describe("Branching automations", () => {
|
||||||
condition: {
|
condition: {
|
||||||
$and: {
|
$and: {
|
||||||
conditions: [
|
conditions: [
|
||||||
{ notEqual: { "trigger.fields.status": "active" } },
|
{ notEqual: { "{{trigger.fields.status}}": "active" } },
|
||||||
{ notEqual: { "trigger.fields.role": "admin" } },
|
{ notEqual: { "{{trigger.fields.role}}": "admin" } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -170,8 +170,8 @@ describe("Branching automations", () => {
|
||||||
condition: {
|
condition: {
|
||||||
$or: {
|
$or: {
|
||||||
conditions: [
|
conditions: [
|
||||||
{ equal: { "trigger.fields.status": "new" } },
|
{ equal: { "{{trigger.fields.status}}": "new" } },
|
||||||
{ equal: { "trigger.fields.role": "admin" } },
|
{ equal: { "{{trigger.fields.role}}": "admin" } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -181,8 +181,8 @@ describe("Branching automations", () => {
|
||||||
condition: {
|
condition: {
|
||||||
$and: {
|
$and: {
|
||||||
conditions: [
|
conditions: [
|
||||||
{ equal: { "trigger.fields.status": "active" } },
|
{ equal: { "{{trigger.fields.status}}": "active" } },
|
||||||
{ equal: { "trigger.fields.role": "admin" } },
|
{ equal: { "{{trigger.fields.role}}": "admin" } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -516,10 +516,8 @@ class Orchestrator {
|
||||||
filter => {
|
filter => {
|
||||||
Object.entries(filter).forEach(([_, value]) => {
|
Object.entries(filter).forEach(([_, value]) => {
|
||||||
Object.entries(value).forEach(([field, _]) => {
|
Object.entries(value).forEach(([field, _]) => {
|
||||||
const fromContext = processStringSync(
|
const updatedField = field.replace("{{", "{{ literal ")
|
||||||
`{{ literal ${field} }}`,
|
const fromContext = processStringSync(updatedField, this.context)
|
||||||
this.context
|
|
||||||
)
|
|
||||||
toFilter[field] = fromContext
|
toFilter[field] = fromContext
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue