import type { SagaIterator } from 'redux-saga'; import type { Middleware, MiddlewareCo, CreateAction, CreateActionWithPayload, PipeCtx, Payload } from './types'; export interface SagaApi { saga: () => (...options: any[]) => SagaIterator; use: (fn: Middleware) => void; routes: () => Middleware; /** * Name only */ create(name: string): CreateAction; create

(name: string): CreateActionWithPayload & Payload

, P>; /** * Name and options */ create(name: string, req: { saga?: any; }): CreateAction; create

(name: string, req: { saga?: any; }): CreateActionWithPayload & Payload

, P>; /** * Name and middleware */ create(name: string, fn: MiddlewareCo): CreateAction; create(name: string, fn: MiddlewareCo): CreateAction; create

(name: string, fn: MiddlewareCo & Payload

>): CreateActionWithPayload & Payload

, P>; create(name: string, fn: MiddlewareCo): CreateActionWithPayload; create(name: string, req: { saga?: any; }, fn: MiddlewareCo): CreateAction; create(name: string, req: { saga?: any; }, fn: MiddlewareCo): CreateAction; create

(name: string, req: { saga?: any; }, fn: MiddlewareCo & Payload

>): CreateActionWithPayload & Payload

, P>; create(name: string, req: { saga?: any; }, fn: MiddlewareCo): CreateActionWithPayload; } export declare const defaultOnError: (err: Error) => never; /** * Creates a middleware pipeline. * * @remarks * This middleware pipeline is almost exactly like koa's middleware system. * See {@link https://koajs.com} * * @example * ```ts * import { createPipe } from 'saga-query'; * * const thunk = createPipe(); * thunk.use(function* (ctx, next) { * console.log('beginning'); * yield next(); * console.log('end'); * }); * thunks.use(thunks.routes()); * * const doit = thunk.create('do-something', function*(ctx, next) { * console.log('middle'); * yield next(); * console.log('middle end'); * }); * * // ... * * store.dispatch(doit()); * // beginning * // middle * // middle end * // end * ``` */ export declare function createPipe>({ saga, onError, }?: { saga?: (...args: any[]) => any; onError?: (err: Error) => any; }): SagaApi;