import { c as PortableReservation, W as WithCreditsOptions } from '../types-DgQtamEe.js'; import { a as CreditsUser, I as ICreditsAuthProvider } from '../types-OZU3I5OM.js'; import { I as ICreditRepository } from '../types-fW2JNmmr.js'; import { D as DeferredExecutor } from '../deferred-C7rrRfkm.js'; /** * Adapter types for the credits system * * Defines the interface for framework-specific adapters that wrap * credit operations with different execution strategies. */ /** * Generic action result type */ interface ActionResult { success: boolean; data?: T; error?: string; } /** * Handler function signature for credit-wrapped actions */ type CreditActionHandler = (user: CreditsUser, data: TInput, reservation: PortableReservation) => Promise>; /** * Configuration for creating a credits adapter */ interface CreditsAdapterConfig { /** Repository for credit operations */ repository: ICreditRepository; /** Auth provider for user authentication */ authProvider: ICreditsAuthProvider; /** Deferred executor for background tasks */ deferred: DeferredExecutor; /** Operation cost lookup table */ operationCosts: Record; } /** * Interface for credits adapters */ interface CreditsAdapter { /** * Wrap an action function with credit handling */ withCredits(options: WithCreditsOptions, handler: CreditActionHandler): (data: TInput) => Promise>; } /** * Generic credits adapter - framework agnostic * * This adapter uses standard JavaScript APIs and works in any * JavaScript environment (Node.js, browser, etc.). */ /** * Create a generic credits adapter * * This adapter: * - Authenticates users via the provided auth provider * - Reserves credits before action execution * - Commits credits on success, releases on failure * - Logs usage asynchronously via the deferred executor */ declare function createGenericAdapter(config: CreditsAdapterConfig): CreditsAdapter; export { type ActionResult, type CreditActionHandler, type CreditsAdapter, type CreditsAdapterConfig, createGenericAdapter };