title: How to reduce boilerplate
body: <p>I have store structure like this</p>
  
  <pre><code>/store
    /entities
      users.js
      sessions.js
  </code></pre>
  
  <p>All of my entities looks like this</p>
  
  <pre><code>import { FORM_ERROR } from 'react-final-form';
  import { normalize, schema } from 'normalizr';
  
  import { SCHEMA as USER_SHEMA } from './users';
  
  export const SCHEMA = new schema.Entity(
    'sessions',
    { user: USER_SHEMA },
    { idAttribute: 'sessionGuid' },
  );
  
  export const CREATE_SESSION_REQUEST = 'CREATE_SESSION_REQUEST';
  export const CREATE_SESSION_SUCCESS = 'CREATE_SESSION_SUCCESS';
  export const CREATE_SESSION_FAILURE = 'CREATE_SESSION_FAILURE';
  
  export const create = session =&gt; async (dispatch, getState, api) =&gt; {
    dispatch({ type: CREATE_SESSION_REQUEST });
    try {
      const { data } = await api.post('/sessions', session);
      const payload = normalize(data, SCHEMA);
  
      dispatch({ type: CREATE_SESSION_SUCCESS, payload });
    } catch (error) {
      dispatch({ type: CREATE_SESSION_FAILURE, payload: error, error: true });
  
      return { [FORM_ERROR]: error };
    }
    return null;
  };
  
  export const FETCH_ALL_SESSIONS_REQUEST = 'FETCH_ALL_SESSIONS_REQUEST';
  export const FETCH_ALL_SESSIONS_SUCCESS = 'FETCH_ALL_SESSIONS_SUCCESS';
  export const FETCH_ALL_SESSIONS_FAILURE = 'FETCH_ALL_SESSIONS_FAILURE';
  
  export const fetchAll = params =&gt; async (dispatch, getState, api) =&gt; {
    dispatch({ type: FETCH_ALL_SESSIONS_REQUEST });
    try {
      const { data } = await api.get('/sessions', { params });
      const payload = normalize(data, [SCHEMA]);
  
      dispatch({ type: CREATE_SESSION_SUCCESS, payload });
    } catch (error) {
      dispatch({ type: FETCH_ALL_SESSIONS_FAILURE, payload: error, error: true });
    }
  };
  
  export const GET_ONE_SESSION_REQUEST = 'GET_ONE_SESSION_REQUEST';
  export const GET_ONE_SESSION_SUCCESS = 'GET_ONE_SESSION_SUCCESS';
  export const GET_ONE_SESSION_FAILURE = 'GET_ONE_SESSION_FAILURE';
  
  export const fetchOne = sessionId =&gt; async (dispatch, getState, api) =&gt; {
    dispatch({ type: GET_ONE_SESSION_REQUEST });
    try {
      const { data } = await api.get(`/sessions/${sessionId}`);
      const payload = normalize(data, SCHEMA);
  
      dispatch({ type: GET_ONE_SESSION_SUCCESS, payload });
    } catch (error) {
      dispatch({ type: GET_ONE_SESSION_FAILURE, payload: error, error: true });
    }
  };
  
  export const UPDATE_SESSION_REQUEST = 'UPDATE_SESSION_REQUEST';
  export const UPDATE_SESSION_SUCCESS = 'UPDATE_SESSION_SUCCESS';
  export const UPDATE_SESSION_FAILURE = 'UPDATE_SESSION_FAILURE';
  
  export const update = (sessionId, session) =&gt; async (dispatch, getState, api) =&gt; {
    dispatch({ type: UPDATE_SESSION_REQUEST, meta: { id: sessionId } });
    try {
      await api.put(`/sessions/${sessionId}`, session);
  
      dispatch({ type: UPDATE_SESSION_SUCCESS, meta: { id: sessionId } });
    } catch (error) {
      dispatch({
        type: UPDATE_SESSION_FAILURE,
        error: true,
        payload: error,
        meta: { id: sessionId },
      });
  
      return { [FORM_ERROR]: error };
    }
    return null;
  };
  
  export const DESTROY_SESSION_REQUEST = 'DESTROY_SESSION_REQUEST';
  export const DESTROY_SESSION_SUCCESS = 'DESTROY_SESSION_SUCCESS';
  export const DESTROY_SESSION_FAILURE = 'DESTROY_SESSION_FAILURE';
  
  export const destroy = sessionId =&gt; async (dispatch, getState, api) =&gt; {
    dispatch({ type: DESTROY_SESSION_REQUEST, meta: { id: sessionId } });
    try {
      await api.delete(`/sessions/${sessionId}`);
  
      dispatch({ type: DESTROY_SESSION_SUCCESS, meta: { id: sessionId } });
    } catch (error) {
      dispatch({
        type: DESTROY_SESSION_FAILURE,
        error: true,
        payload: error,
        meta: { id: sessionId },
      });
    }
  };
  </code></pre>
  
  <p>I wanna use <code>import * as ns from './ns'</code> syntaxys in my components, so i export my actionTypes <a href="https://github.com/erikras/ducks-modular-redux" rel="nofollow noreferrer">like as constants</a>. In <code>users.js</code> the same code, but all the all words <code>session</code> are replaced with <code>users</code>. My project now has 12 entities, and when I replaced all the keywords in the 13th file, I remembered the DRY principle. But I did not find the right way to reduce the template code in such a way that would not change the imports.</p>
  
  <pre><code>import * as sessionsActions from 'store/modules/entities/sessions';
  </code></pre>
  
  <p>How to minimize the boilerplate by saving the current code?</p>