@objectstack/service-automation 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,19 +25,8 @@ export class LogicNodesPlugin implements Plugin {
25
25
  const conditions = (config?.conditions ?? []) as Array<{ label: string; expression: string }>;
26
26
 
27
27
  for (const cond of conditions) {
28
- // MVP: Simple template replacement + expression evaluation.
29
- // Flow definitions are authored by trusted developers/admins.
30
- // TODO: Replace with safe expression evaluator (e.g., jexl) for production.
31
- let expr = cond.expression;
32
- for (const [k, v] of variables) {
33
- expr = expr.split(`{${k}}`).join(String(v));
34
- }
35
- try {
36
- if (new Function(`return (${expr})`)()) {
37
- return { success: true, branchLabel: cond.label };
38
- }
39
- } catch {
40
- // Continue to next condition
28
+ if (engine.evaluateCondition(cond.expression, variables)) {
29
+ return { success: true, branchLabel: cond.label };
41
30
  }
42
31
  }
43
32
  return { success: true, branchLabel: 'default' };