function applyLogic(arrLogic, store, next, sub, actionIn$, deps, startLogicCount, monitor$) {
  if (!store || !next) {
    throw new Error('store is not defined');
  }

  if (sub) {
    sub.unsubscribe();
  }

  const wrappedLogic = arrLogic.map((logic, idx) => {
    const namedLogic = naming(logic, idx + startLogicCount);
    return wrapper(namedLogic, store, deps, monitor$);
  });
  const actionOut$ = wrappedLogic.reduce((acc$, wep) => wep(acc$), actionIn$);
  const newSub = actionOut$.subscribe((action) => {
    debug('actionEnd$', action);
    try {
      const result = next(action);
      debug('result', result);
    } catch (err) {
      // eslint-disable-next-line no-console
      console.error('error in mw dispatch or next call, probably in middlware/reducer/render fn:', err);
      monitor$.next({ action, err, op: 'nextError' });
    }
    // at this point, action is the transformed action, not original
    monitor$.next({ nextAction: action, op: 'bottom' });
  });

  return {
    action$: actionOut$,
    sub: newSub,
    logicCount: startLogicCount + arrLogic.length
  };
}
replace all existing logic with a new array of logic.
   In-flight requests should complete. Logic state will be reset.
   @param {array} arrRepLogic array of replacement logic items
   @return {object} object with a property logicCount set to the count of logic items