UNPKG

@nexe/config-manager

Version:

Nexe Config Manager - A flexible configuration management solution with multiple sources and hot reload support

62 lines 1.48 kB
import type { IConfigSource } from '../interfaces'; /** * 远程API配置源 */ export declare class RemoteApiConfigSource implements IConfigSource { private baseUrl; private headers; private pollingInterval?; private pollingTimer?; private cache; private callbacks; /** * @param baseUrl 远程API基础URL * @param headers 请求头 * @param pollingInterval 轮询间隔(毫秒),如果设置则启用轮询更新 */ constructor(baseUrl: string, headers?: Record<string, string>, pollingInterval?: number); /** * 从远程API加载配置 */ load(key?: string, _pathPrefix?: string): Promise<unknown>; /** * 获取配置源名称 */ getName(): string; /** * 是否支持热更新 */ supportsHotReload(): boolean; /** * 订阅配置变更 */ subscribe(key: string, callback: (value: unknown) => void): void; /** * 取消订阅配置变更 */ unsubscribe(key: string): void; /** * 开始轮询更新 */ private startPolling; /** * 轮询检查配置变更 */ private pollForChanges; /** * 获取特定键的配置值 */ /** * 获取所有配置 */ private fetchAllConfig; /** * 获取嵌套对象的属性值 */ private getNestedValue; /** * 关闭资源 */ dispose(): void; } //# sourceMappingURL=remote-api-config-source.d.ts.map