UNPKG

@mixxtor/currencyx-adonisjs

Version:

AdonisJS integration for CurrencyX.js with database exchange provider and cache support

32 lines (31 loc) 1.37 kB
import type { DatabaseConfig, ServiceConfigProvider, ExchangeFactory } from './types.js'; import { DatabaseExchange } from './exchanges/database.js'; import type { ConfigProvider } from '@adonisjs/core/types'; /** * Define database exchange provider configuration * Returns a factory function to avoid eager instantiation */ declare function database(config: DatabaseConfig): DatabaseExchange; /** * Exchange configuration helpers */ export declare const exchanges: { readonly database: typeof database; readonly google: (config?: import("@mixxtor/currencyx-js").GoogleFinanceConfig) => import("@mixxtor/currencyx-js").GoogleFinanceExchange; readonly fixer: (config: import("@mixxtor/currencyx-js").FixerConfig) => import("@mixxtor/currencyx-js").FixerExchange; }; /** * Helper to remap known exchange exchanges to factory functions */ type ResolvedConfig<Exchanges extends Record<string, ExchangeFactory>> = { default: keyof Exchanges; exchanges: { [K in keyof Exchanges]: Exchanges[K] extends ServiceConfigProvider<infer A> ? A : Exchanges[K]; }; }; /** * Define currency configuration with type inference * Following AdonisJS pattern for better type safety */ export declare function defineConfig<Exchanges extends Record<string, any>>(config: ResolvedConfig<Exchanges>): ConfigProvider<ResolvedConfig<Exchanges>>; export {};