/**
 * Utility for creating cancellable service functions
 */
export type CancellableFunction<T extends (...args: any[]) => any> = T & {
    /**
     * Cancel any in-flight request
     */
    cancel: () => void;
    /**
     * Get the current AbortController
     */
    getController: () => AbortController | undefined;
    /**
     * Check if there's an active request
     */
    isActive: () => boolean;
};
/**
 * Creates a cancellable version of a service function.
 * The service function must accept an AbortSignal as its last parameter.
 *
 * @example
 * ```typescript
 * // Original service
 * const getUsers = async (params?: UserParams, signal?: AbortSignal) => {
 *   return api.get('/users', params, { signal });
 * };
 *
 * // Make it cancellable
 * const cancellableGetUsers = createCancellableService(getUsers);
 *
 * // Use it
 * const users = await cancellableGetUsers({ page: 1 });
 *
 * // Cancel if needed
 * cancellableGetUsers.cancel();
 * ```
 */
export declare function createCancellableService<TArgs extends any[], TReturn>(serviceFunction: (...args: [...TArgs, AbortSignal?]) => Promise<TReturn>): CancellableFunction<(...args: TArgs) => Promise<TReturn>>;
/**
 * Creates a cancellable service class that manages multiple service functions
 *
 * @example
 * ```typescript
 * class UserService extends CancellableServiceManager {
 *   getUsers = this.createMethod(async (params?: UserParams, signal?: AbortSignal) => {
 *     return api.get('/users', params, { signal });
 *   });
 *
 *   getUser = this.createMethod(async (id: string, signal?: AbortSignal) => {
 *     return api.get(`/users/${id}`, undefined, { signal });
 *   });
 * }
 * ```
 */
export declare class CancellableServiceManager {
    private controllers;
    /**
     * Create a cancellable method
     */
    protected createMethod<TArgs extends any[], TReturn>(name: string, serviceFunction: (...args: [...TArgs, AbortSignal?]) => Promise<TReturn>): CancellableFunction<(...args: TArgs) => Promise<TReturn>>;
    /**
     * Cancel a specific method's request
     */
    cancelMethod(name: string): void;
    /**
     * Cancel all active requests
     */
    cancelAll(): void;
    /**
     * Get all active method names
     */
    getActiveMethods(): string[];
    /**
     * Check if any requests are active
     */
    hasActiveRequests(): boolean;
}
//# sourceMappingURL=cancellable-service.d.ts.map