<commit_before>var P = require('bluebird');

var feature = require('../lib/feature-flags.js');
var PackageAgent = require('../agents/package');
<<<<<<< HEAD
var DownloadAgent = require('../agents/download');
=======
var ExplicitInstalls = require("npm-explicit-installs")
>>>>>>> update to async/up-to-date version of npm-explicit-installs

var MINUTE = 60; // seconds
var MODIFIED_TTL = 1 * MINUTE;
var DEPENDENTS_TTL = 30 * MINUTE;

module.exports = function(request, reply) {
  var Package = new PackageAgent(request.loggedInUser);
  var Download = new DownloadAgent();
  var context = {};
  var actions = {};

  actions.modified = Package.list({
    sort: "modified",
    count: 12
  }, MODIFIED_TTL);
  actions.dependents = Package.list({
    sort: "dependents",
    count: 12
  }, DEPENDENTS_TTL);
  actions.explicit = ExplicitInstalls();

  if (!feature('npmo')) {
    actions.downloads = Download.getAll();
    actions.totalPackages = Package.count().catch(function(err) {<commit_msg>fix merge conflict<commit_after>var P = require('bluebird');

var feature = require('../lib/feature-flags.js');
var PackageAgent = require('../agents/package');
var DownloadAgent = require('../agents/download');
var ExplicitInstalls = require("npm-explicit-installs")

var MINUTE = 60; // seconds
var MODIFIED_TTL = 1 * MINUTE;
var DEPENDENTS_TTL = 30 * MINUTE;

module.exports = function(request, reply) {
  var Package = new PackageAgent(request.loggedInUser);
  var Download = new DownloadAgent();
  var context = {};
  var actions = {};

  actions.modified = Package.list({
    sort: "modified",
    count: 12
  }, MODIFIED_TTL);
  actions.dependents = Package.list({
    sort: "dependents",
    count: 12
  }, DEPENDENTS_TTL);
  actions.explicit = ExplicitInstalls();

  if (!feature('npmo')) {
    actions.downloads = Download.getAll();
    actions.totalPackages = Package.count().catch(function(err) {
{'fraction_non_alphanumeric': 0.15894736842105264, 'fraction_numerical': 0.009473684210526316, 'mean_word_length': 4.310055865921788, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '311572', 'n_tokens_mistral': 629, 'n_tokens_neox': 595, 'n_words': 137}