import type { ReactNode } from 'react';
import type { OperationSchema, RequestFnInfo, RequestFnOptions, RequestFnResponse } from './lib/requestFn.js';
import { QueryClient } from '@tanstack/react-query';
type RequestFn = (schema: OperationSchema, requestInfo: RequestFnInfo, options?: RequestFnOptions) => Promise<RequestFnResponse<any, any>>;
interface QraftSecureRequestFnBaseProps<TRequestFn extends RequestFn> {
    requestFn: TRequestFn;
    securitySchemes: SecuritySchemeHandlers<string>;
}
export interface QraftSecureRequestFnProps<TRequestFn extends RequestFn> extends QraftSecureRequestFnBaseProps<TRequestFn> {
    children(secureRequestFn: TRequestFn): ReactNode;
    queryClient?: QueryClient;
}
export declare function QraftSecureRequestFn<TRequestFn extends RequestFn>({ children, requestFn, securitySchemes, queryClient: inQueryClient, }: QraftSecureRequestFnProps<TRequestFn>): import("react").FunctionComponentElement<{
    children?: ReactNode | undefined;
}>;
export declare const useSecuritySchemeAuth: <TRequestFn extends RequestFn>({ securitySchemes, requestFn, queryClient, }: QraftSecureRequestFnBaseProps<TRequestFn> & {
    queryClient: QueryClient;
}) => TRequestFn;
/**
 * Create a secure `requestFn` that manages security schemes.
 * It will automatically fetch and refresh tokens when needed
 * using QueryClient and the provided security schemes.
 *
 * @param securitySchemes OpenAPI security schemes.
 * @param requestFn Qraft `requestFn`
 * @param queryClient QueryClient instance.
 */
export declare function createSecureRequestFn<TRequestFn extends RequestFn>(securitySchemes: SecuritySchemeHandlers<string>, requestFn: TRequestFn, queryClient: QueryClient): TRequestFn;
/**
 * @internal
 */
export declare function shallowEqualObjects(newObj: Record<string, any> | string, prevObj: Record<string, any> | string | undefined): boolean;
type SecurityScheme = SecuritySchemeBearer | SecuritySchemeBasic | SecuritySchemeAPIKey | SecuritySchemeCookie;
export type SecuritySchemeBearer = string /** JWT Bearer token. **/ | {
    /** Refresh interval in milliseconds. */
    refreshInterval: number;
    /** Token to be used for authentication. */
    token: string;
};
export interface SecuritySchemeBasic {
    /** Credentials to be used for authentication. */
    credentials: string;
    /** Refresh interval in milliseconds. */
    refreshInterval: number;
}
export type SecuritySchemeAPIKey = {
    /** Where the secret should be placed. */
    in: 'header' | 'query';
    /** Name of the secret key. */
    name: string;
    /** Secret to be used for authentication. */
    value: string;
    /** Refresh interval in milliseconds. */
    refreshInterval?: number;
};
export type SecuritySchemeCookie = {
    /** Where the secret should be placed. */
    in: 'cookie';
    /** Refresh interval in milliseconds. */
    refreshInterval?: number;
};
/**
 * Type definition for a handler function that manages security schemes.
 * This function is invoked when a token needs to be fetched or refreshed.
 *
 * @param props - The properties for the handler function.
 * @param props.isRefreshing - A boolean indicating the state of the token.
 *    It's `false` on the initial "fetch token" request, and `true` if the token is stale or updating using `refreshInterval`.
 * @param props.signal - An AbortSignal that can be used to abort the request.
 *
 * @returns A SecurityScheme, which contains the necessary data for authentication.
 */
type SecuritySchemeHandler = (props: {
    isRefreshing: boolean;
    signal: AbortSignal;
}) => SecurityScheme | Promise<SecurityScheme>;
export type SecuritySchemeHandlers<SecuritySchemeName extends string> = {
    [key in SecuritySchemeName]: SecuritySchemeHandler;
};
export {};
//# sourceMappingURL=Unstable_QraftSecureRequestFn.d.ts.map