import GsccCommand, { GsccCommandType } from "./GsccCommand"; import { ResultMessage } from "./ResultMessage"; import ResolveResultCommand from "./ResolveResultCommand"; import CleanCommand from "./CleanCommand"; import MessageNode from "../MessageNode"; import RejectResultCommand from "./RejectResultCommand"; export { GsccCommandType, ResolveResultCommand, CleanCommand, GsccCommand, ResultMessage, RejectResultCommand }; export declare enum CommandType { gscc = 0, control = 1, clean = 2, message = 3, result = 4, callback = 5, error = 6 } export declare const CommandTypeMap: { [key: string]: ICommandProcesser; }; export declare type CommandMessage = [CommandType, number, ...any[]]; export interface ICommandProcesser { cmdID: number; type: CommandType; payloads: any; /** * 序列化给目标环境处理 * 序列化时需要保证数组的第一个为Command的类型 * * @memberof ICommandProcesser */ serialize: (...args: any) => CommandMessage; /** * * 在当前环境处理 * @memberof ICommandProcesser * @returns 当返回false时, 为结果对象, 表明无需进一步处理 */ deserialize: (detail: CommandMessage) => ResultMessage | false | Promise; } export default function commandFactory(type: CommandType, cmdID: number, payloads: any[] | undefined, messageNode: MessageNode, origin?: string): ICommandProcesser;