node-os-utils
Version:
Advanced cross-platform operating system monitoring utilities with TypeScript support
87 lines • 2.36 kB
TypeScript
import { PlatformAdapter } from '../types/platform';
/**
* 平台适配器工厂,负责实例化并缓存各操作系统的具体适配器
*/
export declare class AdapterFactory {
private static adapters;
/**
* 创建平台适配器
*
* @param platform 目标平台,如果不指定则自动检测
* @returns 平台适配器实例
*/
static create(platform?: string): PlatformAdapter;
/**
* 获取支持的平台列表
*/
static getSupportedPlatforms(): string[];
/**
* 检查是否支持指定平台
*/
static isPlatformSupported(platform: string): boolean;
/**
* 获取当前平台信息
*/
static getCurrentPlatformInfo(): {
platform: string;
arch: string;
version: string;
supported: boolean;
};
/**
* 检测运行平台
*/
static detectPlatform(): string;
/**
* 获取平台显示名称
*/
static getPlatformDisplayName(platform?: string): string;
/**
* 检查平台能力
*/
static checkPlatformCapabilities(platform?: string): Promise<{
platform: string;
supported: boolean;
capabilities: {
commands: string[];
files: string[];
features: string[];
};
issues: string[];
}>;
/**
* 清理缓存的适配器
*/
static clearCache(): void;
/**
* 获取缓存的适配器数量
*/
static getCacheSize(): number;
/**
* 创建适配器的调试信息
*/
static getDebugInfo(platform?: string): Promise<{
platform: string;
adapter: string;
supportedFeatures: Record<string, any>;
systemInfo: any;
}>;
/**
* 调用适配器运行一系列命令/文件探测以判定平台能力
*/
private static testAdapterCapabilities;
/**
* 按平台列出诊断常用命令,用于能力自检
*/
private static getCommonCommandsByPlatform;
/**
* 按平台列出监控常访问的关键文件
*/
private static getCommonFilesByPlatform;
/**
* 归一化平台标识,兼容常见别名
* 将外部传入的平台别名归一化为 Node.js 标准 platform 值
*/
private static normalizePlatform;
}
//# sourceMappingURL=adapter-factory.d.ts.map