(json_flow, flow=None)
return json_flow
Migrates any expressions found in the flow definition to use the new @(...) syntax
Migrates any expressions found in the flow definition to use the new
Migrates any expressions found in the flow definition to use the new
def migrate_to_version_8(json_flow, flow=None):
    """
    Migrates any expressions found in the flow definition to use the new @(...) syntax
    """

    def migrate_node(node):
        if isinstance(node, str):
            return migrate_v7_template(node)
        if isinstance(node, list):
            for n in range(len(node)):
                node[n] = migrate_node(node[n])
        if isinstance(node, dict):
            for key, val in node.items():
                node[key] = migrate_node(val)
        return node

    json_flow = map_actions(json_flow, cleanse_group_names)
    for rule_set in json_flow.get("rule_sets", []):
        for rule in rule_set["rules"]:
            migrate_node(rule["test"])

        if "operand" in rule_set and rule_set["operand"]:
            rule_set["operand"] = migrate_node(rule_set["operand"])
        if "webhook" in rule_set and rule_set["webhook"]:
            rule_set["webhook"] = migrate_node(rule_set["webhook"])

    for action_set in json_flow.get("action_sets", []):
        for action in action_set["actions"]:
            migrate_node(action)

    return json_flow
def migrate_to_version_8 ( json_flow , flow = None ) : def migrate_node ( node ) : if isinstance ( node , str ) : return migrate_v7_template ( node ) if isinstance ( node , list ) : for n in range ( len ( node ) ) : node [ n ] = migrate_node ( node [ n ] ) if isinstance ( node , dict ) : for key , val in node . items ( ) : node [ key ] = migrate_node ( val ) return node json_flow = map_actions ( json_flow , cleanse_group_names ) for rule_set in json_flow . get ( "rule_sets" , [ ] ) : for rule in rule_set [ "rules" ] : migrate_node ( rule [ "test" ] ) if "operand" in rule_set and rule_set [ "operand" ] : rule_set [ "operand" ] = migrate_node ( rule_set [ "operand" ] ) if "webhook" in rule_set and rule_set [ "webhook" ] : rule_set [ "webhook" ] = migrate_node ( rule_set [ "webhook" ] ) for action_set in json_flow . get ( "action_sets" , [ ] ) : for action in action_set [ "actions" ] : migrate_node ( action ) return json_flow