(
group: ConditionGroupExpr
)
| 103 | throw new Error(`unsupported condition '${JSON.stringify(condition)}'`); |
| 104 | }; |
| 105 | const convertGroup = async ( |
| 106 | group: ConditionGroupExpr |
| 107 | ): Promise<CELExpr | undefined> => { |
| 108 | const { operator, args } = group; |
| 109 | if (args.length === 0) { |
| 110 | return undefined; |
| 111 | } |
| 112 | if (args.length === 1) { |
| 113 | // A dangled Logical Group should be extracted as single condition |
| 114 | return await convert(args[0]); |
| 115 | } |
| 116 | const [left, ...rest] = args; |
| 117 | return wrapCallExpr( |
| 118 | operator, |
| 119 | [ |
| 120 | await convert(left), |
| 121 | await convertGroup({ |
| 122 | type: ExprType.ConditionGroup, |
| 123 | operator, |
| 124 | args: rest, |
| 125 | }), |
| 126 | ].filter(Boolean) as CELExpr[] |
| 127 | ); |
| 128 | }; |
| 129 | |
| 130 | seq.id = 1; |
| 131 | try { |
no test coverage detected