/** * 平台类型 */ export type PlatformType = 'wechat-miniprogram' | 'wechat-h5' | 'h5' | 'm8-app' | 'unknown'; /** * EJS API 白名单(M8 框架通用 API) * ⚠️ 注意:设备相关功能(拍照、定位、扫码等)需要根据目标平台使用对应的官方 API * - 微信小程序:使用 wx.* API * - 微信公众号/H5:使用微信 JSSDK * - 原生 App:使用 ejs.device.* API */ export declare const EJS_API_WHITELIST: { readonly ui: { readonly methods: readonly ["toast", "alert", "confirm", "showWaiting", "closeWaiting", "picker", "pickDate", "pickTime"]; readonly description: "UI 交互相关 API(通用)"; }; readonly page: { readonly methods: readonly ["open", "close", "setTitle"]; readonly description: "页面导航相关 API(通用)"; }; readonly storage: { readonly methods: readonly ["setItem", "getItem", "removeItem"]; readonly description: "本地存储相关 API(通用)"; }; }; /** * 平台特定 API 参考 * 这些不是 M8 框架的 API,而是各平台原生 API 的参考 */ export declare const PLATFORM_SPECIFIC_APIS: { 'wechat-miniprogram': { description: string; docUrl: string; apis: { takePhoto: string; chooseImage: string; getLocation: string; scanCode: string; navigateTo: string; request: string; }; }; 'wechat-h5': { description: string; docUrl: string; apis: { takePhoto: string; chooseImage: string; getLocation: string; scanQRCode: string; }; }; h5: { description: string; apis: { takePhoto: string; chooseImage: string; getLocation: string; }; }; }; /** * 禁止使用的 API(常见错误) * 这些是 AI 常常臆想的不存在的方法 */ export declare const FORBIDDEN_APIS: string[]; /** * API 替换建议 * 将错误的 API 映射到正确的 API */ export declare const API_CORRECTIONS: Record; /** * 验证 API 调用是否有效 * @param apiCall API 调用字符串,如 "ejs.ui.toast" * @returns 验证结果 */ export declare function validateApiCall(apiCall: string): { valid: boolean; suggestion?: string; example?: string; }; /** * 检查代码中是否使用了禁止的 API * @param code 代码字符串 * @returns 发现的问题列表 */ export declare function checkCodeForForbiddenApis(code: string): Array<{ forbidden: string; suggestion: string; example?: string; }>; /** * 获取所有可用的 EJS API 列表 * @returns API 列表 */ export declare function getAvailableEjsApis(): Array<{ module: string; method: string; fullName: string; }>; /** * 获取平台特定功能的 API 建议 * @param platform 目标平台 * @param feature 功能名称(如 takePhoto, getLocation, scanCode) * @returns API 使用建议 */ export declare function getPlatformApiSuggestion(platform: PlatformType, feature: 'takePhoto' | 'chooseImage' | 'getLocation' | 'scanCode' | 'scanQRCode'): { api: string; docUrl?: string; } | null; /** * 生成平台特定功能的代码提示 * @param feature 功能名称 * @returns 各平台的代码示例 */ export declare function getPlatformApiExamples(feature: string): string; //# sourceMappingURL=api-validator.d.ts.map