import { Subject } from 'rxjs'; import { ActionStream } from './types/helpers'; import type { Routine, RoutineFunc } from './internal/types'; import { UnknownActionCreator, UnknownActionCreatorWithPayload } from './internal'; export type { Routine } from './internal/types'; /** * See collectRoutines for documentation */ export declare const routine: RoutineFunc; /** * Collect multiple routines to one * * A routine is simply a stream operator that will recieve actions, and is * supposed to perform side effects. This function uses the composite pattern, * so multiple routines can be collected into one routine. * * Routines are subscribed by passing them to a `subscribeRoutine` call. * * @see subscribeRoutine * @param routines The routines to collect * @returns A routine that calls the provided routines */ export declare const collectRoutines: (...routines: Routine[]) => Routine; /** * Subscribe a routine to an action stream * * Errors will not cause the routine to be unsubscribed from the action stream. * We assume all errors stem from faulty action objects, so we allow ourselves * to continue the routine on errors. It is therefore important that the action * stream is "hot", so the same action object is not re-emitted right away to * the routine. * * If a routine throws an error, it will be nexted on the error subject. If the * error subject is not explicitly set, it will default to * `defaultErrorSubject`, which will rethrow the errors globally, as uncaught * exceptions. * * **NB**: Routines should not accidentally dispatch actions to the action$ * when they are subscribed. If a routine dispatches an action when it is * subscribed, only some of the routines will receive the action. * * @param action$ The action stream to subscribe the routine to * @param routineToSubscribe The routine to subscribe * @param errorSubject An optional Subject that will receive errors form the * routine * @returns A Subscription object * @see defaultErrorSubject */ export declare const subscribeRoutine: (action$: ActionStream, routineToSubscribe: Routine, errorSubject?: Subject) => import("rxjs").Subscription; type PlainOrArray = T | T[]; export declare const ensureArray: (a: PlainOrArray) => T[]; type TapRoutine = { (actionCreator: PlainOrArray>, body: (payload: Payload) => void): Routine; (actionCreator: PlainOrArray, body: () => void): Routine; }; export declare const tapRoutine: TapRoutine;