UNPKG

sdg-admin

Version:

pomelo sdg admin plugin

62 lines (61 loc) 1.54 kB
/// <reference types="node" /> import Timeout = NodeJS.Timeout; import { MasterAgent, MonitorAgent } from '..'; import { ConsoleService } from '../consoleService'; export interface IObject { [key: string]: any; } export declare type ISocketBody = any; export interface ISocketMsg { moduleId: string; serverId?: string; body?: ISocketBody; } export declare enum EModuleType { CLIENT = "client", MONITOR = "monitor" } export declare enum EModuleAction { PUSH = "push", PULL = "pull", NORMAL = "" } export interface IModule { moduleId?: string; type?: EModuleAction; interval?: number; delay?: number; start?: () => Promise<void>; masterHandler?: (agent: MasterAgent, msg: ISocketMsg) => Promise<any>; monitorHandler?: (agent: MonitorAgent, msg: ISocketBody) => Promise<any>; clientHandler?: (agent: MasterAgent, msg: ISocketBody) => Promise<any>; } export interface IModuleOpts { type?: EModuleAction; interval?: number; delay?: number; } export interface IModuleRecord { moduleId: string; module: IModule; enable: boolean; delay?: number; interval?: number; schedule?: boolean; jobId?: Timeout; } export interface IModuleFactory { new (opts: any, consoleService?: ConsoleService): IModule; moduleId: string; } export declare enum EStatus { INIT = 1, CONNECTED = 2, REGISTERED = 3, CLOSED = 4 } export declare enum ESocketEvent { REGISTER = "register", MONITOR = "monitor", CLIENT = "client" }