<commit_before>'use strict'

let Authenticator = require('./authenticator')
let AccessRules = require('./access-rules')

let application = {}

application.run = (action) => {
  let identity = Authenticator.getIdentify(action)
  let model = action.loadModel()
  AccessRules.checkAccess(identity, action)
  action
    .filterInput()
    .execute(identity, model)
    .filterOutput()
    .send()
}

module.exports = application<commit_msg>Application now has handler that returns a new function<commit_after>'use strict'

let Authenticator = require('./authenticator')
let AccessRules = require('./access-rules')

let application = {}

application.handler = (action) => {
  if (!action) {
    throw new Error('Invalid action as input')
  }
  return (event, context) => {
    action.event = event
    action.context = context
    return application.run(action)
  }
}

application.run = (action) => {
  let identity = Authenticator.getIdentity(action)
  let model = action.loadModel()
  AccessRules.checkAccess(identity, action)
  return action
    .filterInput()
    .execute(identity, model)
    .filterOutput()
    .send()
}

module.exports = application
{'fraction_non_alphanumeric': 0.12760416666666666, 'fraction_numerical': 0.0, 'mean_word_length': 4.034934497816594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4509578', 'n_tokens_mistral': 333, 'n_tokens_neox': 330, 'n_words': 83}