function invoke(dataset_id, params, callback) {
  debug('invoke');

  if (arguments.length < 3) throw new Error('invoke requires 3 arguments');

  // Verify that fn param has been passed
  if (!params || !params.fn) {
    var err = new Error('no fn parameter provided in params "' + util.inspect(params) + '"');
    debugError('[%s] warn %s %j', dataset_id, err, params);
    return callback(err, null);
  }

  var fn = params.fn;

  // Verify that fn param is valid
  if (invokeFunctions.indexOf(fn) < 0) {
    return callback(new Error('invalid fn parameter provided in params "' + fn + '"'), null);
  }

  // We can only continue if sync has connected to its dependencies i.e. mongo & redis
  if (!syncConnected) {
    return callback(new Error('Sync not connected'));
  }

  var fnHandler =  module.exports[fn] || server[fn] || server.api[fn];

  server.api.start(function() {
    return fnHandler(dataset_id, params, callback);
  });
}
function invoke(dataset_id, params, callback) {
  debug('invoke');

  if (arguments.length < 3) throw new Error('invoke requires 3 arguments');

  
  if (!params || !params.fn) {
    var err = new Error('no fn parameter provided in params "' + util.inspect(params) + '"');
    debugError('[%s] warn %s %j', dataset_id, err, params);
    return callback(err, null);
  }

  var fn = params.fn;

  
  if (invokeFunctions.indexOf(fn) < 0) {
    return callback(new Error('invalid fn parameter provided in params "' + fn + '"'), null);
  }

  
  if (!syncConnected) {
    return callback(new Error('Sync not connected'));
  }

  var fnHandler =  module.exports[fn] || server[fn] || server.api[fn];

  server.api.start(function() {
    return fnHandler(dataset_id, params, callback);
  });
}
function invoke ( dataset_id , params , callback ) { debug ( 'invoke' ) ; if ( arguments . length < 3 ) throw new Error ( 'invoke requires 3 arguments' ) ; // Verify that fn param has been passed if ( ! params || ! params . fn ) { var err = new Error ( 'no fn parameter provided in params "' + util . inspect ( params ) + '"' ) ; debugError ( '[%s] warn %s %j' , dataset_id , err , params ) ; return callback ( err , null ) ; } var fn = params . fn ; // Verify that fn param is valid if ( invokeFunctions . indexOf ( fn ) < 0 ) { return callback ( new Error ( 'invalid fn parameter provided in params "' + fn + '"' ) , null ) ; } // We can only continue if sync has connected to its dependencies i.e. mongo & redis if ( ! syncConnected ) { return callback ( new Error ( 'Sync not connected' ) ) ; } var fnHandler = module . exports [ fn ] || server [ fn ] || server . api [ fn ] ; server . api . start ( function ( ) { return fnHandler ( dataset_id , params , callback ) ; } ) ; }
Invoke the Sync Server.
Invoke the Sync Server .