@@ -506,6 +506,9 @@ export class Application {
506506 if ( diffCrawledData . controllers . length > 0 ) {
507507 actions . push ( ( ) => this . prepareControllers ( ) ) ;
508508 }
509+ if ( diffCrawledData . entities . length > 0 ) {
510+ actions . push ( ( ) => this . prepareEntities ( ) ) ;
511+ }
509512 if ( diffCrawledData . modules . length > 0 ) {
510513 actions . push ( ( ) => this . prepareModules ( ) ) ;
511514 }
@@ -610,6 +613,9 @@ export class Application {
610613 if ( DependenciesEngine . controllers . length > 0 ) {
611614 logger . info ( `- controller : ${ DependenciesEngine . controllers . length } ` ) ;
612615 }
616+ if ( DependenciesEngine . entities . length > 0 ) {
617+ logger . info ( `- entity : ${ DependenciesEngine . entities . length } ` ) ;
618+ }
613619 if ( DependenciesEngine . directives . length > 0 ) {
614620 logger . info ( `- directive : ${ DependenciesEngine . directives . length } ` ) ;
615621 }
@@ -659,6 +665,12 @@ export class Application {
659665 } ) ;
660666 }
661667
668+ if ( DependenciesEngine . entities . length > 0 ) {
669+ actions . push ( ( ) => {
670+ return this . prepareEntities ( ) ;
671+ } ) ;
672+ }
673+
662674 if ( DependenciesEngine . injectables . length > 0 ) {
663675 actions . push ( ( ) => {
664676 return this . prepareInjectables ( ) ;
@@ -1439,6 +1451,42 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
14391451 } ) ;
14401452 }
14411453
1454+ public prepareEntities ( someEntities ?) {
1455+ logger . info ( 'Prepare entities' ) ;
1456+ Configuration . mainData . entities = someEntities
1457+ ? someEntities
1458+ : DependenciesEngine . getEntities ( ) ;
1459+
1460+ return new Promise ( ( resolve , reject ) => {
1461+ let i = 0 ;
1462+ const len = Configuration . mainData . entities . length ;
1463+ const loop = ( ) => {
1464+ if ( i < len ) {
1465+ let entity = Configuration . mainData . entities [ i ] ;
1466+ let page = {
1467+ path : 'entities' ,
1468+ name : entity . name ,
1469+ id : entity . id ,
1470+ navTabs : this . getNavTabs ( entity ) ,
1471+ context : 'entity' ,
1472+ entity : entity ,
1473+ depth : 1 ,
1474+ pageType : COMPODOC_DEFAULTS . PAGE_TYPES . INTERNAL
1475+ } ;
1476+ if ( entity . isDuplicate ) {
1477+ page . name += '-' + entity . duplicateId ;
1478+ }
1479+ Configuration . addPage ( page ) ;
1480+ i ++ ;
1481+ loop ( ) ;
1482+ } else {
1483+ resolve ( true ) ;
1484+ }
1485+ } ;
1486+ loop ( ) ;
1487+ } ) ;
1488+ }
1489+
14421490 public prepareComponents ( someComponents ?) {
14431491 logger . info ( 'Prepare components' ) ;
14441492 Configuration . mainData . components = someComponents
@@ -1747,7 +1795,7 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
17471795
17481796 return new Promise ( ( resolve , reject ) => {
17491797 /*
1750- * loop with components, directives, controllers, classes, injectables, interfaces, pipes, guards, misc functions variables
1798+ * loop with components, directives, controllers, entities, classes, injectables, interfaces, pipes, guards, misc functions variables
17511799 */
17521800 let files = [ ] ;
17531801 let totalProjectStatementDocumented = 0 ;
@@ -1764,9 +1812,9 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
17641812 }
17651813 return status ;
17661814 } ;
1767- let processComponentsAndDirectivesAndControllers = list => {
1815+ const processComponentsAndDirectivesAndControllersAndEntities = list => {
17681816 _ . forEach ( list , ( el : any ) => {
1769- let element = ( Object as any ) . assign ( { } , el ) ;
1817+ const element = ( Object as any ) . assign ( { } , el ) ;
17701818 if ( ! element . propertiesClass ) {
17711819 element . propertiesClass = [ ] ;
17721820 }
@@ -2046,9 +2094,18 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
20462094 } ) ;
20472095 } ;
20482096
2049- processComponentsAndDirectivesAndControllers ( Configuration . mainData . components ) ;
2050- processComponentsAndDirectivesAndControllers ( Configuration . mainData . directives ) ;
2051- processComponentsAndDirectivesAndControllers ( Configuration . mainData . controllers ) ;
2097+ processComponentsAndDirectivesAndControllersAndEntities (
2098+ Configuration . mainData . components
2099+ ) ;
2100+ processComponentsAndDirectivesAndControllersAndEntities (
2101+ Configuration . mainData . directives
2102+ ) ;
2103+ processComponentsAndDirectivesAndControllersAndEntities (
2104+ Configuration . mainData . controllers
2105+ ) ;
2106+ processComponentsAndDirectivesAndControllersAndEntities (
2107+ Configuration . mainData . entities
2108+ ) ;
20522109
20532110 processClasses ( Configuration . mainData . classes , 'class' , 'classe' ) ;
20542111 processClasses ( Configuration . mainData . injectables , 'injectable' , 'injectable' ) ;
0 commit comments