import { MidwayCache } from "@midwayjs/cache-manager"; import { IMidwayContext, IMidwayApplication } from "@midwayjs/core"; import { FsCacheStore } from "./cache/store"; export * from "./hook/upload"; export * from "./exception/base"; export * from "./exception/comm"; export * from "./exception/core"; export * from "./exception/validate"; export * from "./constant/global"; /** * 插件信息 */ export interface PluginInfo { /** 名称 */ name: string; /** 唯一标识 */ key: string; /** 钩子 */ hook: string; /** 版本 */ version: string; /** 描述 */ description: string; /** 作者 */ author: string; /** logo */ logo: string; /** README 使用说明 */ readme: string; /** 配置 */ config: any; } /** * 插件基类,不建议修改 */ export declare abstract class BasePlugin { /** 插件信息 */ pluginInfo: PluginInfo; /** 请求上下文,用到此项无法本地调试,需安装到cool-admin中才能调试 */ ctx: IMidwayContext; /** 应用实例,用到此项无法本地调试,需安装到cool-admin中才能调试 */ app: IMidwayApplication; /** 缓存 */ cache: FsCacheStore | MidwayCache; /** 插件 */ pluginService: PluginService; /** 基础目录位置 */ baseDir: string; setCtx(ctx: IMidwayContext): void; setApp(app: IMidwayApplication): void; constructor(); /** * 获得App级别的实例 * @param name * @returns */ getAppInstance(name: string): Promise; /** * 获得请求级别的实例 * @param name * @returns */ getCtxInstance(name: string): Promise; /** * 初始化插件 * @param pluginInfo * @param ctx * @param app */ init(pluginInfo: PluginInfo, ctx?: IMidwayContext, app?: IMidwayApplication, other?: any): Promise; /** * 处理配置目录 */ private configDir; /** * 插件就绪 */ ready(): Promise; } /** * 插件服务 */ export declare class PluginService { /** * 调用插件 * @param key 插件key * @param method 方法 * @param params 参数 * @returns */ invoke(key: string, method: string, ...params: any[]): Promise; /** * 获得插件实例 * @param key * @returns */ getInstance(key: string): Promise; /** * 检查状态 * @param key */ checkStatus(key: string): Promise; }