function processQuery(query, slugParam, locals) {
    const api = require('../proxy').api;

    query = _.cloneDeep(query);

    _.defaultsDeep(query, queryDefaults);

    // Replace any slugs, see TaxonomyRouter. We replace any '%s' by the slug
    _.each(query.options, function (option, name) {
        query.options[name] = _.isString(option) ? option.replace(/%s/g, slugParam) : option;
    });

    query.options.context = {member: locals.member};

    return (api[query.controller] || api[query.resource])[query.type](query.options);
}
Process query request.

Takes a 'query' object, ensures that type, resource and options are set
Replaces occurrences of `%s` in options with slugParam
Converts the query config to a promise for the result

@param {Object} query
@param {String} slugParam
@returns {Promise}