1+ import { check } from 'meteor/check' ;
12import { Meteor } from 'meteor/meteor' ;
23import ElasticSearch from 'elasticsearch' ;
34
45Meteor . methods ( {
56 getElasticSearchData ( proxyData , filterParameters ) {
7+ // Make sure proxyData is an Object TODO: is there a schema for it?
8+ check ( proxyData , Object ) ;
9+
10+ // Make sure filterParameters is an Object TODO: is there a schema for it?
11+ check ( filterParameters , Object ) ;
12+
613 let params ;
714
815 // Constructs the Elastic Search query object
@@ -25,13 +32,19 @@ Meteor.methods({
2532
2633 // Makes the HTTP request
2734 // Get Elastic Search data and return
28- return esClient . search ( params ) . then ( ( res ) => res , ( err ) => {
35+ return esClient . search ( params ) . then ( ( res ) => { return res ; } , ( err ) => {
2936 // Throw an error
3037 throw new Meteor . Error ( err . message ) ;
3138 } ) ;
3239 } ,
3340 // Constructs the Elastic Search query object for apiUmbrella
3441 getElasticQueryUmbrella ( frontendPrefix , filterParameters ) {
42+ // Make sure frontendPrefix is a String
43+ check ( frontendPrefix , String ) ;
44+
45+ // Make sure filterParameters is an Object TODO: is there a schema for it?
46+ check ( filterParameters , Object ) ;
47+
3548 // Construct parameters for Elastic Search
3649 // TODO: For case "Proxy Admin API" with prefix /api-umbrella/
3750 // TODO: Values aggregation associated with granularity
0 commit comments