import { ShallowRef } from "vue"; import { PiniaColadaPluginContext } from "@pinia/colada"; //#region src/retry.d.ts /** * Options for the Pinia Colada Retry plugin. */ interface RetryOptions { /** * The delay between retries. Can be a duration in ms or a function that * receives the attempt number (starts at 0) and returns a duration in ms. By * default, it will wait 2^attempt * 1000 ms, but never more than 30 seconds. * * @param attempt - * @returns */ delay?: number | ((attempt: number) => number); /** * The maximum number of times to retry the operation. Set to 0 to disable or * to Infinity to retry forever. It can also be a function that receives the * failure count and the error and returns if it should retry. Defaults to 3. * **Must be a positive number**. */ retry?: number | ((failureCount: number, error: unknown) => boolean); } interface RetryEntry { retryCount: number; timeoutId?: ReturnType; } /** * Plugin that adds the ability to retry failed queries. * * @param globalOptions - global options for the retries */ declare function PiniaColadaRetry(globalOptions?: RetryOptions): (context: PiniaColadaPluginContext) => void; declare module '@pinia/colada' { interface UseQueryOptions { /** * Options for the retries of this query added by `@pinia/colada-plugin-retry`. */ retry?: RetryOptions | Exclude; } interface UseQueryEntryExtensions { /** * Whether the query is currently retrying. Requires the `@pinia/colada-plugin-retry` plugin. */ isRetrying: ShallowRef; /** * The number of retries that have been scheduled so far. Resets on success or manual refetch. * Requires the `@pinia/colada-plugin-retry` plugin. */ retryCount: ShallowRef; /** * The error that triggered the current retry. `null` when not retrying or when retries are exhausted. * Requires the `@pinia/colada-plugin-retry` plugin. */ retryError: ShallowRef; /** * Plain object with retry state for devtools. Only present in development mode. */ retry?: { isRetrying: boolean; retryCount: number; retryError: unknown; }; } } //#endregion export { PiniaColadaRetry, RetryEntry, RetryOptions }; //# sourceMappingURL=index.d.mts.map