import type { MutationOptions } from '@tanstack/query-core' import { type ReconnectErrorType, type ReconnectParameters, type ReconnectReturnType, reconnect, } from '../actions/reconnect.js' import type { Config } from '../createConfig.js' import type { MutationParameter } from '../types/query.js' import type { Compute } from '../types/utils.js' import type { Mutate, MutateAsync } from './types.js' export type ReconnectOptions = MutationParameter< ReconnectData, ReconnectErrorType, ReconnectVariables, context > export function reconnectMutationOptions( config: Config, options: ReconnectOptions = {}, ): ReconnectMutationOptions { return { ...(options.mutation as any), mutationFn(variables) { return reconnect(config, variables) }, mutationKey: ['reconnect'], } } export type ReconnectMutationOptions = MutationOptions< ReconnectData, ReconnectErrorType, ReconnectVariables > export type ReconnectData = Compute export type ReconnectVariables = ReconnectParameters | undefined export type ReconnectMutate = Mutate< ReconnectData, ReconnectErrorType, ReconnectVariables, context > export type ReconnectMutateAsync = MutateAsync< ReconnectData, ReconnectErrorType, ReconnectVariables, context >