nl_tokens: / * function that manage the call to the constraintsToQuery function . This part is listening on three event returned by the constraintsToQuery event : docsFound noDocsFound and errorOnConstraints
pl_tokens: function constraintsCall ( constraints , connectType ) { let emitterCall = new EventEmitter ( ) ; // if docs found in couchDB database constraintsToQuery ( constraints ) . on ( 'docsFound' , ( docsResults ) => { logger_1 . logger . log ( 'info' , ` ${ docsResults . docs . length } ${ connectType } ` ) ; logger_1 . logger . log ( 'debug' , ` \n ${ JSON . stringify ( docsResults ) } ` ) ; logger_1 . logger . <mask> ( 'debug' , ` ${ JSON . stringify ( constraints ) } ` ) ; emitterCall . emit ( ` ${ connectType } ` , docsResults . docs ) ; } ) // if docs not found in couchDB database . on ( 'noDocsFound' , ( docsResults ) => { logger_1 . logger . log ( 'info' , ` ` ) ; logger_1 . logger . log ( 'debug' , ` \n ${ JSON . stringify ( constraints ) } ` ) ; emitterCall . emit ( ` ${ connectType } ` , docsResults . docs ) ; } ) // if an error occured . on ( 'errorOnConstraints' , ( err ) => { logger_1 . logger . log ( 'warn' , ` ` ) ; emitterCall . emit ( ` ${ connectType } ` , err ) ; } ) ; return emitterCall ; }