42 lines
863 B
TypeScript
42 lines
863 B
TypeScript
import { ConfigBase } from "./models/config";
|
|
|
|
|
|
/**
|
|
* 加工处理器上下文
|
|
*/
|
|
export abstract class ProcessorContext<TInput,TOutput,TConfig extends ConfigBase>{
|
|
/**
|
|
* 输入数据
|
|
*/
|
|
public input?:TInput;
|
|
/**
|
|
* 合并配置文件与临时输入参
|
|
*/
|
|
public params?:TConfig;
|
|
/**
|
|
* 输出数据
|
|
*/
|
|
public output?:TOutput;
|
|
}
|
|
|
|
/**
|
|
* 处理器基类
|
|
*/
|
|
export abstract class ProcessorBase<TInput,TOutput,TConfig extends ConfigBase> {
|
|
public abstract get name():string;
|
|
public abstract get version(): string;
|
|
public abstract exec(context:ProcessorContext<TInput,TOutput,TConfig>):Promise<void>|void
|
|
}
|
|
|
|
export interface resultInfo {
|
|
code: ResCodeType;
|
|
data?: any;
|
|
success?: boolean;
|
|
message?: string;
|
|
}
|
|
|
|
export enum ResCodeType{
|
|
SUCCESS = 1,
|
|
ERROR = 0,
|
|
WARNING = -1
|
|
} |