import { createStore } from 'effector'; import { Effect } from 'effector'; import { Event as Event_2 } from 'effector'; import { EventCallable } from 'effector'; import { EventPayload } from 'effector'; import { Json } from 'effector'; import { Store } from 'effector'; import { StoreWritable } from 'effector'; import { Subscription } from 'effector'; declare const ABORT = "ABORT"; export declare interface AbortError extends FarfetchedError { } export declare function abortError(): AbortError; declare type ApiRequestError = ConfigurationError | TimeoutError | PreparationError | NetworkError | HttpError; /** * Applies the Barrier to the Query or Mutation. After operation start it checks the Barrier .$active status and postpones the execution if the Barrier is active. After the Barrier is deactivated, it resumes the execution of the operation. * * @param operation Query or Mutation to apply Barrier to * @param config.barrier Barrier to apply */ export declare function applyBarrier(operation: RemoteOperation, { barrier }: { barrier: Barrier; }): void; /** * Applies the Barrier to the Query or Mutation. After operation start it checks the Barrier .$active status and postpones the execution if the Barrier is active. After the Barrier is deactivated, it resumes the execution of the operation. * * @param operations Query or Mutation to apply Barrier to * @param config.barrier Barrier to apply */ export declare function applyBarrier(operations: RemoteOperation[], { barrier }: { barrier: Barrier; }): void; export declare function attachObservability({ adapter, options, events, }: { adapter: CacheAdapterInstance; options?: CacheAdapterOptions['observability']; events?: { itemExpired?: Event_2<{ key: string; value: unknown; }>; itemEvicted?: Event_2<{ key: string; }>; }; }): void; export declare type Barrier = { /** * Is Barrier active? */ $active: Store; /** * Event that triggers every time when Barrier is activated or active Barrier is touched */ activated: Event_2; /** * Event that triggers every time when Barrier is deactivated or inactive Barrier is touched */ deactivated: Event_2; /** * Event that triggers every time when all Barrier's performers are finished */ performed: Event_2; /** * Event that can be called to forcely deactivate Barrier */ forceDeactivate: EventCallable; /** * Semi-private properties, you have to avoid using them */ __: { /** * Call this event every time when operation with applied Barrier tries to start */ touch: EventCallable; /** * Call this event every time when operation with applied Barrier fails */ operationFailed: EventCallable<{ params: unknown; error: unknown; }>; /** * Call this event every time when operation with applied Barrier succeeds */ operationDone: EventCallable<{ params: unknown; result: unknown; }>; /** * Barrier ia based on Mutex, this store provides direct access to it */ $mutex: Store; }; }; declare interface BaseJsonMutationConfigNoParams extends SharedMutationFactoryConfig { request: RequestConfig_2; } declare interface BaseJsonMutationConfigWithParams extends SharedMutationFactoryConfig { params: ParamsDeclaration; request: RequestConfig_2; } declare interface BaseJsonQueryConfigNoParams extends SharedQueryFactoryConfig { request: RequestConfig; } declare interface BaseJsonQueryConfigWithParams extends SharedQueryFactoryConfig { params: ParamsDeclaration; request: RequestConfig; } export declare function cache>(query: Q, rawParams?: CacheParameters): void; export declare interface CacheAdapter extends CacheAdapterInstance { __: { $instance: StoreWritable; }; } declare interface CacheAdapterInstance { get: Effect<{ key: string; }, { value: unknown; cachedAt: number; } | null>; set: Effect<{ key: string; value: unknown; }, void>; purge: EventCallable; unset: Effect<{ key: string; }, void>; } export declare interface CacheAdapterOptions { maxEntries?: number; maxAge?: Time; observability?: { hit?: EventCallable<{ key: string; }>; miss?: EventCallable<{ key: string; }>; expired?: EventCallable<{ key: string; }>; evicted?: EventCallable<{ key: string; }>; }; } declare interface CacheParameters { adapter?: CacheAdapter; staleAfter?: Time; purge?: Event_2; humanReadableKeys?: boolean; } declare type Callback = (data: Data) => Result; declare type CallbackWithSource = { source: Store; fn: (data: Data, source: Source) => Result; }; declare type CallObject = { id: string; /** * Rejectes promise with provided error and ignores rest of the handler * * @param error - Error to reject promise with, defaults to `OperationAborted` error */ abort: (customError?: unknown) => void; /** * Status of the call * * For sync calls it is always `finished` */ status: 'pending' | 'finished'; /** * Promise of async handler calls, * it is resolved or rejected when handler is finished * * For sync handlers it is not presented */ promise?: Promise; }; export declare function combineSourced>, S>(config: R, mapper?: (v: { [Key in keyof R]: R[Key] extends SourcedField ? D : never; }) => S): CallbackWithSource; /** * @param op Query or Mutation to apply concurrency to * @param config.strategy Auto-cancelation strategy * - `TAKE_EVERY` will not cancel any requests * - `TAKE_LATEST` will cancel all but the latest request * - `TAKE_FIRST` will ignore all but the first request * @param config.abortAll All requests will be aborted on this event call */ export declare function concurrency(op: RemoteOperation, { strategy, abortAll, }: { strategy?: 'TAKE_LATEST' | 'TAKE_EVERY' | 'TAKE_FIRST'; abortAll?: Event_2; }): RemoteOperation; declare const CONFIGURATION = "CONFIGURATION"; export declare interface ConfigurationError extends FarfetchedError { validationErrors: string[]; } export declare function configurationError(config: { reason: string; validationErrors: string[]; }): ConfigurationError; export declare function connectQuery>(args: { source: Sources; target: Target | [...Target[]]; } & (Target extends Query ? P extends void ? { fn?: undefined; filter?: () => boolean; } : Sources extends Query ? { fn: (sources: { result: RemoteOperationResult; params: RemoteOperationParams; }) => { params: RemoteOperationParams; }; filter?: (sources: { result: RemoteOperationResult; params: RemoteOperationParams; }) => boolean; } : Sources extends Record> ? { fn: (sources: { [index in keyof Sources]: { result: RemoteOperationResult; params: RemoteOperationParams; }; }) => { params: RemoteOperationParams; }; filter?: (sources: { [index in keyof Sources]: { result: RemoteOperationResult; params: RemoteOperationParams; }; }) => boolean; } : NonExtendable : NonExtendable)): void; export declare interface Contract { /** * Checks if Raw is some Data */ isData: (prepared: Raw) => prepared is Data; /** * - empty array is dedicated for valid response * - array of string with validation erorrs for invalidDataError */ getErrorMessages: (prepared: Raw) => string[]; } /** * Creates new Barrier * @param config.active Store that holds the Barrier status * @param config.perform Array of Performers that should be started when active Barrier is touched */ export declare function createBarrier(config: { active: Store; perform?: Array; }): Barrier; /** * Creates new Barrier * @param config.activateOn Event that will activate Barrier * @param config.deactivateOn Event that will deactivate Barrier */ export declare function createBarrier(config: { activateOn: Event_2; deactivateOn: Event_2; }): Barrier; /** * Creates new Barrier * @param config.activateOn.failure A function that will be called every time when operation with applied Barrier fails. If it returns true, Barrier will be activated. * @param config.perform Array of Performers that should be started when active Barrier is touched */ export declare function createBarrier(config: { activateOn: { failure: (options: { params: unknown; error: unknown; }) => boolean; }; perform: Array; }): Barrier; export declare function createCacheAdapter(adapter: CacheAdapterInstance): CacheAdapter; export declare function createHeadlessMutation(config: SharedMutationFactoryConfig & { contract: Contract; validate?: Validator; mapData: DynamicallySourcedField<{ result: ContractData; params: Params; }, MappedData, MapDataSource>; mapError?: DynamicallySourcedField<{ error: Error | InvalidDataError; params: Params; headers?: Headers; }, MappedError, MapErrorSource>; }): Mutation; /** * Creates Query without any executor, it cannot be used as-is. * * @example * const headlessQuery = createHeadlessQuery() * headlessQuery.__.executeFx.use(someHandler) */ export declare function createHeadlessQuery(config: { initialData?: Initial; contract: Contract; mapData: DynamicallySourcedField<{ result: ContractData; params: Params; }, MappedData, MapDataSource>; mapError?: DynamicallySourcedField<{ error: Error | InvalidDataError; params: Params; headers?: Headers; }, MappedError, mapErrorSource>; validate?: Validator; sourced?: SourcedField[]; paramsAreMeaningless?: boolean; } & SharedQueryFactoryConfig): Query; export declare function createJsonMutation(config: BaseJsonMutationConfigWithParams & { response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: Params; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; status?: { expected: number | number[]; }; }; }): Mutation; export declare function createJsonMutation(config: BaseJsonMutationConfigWithParams & { response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; status?: { expected: number | number[]; }; }; }): Mutation; export declare function createJsonMutation(config: BaseJsonMutationConfigNoParams & { response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: void; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; status?: { expected: number | number[]; }; }; }): Mutation; export declare function createJsonMutation(config: BaseJsonMutationConfigNoParams & { response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; status?: { expected: number | number[]; }; }; }): Mutation; export declare function createJsonQuery(config: BaseJsonQueryConfigWithParams & { response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: Params; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigWithParams & { initialData?: TransformedData; response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: Params; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigWithParams & { response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigWithParams & { initialData?: Data; response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: Params; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigNoParams & { response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: void; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigNoParams & { initialData?: TransformedData; response: { contract: Contract; mapData: DynamicallySourcedField<{ result: Data; params: void; headers?: Headers; }, TransformedData, DataSource>; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigNoParams & { response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createJsonQuery(config: BaseJsonQueryConfigNoParams & { initialData?: Data; response: { contract: Contract; mapError?: DynamicallySourcedField<{ error: JsonApiRequestError; params: void; headers?: Headers; }, MappedError, FailureSource>; validate?: Validator; }; }): Query; export declare function createMutation(config: { handler: (params: Params) => Promise; } & SharedMutationFactoryConfig): Mutation; export declare function createMutation(config: { effect: Effect; } & SharedMutationFactoryConfig): Mutation; export declare function createMutation(config: { effect: Effect; mapError: DynamicallySourcedField<{ error: Error; params: Params; }, MappedError, MapErrorSource>; } & SharedMutationFactoryConfig): Mutation; export declare function createMutation(config: { effect: Effect; contract: Contract; } & SharedMutationFactoryConfig): Mutation; export declare function createMutation(config: { effect: Effect; contract: Contract; mapError: DynamicallySourcedField<{ error: Error | InvalidDataError; params: Params; }, MappedError, MapErrorSource>; } & SharedMutationFactoryConfig): Mutation; export declare function createQuery(config: { handler: (...p: Params) => Promise; } & SharedQueryFactoryConfig): Query, Response, unknown>; export declare function createQuery(config: { initialData: Response; handler: (...p: Params) => Promise; } & SharedQueryFactoryConfig): Query, Response, unknown, Response>; export declare function createQuery(config: { effect: Effect; mapData: DynamicallySourcedField<{ result: Response; params: Params; }, MappedData, MapDataSource>; validate?: Validator; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { effect: Effect; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { initialData: Response; effect: Effect; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { effect: Effect; contract: Contract; validate?: Validator; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { initialData: ContractData; effect: Effect; contract: Contract; validate?: Validator; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { initialData: MappedData; effect: Effect; mapData: DynamicallySourcedField<{ result: Response; params: Params; }, MappedData, MapDataSource>; validate?: Validator; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { effect: Effect; contract: Contract; mapData: DynamicallySourcedField<{ result: ContractData; params: Params; }, MappedData, MapDataSource>; validate?: Validator; } & SharedQueryFactoryConfig): Query; export declare function createQuery(config: { initialData: MappedData; effect: Effect; contract: Contract; mapData: DynamicallySourcedField<{ result: ContractData; params: Params; }, MappedData, MapDataSource>; validate?: Validator; } & SharedQueryFactoryConfig): Query; declare type DataSource = { name: string; get: Effect<{ params: Params; }, { result: unknown; stale: boolean; meta?: unknown; } | null, unknown>; set?: Effect<{ params: Params; result: unknown; }, void, unknown>; unset?: Effect<{ params: Params; }, void, unknown>; }; export declare function declareParams(): ParamsDeclaration; declare interface DefaultMeta { name: string; flags: Record; $callObjects?: Store; } declare interface DelayOptions_2 { randomize: { spread: number; }; } export declare type DynamicallySourcedField = Callback | CallbackWithSource; export declare interface ExecutionMeta { stopErrorPropagation: boolean; stale: boolean; } export declare function exponentialDelay(base: number, opts?: DelayOptions_2): ({ attempt }: RetryMeta) => number; declare type FailInfo> = { params: RemoteOperationParams; error: RemoteOperationError; meta: ExecutionMeta; }; export declare type FarfetchedError = { errorType: T; explanation: string; }; export declare type FetchApiRecord = Record; /** * Effect wrapper for Fetch API * * It's used to declare static type of Error and mock requests in tests */ export declare const fetchFx: Effect; export declare type FetchingStatus = 'initial' | 'pending' | 'done' | 'fail'; export declare type FetchOptions = Omit; declare type Hour = `${number}${HourUnit}`; declare type HourUnit = 'h' | 'hr' | 'hrs' | 'hour' | 'hours'; declare const HTTP = "HTTP"; export declare interface HttpError extends FarfetchedError { status: Status; statusText: string; response: string | Json | null; } export declare function httpError(config: { status: number; statusText: string; response: string | Json | null; }): HttpError; declare type HttpMethod = 'HEAD' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'QUERY' | 'OPTIONS'; export declare function inMemoryCache(config?: CacheAdapterOptions): CacheAdapter; declare const INVALID_DATA = "INVALID_DATA"; export declare interface InvalidDataError extends FarfetchedError { validationErrors: string[]; response: unknown; } export declare function invalidDataError(config: { validationErrors: string[]; response: unknown; }): InvalidDataError; export declare function isHttpError(args: WithError): args is WithError; export declare function isHttpErrorCode(code: Code | Code[]): (args: WithError) => args is WithError, Record>; export declare function isInvalidDataError(args: WithError): args is WithError; export declare function isNetworkError(args: WithError): args is WithError; export declare function isPreparationError(args: WithError): args is WithError; export declare function isTimeoutError(args: WithError): args is WithError; export { Json } export declare type JsonApiRequestError = ApiRequestError | InvalidDataError; export declare type JsonObject = Record; export declare function keepFresh(query: Query, config: { automatically: true; enabled?: Store; }): void; export declare function keepFresh(query: Query, config: { triggers: Array | TriggerProtocol>; enabled?: Store; }): void; export declare function keepFresh(query: Query, config: { automatically: true; triggers: Array | TriggerProtocol>; enabled?: Store; }): void; export declare function linearDelay(base: number, opts?: DelayOptions_2): ({ attempt }: RetryMeta) => number; export declare function localStorageCache(config?: CacheAdapterOptions & SerializeConfig): CacheAdapter; export declare const Meta: unique symbol; declare type Millisecond = `${number}${MillisecondUnit}`; declare type MillisecondUnit = 'ms' | 'milli' | 'millisecond' | 'milliseconds'; declare type Min = `${number}${MinUnit}`; declare type MinUnit = 'm' | 'min' | 'mins' | 'minute' | 'minutes'; export declare interface Mutation extends RemoteOperation { '@@unitShape': () => { start: EventCallable; pending: Store; }; } declare class Mutex { private _resolve; private _promise; constructor(locked?: boolean); get isLocked(): boolean; acquire(): void; waitForUnlock(): Promise; release(): void; } declare const NETWORK = "NETWORK"; export declare interface NetworkError extends FarfetchedError { reason: string | null; cause?: unknown; } export declare function networkError(config: { reason: string | null; cause?: unknown; }): NetworkError; export declare const NodeLinksSumbol: unique symbol; export declare const NodeMetaSumbol: unique symbol; declare type NonExtendable = { [K in string]: never; }; export declare function normalizeSourced(config: { field: SourcedField; }): Store<(params: Data) => Result>; export declare function normalizeSourced(config: { field: SourcedField; }): Store<(params: Data) => Result>; /** * Binds a callback to be called when the Operation is aborted * * @param callback Callback to be called when the Operation is aborted */ export declare function onAbort(callback: () => void): void; /** * Copy-paste from Effector's sources */ declare type OptionalParams = Args['length'] extends 0 ? void : 0 | 1 extends Args['length'] ? /** * Applying `infer` to a variadic arguments here we'll get `Args` of * shape `[T]` or `[T?]`, where T(?) is a type of handler `params`. * In case T is optional we get `T | undefined` back from `Args[0]`. * We lose information about argument's optionality, but we can make it * optional again by appending `void` type, so the result type will be * `T | undefined | void`. * * The disadvantage of this method is that we can't restore optonality * in case of `params?: any` because in a union `any` type absorbs any * other type (`any | undefined | void` becomes just `any`). And we * have similar situation also with the `unknown` type. */ Args[0] | void : Args[0]; export declare interface ParamsDeclaration { watch(cb: (payloaad: T) => void): Subscription; } declare type Performer = RemoteOperation | Effect | { start: EventCallable; end: Event_2; }; declare const PREPARATION = "PREPARATION"; export declare interface PreparationError extends FarfetchedError { response: string; reason: string | null; } export declare function preparationError(config: { response: string; reason: string | null; }): PreparationError; export declare interface Query extends RemoteOperation, QueryExtraLowLevelAPI> { /** * Start fetching data if it is absent or stale. */ refresh: EventCallable; /** * The reactive value of the latest received data. * * If there was an error during fetching or there has not been a request yet, the store will be `null`. */ $data: Store; /** * The reactive value of the data retrieval error. * * If the data was successfully fetched or there is no request yet, the store will be `null`. */ $error: Store; /** * Is data stale? */ $stale: StoreWritable; '@@unitShape': () => { data: Store; error: Store; stale: Store; pending: Store; start: EventCallable; }; } declare type QueryExtraLowLevelAPI = { refreshSkipDueToFreshness: Event_2; }; declare type QueryInitialData> = Q['__']['meta']['initialData']; declare interface QueryMeta { /** * This field is used to determine how to serialize data in various cases: * - transfer state from server to client during SSR * - save state to persistent storage during caching */ serialize: Serialize; initialData: InitialData; sid: string | null; } declare type QueryState> = { result: RemoteOperationResult; params: RemoteOperationParams; } | { error: RemoteOperationError; params: RemoteOperationParams; } | (QueryInitialData extends null ? null : { result: QueryInitialData; }); declare type Refetch> = boolean | { params: RemoteOperationParams; }; declare interface RemoteOperation { /** * Reactive current request status * * + `initial` — the data has never been fetched yet * + 'pending' — the data is being fetched right now * + 'done' — the data has been successfully fetched * + 'fail' — an error occurred while fetching data */ $status: Store; /** Is fetching started? */ $idle: Store; /** Is fetching in progress right now? */ $pending: Store; /** Is fetching failed? */ $failed: Store; /** Is fetching succeeded? */ $succeeded: Store; /** Is fetching finished? */ $finished: Store; /** * Is operation enabled? * * + false — any `start` call will be ignored, event done.skip will be fired immediately * + true — query will be executed after any `start` call */ $enabled: Store; /** Event to trigger operation */ start: EventCallable; /** Event to reset the whole state of the operation */ reset: EventCallable; /** Event that trigered after operation started */ started: Event_2<{ params: Params; meta: ExecutionMeta; }>; aborted: Event_2<{ params: Params; meta: ExecutionMeta; }>; /** Set of events that represent end of query */ finished: { /** Query was successfully ended, data will be passed as a payload */ success: Event_2<{ params: Params; result: Data; meta: ExecutionMeta; }>; /** Query was failed, error will be passed as a payload */ failure: Event_2<{ params: Params; error: Error; meta: ExecutionMeta; }>; /** Query execution was skipped due to `enabled` field in config */ skip: Event_2<{ params: Params; meta: ExecutionMeta; }>; /** Query was ended, it merges `success`, `error` and `skip` */ finally: Event_2<{ params: Params; meta: ExecutionMeta; } & ({ status: 'done'; result: Data; } | { status: 'fail'; error: Error; } | { status: 'skip'; })>; }; /** * DO NOT USE THIS FIELD IN PRODUCTION * * It is internal operator details which is useful for testing. */ __: { /** * Internal effect, which executes to retrieve data. * * It must not be used in production. Please use it only for test purposes. * * @example * * import { locationQuery } from './location'; * * test('some test', async () => { * const scope = fork({ * handlers: [[locationQuery.__.executeFx, vi.fn()]] * }); * * //...test code * }) */ executeFx: Effect; /** * Meta information about operation and its configuration. */ meta: Meta & DefaultMeta; /** * Distinguish different kinds of operations */ kind: unknown; $latestParams: Store; /** * Low-level API, it can be changed anytime without any notice! */ lowLevelAPI: { dataSources: Array>; dataSourceRetrieverFx: Effect<{ params: Params; meta: ExecutionMeta; }, { result: unknown; stale: boolean; }, any>; sourced: SourcedField[]; paramsAreMeaningless: boolean; revalidate: EventCallable<{ params: Params; refresh: boolean; }>; pushData: EventCallable; pushError: EventCallable; startWithMeta: EventCallable<{ params: Params; meta: ExecutionMeta; }>; callObjectCreated: Event_2; failedIgnoreSuppression: Event_2<{ params: Params; error: Error; meta: ExecutionMeta; }>; failedBeforeMap: EventCallable<{ params: Params; error: Error; meta: ExecutionMeta; }>; } & ExtraLowLevelAPI; }; } export declare type RemoteOperationError> = EventPayload['error']; export declare type RemoteOperationParams> = EventPayload; export declare type RemoteOperationResult> = EventPayload['result']; declare type RequestConfig = { url: SourcedField; credentials?: RequestCredentials; fetch?: StaticOrReactive; query?: SourcedField | SourcedField; headers?: SourcedField; } & ({ method: 'GET' | 'HEAD'; } | { method: Exclude; body?: SourcedField; }); declare type RequestConfig_2 = { url: SourcedField; credentials?: RequestCredentials; fetch?: StaticOrReactive; query?: SourcedField | SourcedField; headers?: SourcedField; } & ({ method: 'GET' | 'HEAD'; } | { method: Exclude; body?: SourcedField; }); export declare const Result: unique symbol; export declare function retry, DelaySource = unknown, FilterSource = unknown, MapParamsSource = unknown>(operation: Q, { times, delay: timeout, filter, mapParams, ...params }: RetryConfig): void; declare type RetryConfig, DelaySource = unknown, FilterSource = unknown, MapParamsSource = unknown> = { times: StaticOrReactive; delay: SourcedField; filter?: SourcedField, boolean, FilterSource>; mapParams?: DynamicallySourcedField & { meta: RetryMeta; }, RemoteOperationParams, MapParamsSource>; otherwise?: EventCallable>; supressIntermediateErrors?: boolean; }; declare interface RetryMeta { attempt: number; } declare type RuleResult> = { result: RemoteOperationResult | QueryInitialData; refetch?: Refetch; } | { error: RemoteOperationError; refetch?: Refetch; }; declare type Sec = `${number}${SecUnit}`; declare type SecUnit = 's' | 'sec' | 'secs' | 'second' | 'seconds'; declare type Serialize = NonNullable>[1]>['serialize']; declare type SerializeConfig = { serialize?: { read: (value: Json) => unknown; write: (value: unknown) => Json; }; }; export declare function sessionStorageCache(config?: CacheAdapterOptions & SerializeConfig): CacheAdapter; declare interface SharedMutationFactoryConfig { name?: string; enabled?: StaticOrReactive; } declare interface SharedQueryFactoryConfig { name?: string; enabled?: StaticOrReactive; serialize?: Serialize; } export declare type SourcedField = Result | Store | Callback | CallbackWithSource; declare type StaticOrReactive = T | Store>; declare type Time = `${Hour} ${Min} ${Sec}` | `${Hour} ${Min}` | `${Min} ${Sec}` | `${Hour}` | `${Min}` | `${Sec}` | `${Hour} ${Min} ${Sec} ${Millisecond}` | `${Hour} ${Min} ${Millisecond}` | `${Min} ${Sec} ${Millisecond}` | `${Hour} ${Millisecond}` | `${Min} ${Millisecond}` | `${Sec} ${Millisecond}` | `${Millisecond}` | number; declare const TIMEOUT = "TIMEOUT"; /** * * Applies timeout to the operation - if operation is not finished in specified time, it will be aborted * * @param operation - Any remote operation, like Query or Mutation * @param config - Timeout config * @param config.after - Time after which operation will be aborted, can be human-readable string (like "100ms") or number in milliseconds, or effector's `Store` with any of these types */ export declare function timeout>(operation: Q, config: { after: StaticOrReactive