Evaluate all env vars as part of async flow start

This commit is contained in:
Nick O'Leary
2023-06-23 02:11:57 +01:00
parent 8db2972288
commit 1c5fdb6ab6
16 changed files with 1141 additions and 1290 deletions

View File

@@ -253,35 +253,32 @@ describe('subflow', function() {
it('should access typed value of env var', function(done) {
var flow = [
{id:"t0", type:"tab", label:"", disabled:false, info:""},
{id:"n1", x:10, y:10, z:"t0", type:"subflow:s1",
env: [
{name: "KN", type: "num", value: "100"},
{name: "KB", type: "bool", value: "true"},
{name: "KJ", type: "json", value: "[1,2,3]"},
{name: "Kb", type: "bin", value: "[65,65]"},
{name: "Ke", type: "env", value: "KS"},
{name: "Kj", type: "jsonata", value: "1+2"},
],
wires:[["n2"]]},
{id:"n2", x:10, y:10, z:"t0", type:"helper", wires:[]},
// Subflow
{id:"s1", type:"subflow", name:"Subflow", info:"",
in:[{
x:10, y:10,
wires:[ {id:"s1-n1"} ]
}],
out:[{
x:10, y:10,
wires:[ {id:"s1-n1", port:0} ]
}],
env: [
{name: "KS", type: "str", value: "STR"}
]
{ id: "t0", type: "tab", label: "", disabled: false, info: "" },
{
id: "n1", x: 10, y: 10, z: "t0", type: "subflow:s1",
env: [
{ name: "KN", type: "num", value: "100" },
{ name: "KB", type: "bool", value: "true" },
{ name: "KJ", type: "json", value: "[1,2,3]" },
{ name: "Kb", type: "bin", value: "[65,65]" },
{ name: "Ke", type: "env", value: "KS" },
{ name: "Kj", type: "jsonata", value: "1+2" },
],
wires: [["n2"]]
},
{id:"s1-n1", x:10, y:10, z:"s1", type:"function",
func:"msg.VE = env.get('Ke'); msg.VS = env.get('KS'); msg.VN = env.get('KN'); msg.VB = env.get('KB'); msg.VJ = env.get('KJ'); msg.Vb = env.get('Kb'); msg.Vj = env.get('Kj'); return msg;",
wires:[]}
{ id: "n2", x: 10, y: 10, z: "t0", type: "helper", wires: [] },
// Subflow
{
id: "s1", type: "subflow", name: "Subflow", info: "",
in: [{ x: 10, y: 10, wires: [{ id: "s1-n1" }] }],
out: [{ x: 10, y: 10, wires: [{ id: "s1-n1", port: 0 }] }],
env: [{ name: "KS", type: "str", value: "STR" }]
},
{
id: "s1-n1", x: 10, y: 10, z: "s1", type: "function",
func: "msg.VE = env.get('Ke'); msg.VS = env.get('KS'); msg.VN = env.get('KN'); msg.VB = env.get('KB'); msg.VJ = env.get('KJ'); msg.Vb = env.get('Kb'); msg.Vj = env.get('Kj'); return msg;",
wires: []
}
];
helper.load(functionNode, flow, function() {
var n1 = helper.getNode("n1");