sdk/src/sync/pull.js
function updateQueryForNextPage(pulledRecords) {
        return Platform.async(function(callback) {
            callback();
        })().then(function() {

            if (!pulledRecords) {
                throw new Error('Something is wrong. pulledRecords cannot be null at this point');
            }

            var lastRecord = pulledRecords[ pulledRecords.length - 1];

            if (!lastRecord) {
                throw new Error('Something is wrong. Possibly invalid response from the server. lastRecord cannot be null!');
            }

            var lastRecordTime = lastRecord[tableConstants.sysProps.updatedAtColumnName];

            if (!_.isDate(lastRecordTime)) {
                throw new Error('Property ' + tableConstants.sysProps.updatedAtColumnName + ' of the last record should be a valid date');
            }

            if (lastRecordTime.getTime() === lastKnownUpdatedAt.getTime()) {
                pagePullQuery.skip(pagePullQuery.getComponents().skip + pulledRecords.length);
            } else {
                buildQueryFromLastKnownUpdateAt(lastRecordTime);
            }
        });
    }
function updateQueryForNextPage(pulledRecords) {
        return Platform.async(function(callback) {
            callback();
        })().then(function() {

            if (!pulledRecords) {
                throw new Error('Something is wrong. pulledRecords cannot be null at this point');
            }

            var lastRecord = pulledRecords[ pulledRecords.length - 1];

            if (!lastRecord) {
                throw new Error('Something is wrong. Possibly invalid response from the server. lastRecord cannot be null!');
            }

            var lastRecordTime = lastRecord[tableConstants.sysProps.updatedAtColumnName];

            if (!_.isDate(lastRecordTime)) {
                throw new Error('Property ' + tableConstants.sysProps.updatedAtColumnName + ' of the last record should be a valid date');
            }

            if (lastRecordTime.getTime() === lastKnownUpdatedAt.getTime()) {
                pagePullQuery.skip(pagePullQuery.getComponents().skip + pulledRecords.length);
            } else {
                buildQueryFromLastKnownUpdateAt(lastRecordTime);
            }
        });
    }
function updateQueryForNextPage ( pulledRecords ) { return Platform . async ( function ( callback ) { callback ( ) ; } ) ( ) . then ( function ( ) { if ( ! pulledRecords ) { throw new Error ( 'Something is wrong. pulledRecords cannot be null at this point' ) ; } var lastRecord = pulledRecords [ pulledRecords . length - 1 ] ; if ( ! lastRecord ) { throw new Error ( 'Something is wrong. Possibly invalid response from the server. lastRecord cannot be null!' ) ; } var lastRecordTime = lastRecord [ tableConstants . sysProps . updatedAtColumnName ] ; if ( ! _ . isDate ( lastRecordTime ) ) { throw new Error ( 'Property ' + tableConstants . sysProps . updatedAtColumnName + ' of the last record should be a valid date' ) ; } if ( lastRecordTime . getTime ( ) === lastKnownUpdatedAt . getTime ( ) ) { pagePullQuery . skip ( pagePullQuery . getComponents ( ) . skip + pulledRecords . length ) ; } else { buildQueryFromLastKnownUpdateAt ( lastRecordTime ) ; } } ) ; }
update the query to pull the next page
update the query to pull the next page