red/nodes/flows.js
/**
 * Parses the current activeConfig and creates the required node instances
 */
Parses the current activeConfig and creates the required node instances
Parses the current activeConfig and creates the required node instances
function parseConfig() {
    var i;
    var nt;
    missingTypes = [];
    for (i=0;i<activeConfig.length;i++) {
        var type = activeConfig[i].type;
        if (type != "workspace" && type != "tab") {
            nt = typeRegistry.get(type);
            if (!nt && missingTypes.indexOf(type) == -1) {
                missingTypes.push(type);
            }
        }
    }
    if (missingTypes.length > 0) {
        util.log("[red] Waiting for missing types to be registered:");
        for (i=0;i<missingTypes.length;i++) {
            util.log("[red]  - "+missingTypes[i]);
        }
        return;
    }
    util.log("[red] Starting flows");
    events.emit("nodes-starting");
    for (i=0;i<activeConfig.length;i++) {
        var nn = null;
        if (activeConfig[i].type != "workspace" && activeConfig[i].type != "tab") {
            nt = typeRegistry.get(activeConfig[i].type);
            if (nt) {
                try {
                    nn = new nt(activeConfig[i]);
                }
                catch (err) {
                    util.log("[red] "+activeConfig[i].type+" : "+err);
                }
            }
            if (nn === null) {
                util.log("[red] unknown type: "+activeConfig[i].type);
            }
        }
    }
    credentials.clean(flowNodes.get);
    events.emit("nodes-started");
}
function parseConfig ( ) { var i ; var nt ; missingTypes = [ ] ; for ( i = 0 ; i < activeConfig . length ; i ++ ) { var type = activeConfig [ i ] . type ; if ( type != "workspace" && type != "tab" ) { nt = typeRegistry . get ( type ) ; if ( ! nt && missingTypes . indexOf ( type ) == - 1 ) { missingTypes . push ( type ) ; } } } if ( missingTypes . length > 0 ) { util . log ( "[red] Waiting for missing types to be registered:" ) ; for ( i = 0 ; i < missingTypes . length ; i ++ ) { util . log ( "[red]  - " + missingTypes [ i ] ) ; } return ; } util . log ( "[red] Starting flows" ) ; events . emit ( "nodes-starting" ) ; for ( i = 0 ; i < activeConfig . length ; i ++ ) { var nn = null ; if ( activeConfig [ i ] . type != "workspace" && activeConfig [ i ] . type != "tab" ) { nt = typeRegistry . get ( activeConfig [ i ] . type ) ; if ( nt ) { try { nn = new nt ( activeConfig [ i ] ) ; } catch ( err ) { util . log ( "[red] " + activeConfig [ i ] . type + " : " + err ) ; } } if ( nn === null ) { util . log ( "[red] unknown type: " + activeConfig [ i ] . type ) ; } } } credentials . clean ( flowNodes . get ) ; events . emit ( "nodes-started" ) ; }
Parses the current activeConfig and creates the required node instances
Parses the current activeConfig and creates the required node instances
// Scan the configuration for any unknown node types // TODO: remove workspace in next release+1 // Abort if there are any missing types // Instantiate each node in the flow // TODO: remove workspace in next release+1 // console.log(nn); // Clean up any orphaned credentials