nl_tokens: //////////////////////////////////////////////////////////// Only helper functions defined below in this scope
pl_tokens: async function retrieveModules ( modules ) { modules = JSON . parse ( JSON . stringify ( modules ) ) ; const xgrls = [ ] ; for ( const moduleName in modules ) { const xgrl = Config . Sources [ modules [ moduleName ] . Source ] ; if ( xgrls . indexOf ( xgrl ) === - 1 ) xgrls . push ( xgrl ) ; modules [ moduleName ] . Source = xgrl } // console.dir(xgrls); let promises = [ ] ; for ( const xgrl of xgrls ) { promises . push ( new Promise ( async ( res ) => { let broker ; if ( xgrl in BrokerCache ) { broker = BrokerCache [ xgrl ] ; } else { const timer = log . time ( 'Booting Broker' ) ; broker = new Broker ( xgrl , { ... __options } ) ; BrokerCache [ xgrl ] = broker ; await broker . startup ; <mask> . timeEnd ( timer ) ; } const modulePromises = [ ] ; for ( const moduleName in modules ) { if ( modules [ moduleName ] . Source === xgrl ) { // console.log(`${moduleName} => ${xgrl}`); modulePromises . push ( new Promise ( async ( res ) => { ModCache [ moduleName ] = await broker . getModule ( { Module : moduleName , Version : modules [ moduleName ] . Version || undefined } ) ; res ( ) ; } ) ) } } await Promise . all ( modulePromises ) ; res ( ) ; } ) ) } await Promise . all ( promises ) ; return ; }