@ -18,17 +18,19 @@ require(path.join(process.cwd(),"..","server","dist","database.js")); 
			
		
	
		
		
			
				
					
					    } ) ;      } ) ;   
			
		
	
		
		
			
				
					
					    if  ( workflows . length  ==  0 )  throw  "There is not any workflow" ;      if  ( workflows . length  ==  0 )  throw  "There is not any workflow" ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    const  allWorkf lowInfo  =  { } ;      const  allWorkF lowInfo  =  { } ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    workflowsFor :      workflowsFor :   
			
		
	
		
		
			
				
					
					    for  await  ( const  workflow  of  workflows )  {      for  await  ( const  workflow  of  workflows )  {   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        if  ( + workflow . id  <  0 )  continue ;          if  ( + workflow . id  <  0 )  continue ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        const  processes  =  await  getAllProcesses ( workflow ) ;          const  processes  =  await  getAllProcesses ( workflow ,  {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					            subFlowId :  null ,   
			
		
	
		
		
			
				
					
					        } ) ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        if  ( processes . length  ==  0 )  {          if  ( processes . length  ==  0 )  {   
			
		
	
		
		
			
				
					
					            allWorkf lowInfo [ workflow . id ]  =  {              allWorkF lowInfo [ workflow . id ]  =  {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                isValid :  false ,                  isValid :  false ,   
			
		
	
		
		
			
				
					
					                root :  {                  root :  {   
			
		
	
		
		
			
				
					
					                    valid :  0 ,                      valid :  0 ,   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -42,6 +44,7 @@ require(path.join(process.cwd(),"..","server","dist","database.js")); 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        const  {  allPaths :  tree ,  subFlowParentIds ,  invalidPathsWithoutEnding  }  =  await  getProcessPaths ( processes ,  workflow ) ;          const  {  allPaths :  tree ,  subFlowParentIds ,  invalidPathsWithoutEnding  }  =  await  getProcessPaths ( processes ,  workflow ) ;   
			
		
	
		
		
			
				
					
					        allWorkFlowInfo [ workflow . id ]  =  {          allWorkFlowInfo [ workflow . id ]  =  {   
			
		
	
		
		
			
				
					
					            isValid :  invalidPathsWithoutEnding . length  ==  0  ?  true  :  false ,   
			
		
	
		
		
			
				
					
					            root :  {              root :  {   
			
		
	
		
		
			
				
					
					                validPaths :  tree ,                  validPaths :  tree ,   
			
		
	
		
		
			
				
					
					                invalidPaths :  invalidPathsWithoutEnding ,                  invalidPaths :  invalidPathsWithoutEnding ,   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -52,6 +55,36 @@ require(path.join(process.cwd(),"..","server","dist","database.js")); 
			
		
	
		
		
			
				
					
					            subFlow :  { }              subFlow :  { }   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        const  subFlowInfo  =  { }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        subFlowFor :   
			
		
	
		
		
			
				
					
					        for  await  ( const  subFlowId  of  subFlowParentIds )  {   
			
		
	
		
		
			
				
					
					            const  processesSubFlow  =  await  getAllProcesses ( workflow ,  {   
			
		
	
		
		
			
				
					
					                [ Op . or ] :  [   
			
		
	
		
		
			
				
					
					                    {   
			
		
	
		
		
			
				
					
					                        subFlowId :  subFlowId ,   
			
		
	
		
		
			
				
					
					                    } ,   
			
		
	
		
		
			
				
					
					                    {   
			
		
	
		
		
			
				
					
					                        subFlowPid :  subFlowId   
			
		
	
		
		
			
				
					
					                    }   
			
		
	
		
		
			
				
					
					                ]   
			
		
	
		
		
			
				
					
					            } )   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					            if  ( processesSubFlow . length  ==  0 )  {   
			
		
	
		
		
			
				
					
					                allWorkFlowInfo [ workflow . id ] . isValid  =  false ;   
			
		
	
		
		
			
				
					
					                subFlowInfo [ subFlowId ]  =  {   
			
		
	
		
		
			
				
					
					                    valid :  subTreePath . length ,   
			
		
	
		
		
			
				
					
					                    invalid :  invalidSubPathsWithoutEnding . length ,   
			
		
	
		
		
			
				
					
					                    validSubTreePath : subTreePath ,   
			
		
	
		
		
			
				
					
					                    invalidSubTreePath :  invalidSubPathsWithoutEnding   
			
		
	
		
		
			
				
					
					                }   
			
		
	
		
		
			
				
					
					                continue  subFlowFor ;   
			
		
	
		
		
			
				
					
					            }   
			
		
	
		
		
			
				
					
					        }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        allWorkFlowInfo [ workflow . id ] [ "subFlow" ]  =  subFlowInfo ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        console . log ( "allWorkFlowInfo" , JSON . stringify ( allWorkFlowInfo , null , 2 ) ) ;   
			
		
	
		
		
			
				
					
					    }      }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    console . timeEnd ( "WorkflowTester" )      console . timeEnd ( "WorkflowTester" )