<commit_before>'use strict';
/**
 * Provider config
 */
var dbox = require("dbox");


var config = require('../../config/configuration.js');
var retrieveFiles = require('./helpers/retrieve.js').delta;
var uploadFile = require('./helpers/upload.js');

var dbApp = dbox.app({
  "app_key": config.dropbox_id,
  "app_secret": config.dropbox_secret,
});

 
var initAccount = function(req, next) {
  dbApp.requesttoken(function(status, requestToken) {
    if(status !== 200) {
      return next(new Error("Dropbox returned with non 200 status"));
    }

    var url = requestToken.authorize_url + "&oauth_callback=" + config.dropbox_callback;
    
    next(null, requestToken, url);

  });
};

var connectAccountRetrievePreDatasIdentifier = function(req, next) {
  if(!req.params.oauth_token) {
    return next("oAuth parameter left out of query.");
  }

  next(null, {'datas.oauth_token': req.params.oauth_token});
};

var connectAccountRetrieveAuthDatas = function(req, preDatas, next) {
  // Trade dropbox request token for access token
  dbApp.accesstoken(preDatas, function(status, dropboxAccessToken) {
    if(status !== 200) {
      return next(new Error("Bad Dropbox status: " + status));
    }

    next(null, dropboxAccessToken);
  });
};

var updateAccount = function(oauthToken, cursor, next) {
  console.log("Update Account Datas");
  // Retrieve all files since last call
  retrieveFiles(oauthToken, cursor, next);
};

var queueWorker = uploadFile;

module.exports = {
  initAccount: initAccount,
  connectAccountRetrievePreDatasIdentifier: connectAccountRetrievePreDatasIdentifier,
  connectAccountRetrieveAuthDatas: connectAccountRetrieveAuthDatas,
  updateAccount: updateAccount,
  queueWorker: queueWorker,

  cluestrAppId: config.cluestr_id,
  cluestrAppSecret: config.cluestr_secret,
  connectUrl: config.dropbox_connect,
  concurrency: config.max_concurrency
};<commit_msg>Update for logs<commit_after>'use strict';
/**
 * Provider config
 */
var dbox = require("dbox");


var config = require('../../config/configuration.js');
var retrieveFiles = require('./helpers/retrieve.js').delta;
var uploadFile = require('./helpers/upload.js');

var dbApp = dbox.app({
  "app_key": config.dropbox_id,
  "app_secret": config.dropbox_secret,
});

 
var initAccount = function(req, next) {
  dbApp.requesttoken(function(status, requestToken) {
    if(status !== 200) {
      return next(new Error("Dropbox returned with non 200 status"));
    }

    var url = requestToken.authorize_url + "&oauth_callback=" + config.dropbox_callback;
    
    next(null, requestToken, url);

  });
};

var connectAccountRetrievePreDatasIdentifier = function(req, next) {
  if(!req.params.oauth_token) {
    return next("oAuth parameter left out of query.");
  }

  next(null, {'datas.oauth_token': req.params.oauth_token});
};

var connectAccountRetrieveAuthDatas = function(req, preDatas, next) {
  // Trade dropbox request token for access token
  console.log('I add the user to the database');
  dbApp.accesstoken(preDatas, function(status, dropboxAccessToken) {
    if(status !== 200) {
      return next(new Error("Bad Dropbox status: " + status));
    }

    next(null, dropboxAccessToken);
  });
};

var updateAccount = function(oauthToken, cursor, next) {
  console.log("Update Account Datas");
  // Retrieve all files since last call
  retrieveFiles(oauthToken, cursor, next);
};

var queueWorker = uploadFile;

module.exports = {
  initAccount: initAccount,
  connectAccountRetrievePreDatasIdentifier: connectAccountRetrievePreDatasIdentifier,
  connectAccountRetrieveAuthDatas: connectAccountRetrieveAuthDatas,
  updateAccount: updateAccount,
  queueWorker: queueWorker,

  cluestrAppId: config.cluestr_id,
  cluestrAppSecret: config.cluestr_secret,
  connectUrl: config.dropbox_connect,
  concurrency: config.max_concurrency
};
{'fraction_non_alphanumeric': 0.1249020120198589, 'fraction_numerical': 0.004703423046772929, 'mean_word_length': 4.82648401826484, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2203545', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1182, 'n_words': 261}