<commit_before>var action = {};

/////////////////////////////////////////////////////////////////////
// metadata
action.name = 'getRedisKeyValue';
action.description = 'I will return a value for given redis key';
action.inputs = {
  key: {
    required: true
  },
  index: {
    required: false
  }
};
action.blockedConnectionTypes = [];
action.outputExample = {
};

/////////////////////////////////////////////////////////////////////
// functional
action.run = function(api, data, next){
  // Check authentication for current Request
  api.ahDashboard.session.checkAuth(data, function(session){
    var key = data.params.key;
    api.redis.clients.client.type(key, function (err, type) {
      if (err) {
        api.log('Redis Type Error: ' + err, 'error');
      }
      switch (type) {
        case 'string':
          getKeyDetailsString(key, api.redis.client, data, next);
          break;
        case 'list':
          getKeyDetailsList(key, api.redis.client, data, next);
          break;
        case 'zset':
          getKeyDetailsZSet(key, api.redis.client, data, next);
          break;
        case 'hash':
          getKeyDetailsHash(key, api.redis.client, data, next);
          break;
        case 'set':
          getKeyDetailsSet(key, api.redis.client, data, next);
          break;
        default:
          var details = {
            key: key,
            type: type
          };
          data.response.details = details;
          next();
      }
    });
  }, next);
};<commit_msg>fix redis connection GET<commit_after>var action = {};

/////////////////////////////////////////////////////////////////////
// metadata
action.name = 'getRedisKeyValue';
action.description = 'I will return a value for given redis key';
action.inputs = {
  key: {
    required: true
  },
  index: {
    required: false
  }
};
action.blockedConnectionTypes = [];
action.outputExample = {
};

/////////////////////////////////////////////////////////////////////
// functional
action.run = function(api, data, next){
  // Check authentication for current Request
  api.ahDashboard.session.checkAuth(data, function(session){
    var key = data.params.key;
    api.redis.clients.client.type(key, function (err, type) {
      if (err) {
        api.log('Redis Type Error: ' + err, 'error');
      }
      switch (type) {
        case 'string':
          getKeyDetailsString(key, api.redis.clients.client, data, next);
          break;
        case 'list':
          getKeyDetailsList(key, api.redis.clients.client, data, next);
          break;
        case 'zset':
          getKeyDetailsZSet(key, api.redis.clients.client, data, next);
          break;
        case 'hash':
          getKeyDetailsHash(key, api.redis.clients.client, data, next);
          break;
        case 'set':
          getKeyDetailsSet(key, api.redis.clients.client, data, next);
          break;
        default:
          var details = {
            key: key,
            type: type
          };
          data.response.details = details;
          next();
      }
    });
  }, next);
};
{'fraction_non_alphanumeric': 0.20807554542494303, 'fraction_numerical': 0.0, 'mean_word_length': 1.6011854360711262, 'pattern_counts': {'":': 0, '<': 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': '1997433', 'n_tokens_mistral': 854, 'n_tokens_neox': 855, 'n_words': 199}