<commit_before>import {createAction} from 'redux-actions';
import values from 'lodash/values';
import {UnitActions} from './constants';
import {Action} from '../common/constants';
import {ApiResponse, UnitServices} from './constants';

export const fetchUnits = (/*params: Object*/): Action =>
  createAction(UnitActions.FETCH)({params: {
    service: `${values(UnitServices).join(',')}`,
    only: 'id,name,location,street_address,address_zip,extensions',
    include: 'observations,services',
    geometry: 'true',
    page_size: 1000
  }});

export const receiveUnits = (data: ApiResponse): Action =>
  createAction(UnitActions.RECEIVE)(data);

export const setFetchError = (error: ApiResponse) =>
  createAction(UnitActions.FETCH_ERROR)({error});

export const clearSearch = () =>
  createAction(UnitActions.SEARCH_CLEAR)();

export const searchUnits = (input: string, params: Object): Action => {
  const init = {
    input,
    service: `${values(UnitServices).join(',')}`
  };

  params = Object.assign({}, init, params);
  return createAction(UnitActions.SEARCH_REQUEST)({params});
};

export const fetchSearchSuggestions = (input: string): Action =>
  createAction(UnitActions.FETCH_SEARCH_SUGGESTIONS)({params: {
    input,
    service: `${values(UnitServices).join(',')}`,
    page_size: 5
  }});

export const receiveSearchResults = (results: Array<Object>) =>
  createAction(UnitActions.SEARCH_RECEIVE)(results);

export const receiveSearchSuggestions = (results: Array<Object>) =>
  createAction(UnitActions.RECEIVE_SEARCH_SUGGESTIONS)(results);
<commit_msg>Add connections to unit fetch<commit_after>import {createAction} from 'redux-actions';
import values from 'lodash/values';
import {UnitActions} from './constants';
import {Action} from '../common/constants';
import {ApiResponse, UnitServices} from './constants';

export const fetchUnits = (/*params: Object*/): Action =>
  createAction(UnitActions.FETCH)({params: {
    service: `${values(UnitServices).join(',')}`,
    only: 'id,name,location,street_address,address_zip,extensions',
    include: 'connections,observations,services',
    geometry: 'true',
    page_size: 1000
  }});

export const receiveUnits = (data: ApiResponse): Action =>
  createAction(UnitActions.RECEIVE)(data);

export const setFetchError = (error: ApiResponse) =>
  createAction(UnitActions.FETCH_ERROR)({error});

export const clearSearch = () =>
  createAction(UnitActions.SEARCH_CLEAR)();

export const searchUnits = (input: string, params: Object): Action => {
  const init = {
    input,
    service: `${values(UnitServices).join(',')}`
  };

  params = Object.assign({}, init, params);
  return createAction(UnitActions.SEARCH_REQUEST)({params});
};

export const fetchSearchSuggestions = (input: string): Action =>
  createAction(UnitActions.FETCH_SEARCH_SUGGESTIONS)({params: {
    input,
    service: `${values(UnitServices).join(',')}`,
    page_size: 5
  }});

export const receiveSearchResults = (results: Array<Object>) =>
  createAction(UnitActions.SEARCH_RECEIVE)(results);

export const receiveSearchSuggestions = (results: Array<Object>) =>
  createAction(UnitActions.RECEIVE_SEARCH_SUGGESTIONS)(results);

{'fraction_non_alphanumeric': 0.15290037831021439, 'fraction_numerical': 0.0031525851197982345, 'mean_word_length': 6.004415011037527, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '7121175', 'n_tokens_mistral': 974, 'n_tokens_neox': 956, 'n_words': 200}