Merge remote-tracking branch 'origin/master' into v3-ui

This commit is contained in:
Peter Clement 2024-09-27 11:34:50 +01:00
commit e38eb58cf0
2 changed files with 19 additions and 21 deletions

View File

@ -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" } },
], ],
}, },
}, },

View File

@ -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
}) })
}) })