<commit_before>import ApiEndpoint from './../Api/Endpoint';

class ApiComponent {

    static extend(context) {
        if (context.props.api) {
            const apiQuery = [
                'fields',
                'page',
                'perPage',
                'sort',
                'searchFields',
                'searchQuery',
                'searchOperator',
                'fieldsDepth'
            ];

            const config = _.pick(context.props, ['httpMethod', 'url', 'body', 'defaultBody']);
            const verifiedQuery = {};
            _.each(context.props.query || {}, (v, k) => {
                if (apiQuery.indexOf(k) > -1) {
                    verifiedQuery['_' + k] = v;
                } else {
                    verifiedQuery[k] = v;
                }
            });

            config.query = verifiedQuery;

            const verifiedDefaultQuery = {};
            _.each(context.props.defaultQuery || {}, (v, k) => {
                if (apiQuery.indexOf(k) > -1) {
                    verifiedDefaultQuery['_' + k] = v;
                } else {
                    verifiedDefaultQuery[k] = v;
                }
            });

            config.defaultQuery = verifiedDefaultQuery;
            _.each(apiQuery, v => config['_' + v] = context.props[v]);

            console.log("CONFIG", config);

            // In case any of these query params are set through props, assign them to query params (we only want these for initial Endpoint setup)
            const query = ['_fields', '_page', '_perPage', '_sort', '_searchFields', '_searchQuery', '_searchOperator', '_fieldsDepth'];
            _.merge(config.query, _.pick(config, query));
            context.api = _.isFunction(context.props.api) ? context.props.api.call(context, context) : new ApiEndpoint(context.props.api, config);
        }
    }
}

export default ApiComponent;<commit_msg>Removed console.log<commit_after>import ApiEndpoint from './../Api/Endpoint';

class ApiComponent {

    static extend(context) {
        if (context.props.api) {
            const apiQuery = [
                'fields',
                'page',
                'perPage',
                'sort',
                'searchFields',
                'searchQuery',
                'searchOperator',
                'fieldsDepth'
            ];

            const config = _.pick(context.props, ['httpMethod', 'url', 'body', 'defaultBody']);
            const verifiedQuery = {};
            _.each(context.props.query || {}, (v, k) => {
                if (apiQuery.indexOf(k) > -1) {
                    verifiedQuery['_' + k] = v;
                } else {
                    verifiedQuery[k] = v;
                }
            });

            config.query = verifiedQuery;

            const verifiedDefaultQuery = {};
            _.each(context.props.defaultQuery || {}, (v, k) => {
                if (apiQuery.indexOf(k) > -1) {
                    verifiedDefaultQuery['_' + k] = v;
                } else {
                    verifiedDefaultQuery[k] = v;
                }
            });

            config.defaultQuery = verifiedDefaultQuery;
            _.each(apiQuery, v => config['_' + v] = context.props[v]);

            //console.log("CONFIG", config);

            // In case any of these query params are set through props, assign them to query params (we only want these for initial Endpoint setup)
            const query = ['_fields', '_page', '_perPage', '_sort', '_searchFields', '_searchQuery', '_searchOperator', '_fieldsDepth'];
            _.merge(config.query, _.pick(config, query));
            context.api = _.isFunction(context.props.api) ? context.props.api.call(context, context) : new ApiEndpoint(context.props.api, config);
        }
    }
}

export default ApiComponent;
{'fraction_non_alphanumeric': 0.13342105263157894, 'fraction_numerical': 0.0010526315789473684, 'mean_word_length': 1.5527199462726662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1203935', 'n_tokens_mistral': 1002, 'n_tokens_neox': 966, 'n_words': 226}