2025-07-04 16:47:14 +08:00
|
|
|
import { ConfigBase } from "./models/config";
|
2025-07-03 10:26:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 加工处理器上下文
|
|
|
|
*/
|
|
|
|
export abstract class ProcessorContext<TInput,TOutput,TConfig extends ConfigBase>{
|
|
|
|
/**
|
|
|
|
* 输入数据
|
|
|
|
*/
|
2025-07-09 16:19:41 +08:00
|
|
|
public input?:TInput;
|
2025-07-03 10:26:03 +08:00
|
|
|
/**
|
|
|
|
* 合并配置文件与临时输入参
|
|
|
|
*/
|
2025-07-09 16:19:41 +08:00
|
|
|
public params?:TConfig;
|
2025-07-03 10:26:03 +08:00
|
|
|
/**
|
|
|
|
* 输出数据
|
|
|
|
*/
|
2025-07-09 16:19:41 +08:00
|
|
|
public output?:TOutput;
|
2025-07-03 10:26:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 处理器基类
|
|
|
|
*/
|
|
|
|
export abstract class ProcessorBase<TInput,TOutput,TConfig extends ConfigBase> {
|
2025-07-09 16:16:49 +08:00
|
|
|
public abstract get name():string;
|
|
|
|
public abstract get version(): string;
|
2025-07-03 10:26:03 +08:00
|
|
|
public abstract exec(context:ProcessorContext<TInput,TOutput,TConfig>):Promise<void>|void
|
2025-06-24 11:48:26 +08:00
|
|
|
}
|