import type { SagaIterator } from 'redux-saga'; import type { LoadingMapPayload, LoadingState, LoadingItemState } from 'robodux'; export type { LoadingState, LoadingItemState }; declare type IfAny = 0 extends 1 & T ? Y : N; export interface Payload

{ payload: P; } export interface PipeCtx

extends Payload

{ name: string; key: string; action: ActionWithPayload>; actionFn: IfAny, CreateActionWithPayload, P>>; } export interface LoaderCtx

extends PipeCtx

{ loader: LoadingMapPayload> | null; } export interface ApiFetchSuccess { ok: true; data: ApiSuccess; } export interface ApiFetchError { ok: false; data: ApiError; } export declare type ApiFetchResponse = ApiFetchSuccess | ApiFetchError; export declare type ApiRequest = Partial<{ url: string; } & RequestInit>; export declare type RequiredApiRequest = { url: string; headers: HeadersInit; } & Partial; export interface FetchCtx

extends PipeCtx

{ request: ApiRequest | null; req: (r?: ApiRequest) => RequiredApiRequest; response: Response | null; bodyType: 'arrayBuffer' | 'blob' | 'formData' | 'json' | 'text'; } export interface FetchJson { json: ApiFetchResponse; } export interface FetchJsonCtx

extends FetchCtx

, FetchJson { } export interface ApiCtx extends FetchJsonCtx { actions: Action[]; loader: Omit>, 'id'> | null; cache: boolean; cacheData: any; } export declare type Middleware = (ctx: Ctx, next: Next) => any; export declare type MiddlewareCo = Middleware | Middleware[]; export declare type MiddlewareApi = (ctx: Ctx, next: Next) => any; export declare type MiddlewareApiCo = Middleware | Middleware[]; export declare type Next = () => any; export interface Action { type: string; } export interface ActionWithPayload

extends Action { payload: P; } export interface CreateActionPayload

{ name: string; key: string; options: P; } export interface InvalidateCachePayload { invalidate?: boolean; } export declare type CreateActionFn = () => ActionWithPayload>; export interface CreateAction extends CreateActionFn { run: (p: ActionWithPayload>) => SagaIterator; } export declare type CreateActionFnWithPayload

= (p: P) => ActionWithPayload>; export interface CreateActionWithPayload extends CreateActionFnWithPayload

{ run: (a: ActionWithPayload>) => SagaIterator; }