lib/delta/remote-delta.js
function(cursor, callback) {
    groupedDelta = {};

    async.series([
      (cb) => {
        logger.info('Fetching delta', {category: 'sync-remote-delta'});

        fetchDelta({cursor}, (err, newCursor) => {
          if(err) return cb(err);

          cb(null, newCursor);
        });
      },
      (cb) => {
        logger.info('Applying collections which need to be redownloaded', {category: 'sync-remote-delta'});

        syncDb.find({$and: [{directory: true}, {downloadOriginal: true}]}, (err, syncedNodes) => {
          if(err) return cb(err);
          if(!syncedNodes) return cb(null);

          async.map(syncedNodes, (syncedNode, mapCb) => {
            if(!syncedNode.remoteId) mapCb(null);

            fetchDelta({id: syncedNode.remoteId}, mapCb);
          }, cb);
        });
      }
    ], (err, results) => {
      logger.info('getDelta ended', {category: 'sync-remote-delta'});

      callback(err, results[0]);
    });
  }
function(cursor, callback) {
    groupedDelta = {};

    async.series([
      (cb) => {
        logger.info('Fetching delta', {category: 'sync-remote-delta'});

        fetchDelta({cursor}, (err, newCursor) => {
          if(err) return cb(err);

          cb(null, newCursor);
        });
      },
      (cb) => {
        logger.info('Applying collections which need to be redownloaded', {category: 'sync-remote-delta'});

        syncDb.find({$and: [{directory: true}, {downloadOriginal: true}]}, (err, syncedNodes) => {
          if(err) return cb(err);
          if(!syncedNodes) return cb(null);

          async.map(syncedNodes, (syncedNode, mapCb) => {
            if(!syncedNode.remoteId) mapCb(null);

            fetchDelta({id: syncedNode.remoteId}, mapCb);
          }, cb);
        });
      }
    ], (err, results) => {
      logger.info('getDelta ended', {category: 'sync-remote-delta'});

      callback(err, results[0]);
    });
  }
function ( cursor , callback ) { groupedDelta = { } ; async . series ( [ ( cb ) => { logger . info ( 'Fetching delta' , { category : 'sync-remote-delta' } ) ; fetchDelta ( { cursor } , ( err , newCursor ) => { if ( err ) return cb ( err ) ; cb ( null , newCursor ) ; } ) ; } , ( cb ) => { logger . info ( 'Applying collections which need to be redownloaded' , { category : 'sync-remote-delta' } ) ; syncDb . find ( { $and : [ { directory : true } , { downloadOriginal : true } ] } , ( err , syncedNodes ) => { if ( err ) return cb ( err ) ; if ( ! syncedNodes ) return cb ( null ) ; async . map ( syncedNodes , ( syncedNode , mapCb ) => { if ( ! syncedNode . remoteId ) mapCb ( null ) ; fetchDelta ( { id : syncedNode . remoteId } , mapCb ) ; } , cb ) ; } ) ; } ] , ( err , results ) => { logger . info ( 'getDelta ended' , { category : 'sync-remote-delta' } ) ; callback ( err , results [ 0 ] ) ; } ) ; }
fetches the delta from the server,

@param {string|undefined} cursor - the cursor to get the delta from
@param {Function} callback - callback function
@returns {void} - no return value
fetches the delta from the server