@@ -21,7 +21,6 @@ let ipBlocklistRegex = null;
2121const MAX_DOMAIN_LABEL_LENGTH = 63 ;
2222const MAX_ENTITY_LENGTH = 100 ;
2323const MAX_PARALLEL_LOOKUPS = 10 ;
24- const PAGE_SIZE = 5 ;
2524const IGNORED_IPS = new Set ( [ '127.0.0.1' , '255.255.255.255' , '0.0.0.0' ] ) ;
2625const url = 'https://insight.hyas.com/api/ext' ;
2726const uiurl = 'https://apps.hyas.com' ;
@@ -98,7 +97,7 @@ function doLookup(entities, options, cb) {
9897
9998 tasks . push ( function ( done ) {
10099 requestWithDefaults ( requestOptions , function ( error , res , body ) {
101- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
100+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
102101 let processedResult = handleRestError ( error , entity , res , body ) ;
103102
104103 if ( processedResult . error ) {
@@ -136,7 +135,7 @@ function doLookup(entities, options, cb) {
136135
137136 tasks . push ( function ( done ) {
138137 requestWithDefaults ( requestOptions , function ( error , res , body ) {
139- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
138+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
140139 let processedResult = handleRestError ( error , entity , res , body ) ;
141140
142141 if ( processedResult . error ) {
@@ -173,7 +172,7 @@ function doLookup(entities, options, cb) {
173172
174173 tasks . push ( function ( done ) {
175174 requestWithDefaults ( requestOptions , function ( error , res , body ) {
176- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
175+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
177176 let processedResult = handleRestError ( error , entity , res , body ) ;
178177 if ( processedResult . error ) {
179178 done ( processedResult ) ;
@@ -211,7 +210,7 @@ function doLookup(entities, options, cb) {
211210
212211 tasks . push ( function ( done ) {
213212 requestWithDefaults ( requestOptions , function ( error , res , body ) {
214- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
213+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
215214 let processedResult = handleRestError ( error , entity , res , body ) ;
216215 if ( processedResult . error ) {
217216 done ( processedResult ) ;
@@ -247,7 +246,7 @@ function doLookup(entities, options, cb) {
247246
248247 tasks . push ( function ( done ) {
249248 requestWithDefaults ( requestOptions , function ( error , res , body ) {
250- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
249+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
251250 let processedResult = handleRestError ( error , entity , res , body ) ;
252251 if ( processedResult . error ) {
253252 done ( processedResult ) ;
@@ -322,7 +321,7 @@ function doLookup(entities, options, cb) {
322321 details : {
323322 result : resultWithFormatedPhoneNumber ,
324323 link : result . link ,
325- pageSize : PAGE_SIZE
324+ pageSize : options . maxResults
326325 }
327326 }
328327 } ) ;
@@ -407,7 +406,7 @@ function doDeviceGeoIpLookup(entity, options) {
407406 } ;
408407
409408 requestWithDefaults ( requestOptions , ( error , response , body ) => {
410- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
409+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
411410 let processedResult = handleRestError ( error , entity , response , body ) ;
412411 if ( processedResult . error ) return done ( processedResult ) ;
413412 done ( null , processedResult . body ) ;
@@ -432,13 +431,13 @@ function doDomainPassiveLookup(entity, options) {
432431 applied_filters : {
433432 domain : entity . value
434433 } ,
435- paging : { order : 'desc' , sort : 'datetime' , page_number : 0 , page_size : 10 }
434+ paging : { order : 'desc' , sort : 'datetime' , page_number : 0 , page_size : options . maxResults }
436435 } ,
437436 json : true
438437 } ;
439438
440439 requestWithDefaults ( requestOptions , ( error , response , body ) => {
441- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
440+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
442441 let processedResult = handleRestError ( error , entity , response , body ) ;
443442 if ( processedResult . error ) return done ( processedResult ) ;
444443 done ( null , processedResult . body ) ;
@@ -468,7 +467,7 @@ function doIpSampleLookup(entity, options) {
468467 } ;
469468
470469 requestWithDefaults ( requestOptions , ( error , response , body ) => {
471- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
470+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
472471 let processedResult = handleRestError ( error , entity , response , body ) ;
473472 if ( processedResult . error ) return done ( processedResult ) ;
474473 done ( null , processedResult . body ) ;
@@ -498,7 +497,7 @@ function doDomainSampleLookup(entity, options) {
498497 } ;
499498
500499 requestWithDefaults ( requestOptions , ( error , response , body ) => {
501- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
500+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
502501 let processedResult = handleRestError ( error , entity , response , body ) ;
503502 if ( processedResult . error ) return done ( processedResult ) ;
504503 done ( null , processedResult . body ) ;
@@ -528,7 +527,7 @@ function doDomainSSlLookup(entity, options) {
528527 } ;
529528
530529 requestWithDefaults ( requestOptions , ( error , response , body ) => {
531- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
530+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
532531 let processedResult = handleRestError ( error , entity , response , body ) ;
533532 if ( processedResult . error ) return done ( processedResult ) ;
534533 done ( null , processedResult . body ) ;
@@ -558,7 +557,7 @@ function doDynamicDNSLookup(entity, options) {
558557 } ;
559558
560559 requestWithDefaults ( requestOptions , ( error , response , body ) => {
561- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
560+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
562561 let processedResult = handleRestError ( error , entity , response , body ) ;
563562 if ( processedResult . error ) return done ( processedResult ) ;
564563 done ( null , processedResult . body ) ;
@@ -593,7 +592,7 @@ function doDeviceGeoLookup(entity, options) {
593592 Logger . trace ( { options : requestOptions } , 'Request URI' ) ;
594593
595594 requestWithDefaults ( requestOptions , ( error , response , body ) => {
596- body = body && _ . isArray ( body ) && body . splice ( 0 , PAGE_SIZE ) ;
595+ body = body && _ . isArray ( body ) && body . splice ( 0 , options . maxResults ) ;
597596 let processedResult = handleRestError ( error , entity , response , body ) ;
598597 if ( processedResult . error ) return done ( processedResult ) ;
599598
0 commit comments