Files
cut-abstractions/src/base.ts

42 lines
1015 B
TypeScript
Raw Normal View History

2025-07-04 16:47:14 +08:00
import { ConfigBase } from "./models/config";
2025-07-03 10:26:03 +08:00
/**
*
*/
export interface ProcessorContext<TInput = any, TOutput = any, TConfig extends ConfigBase = ConfigBase> {
2025-07-03 10:26:03 +08:00
/**
*
*/
input?: TInput;
2025-07-03 10:26:03 +08:00
/**
*
*/
params?: TConfig;
2025-07-03 10:26:03 +08:00
/**
*
*/
output?: TOutput;
2025-07-03 10:26:03 +08:00
}
/**
*
*/
export abstract class ProcessorBase<TInput, TOutput, TConfig extends ConfigBase> {
/**
* 使 kebab-case
* @example handle-ability
*/
public abstract get name(): string;
/**
*
* 使 semver
* @default 1.0.0
*/
2025-07-09 16:16:49 +08:00
public abstract get version(): string;
/**
*
* @param context
*/
public abstract exec(context: ProcessorContext<TInput, TOutput, TConfig>): Promise<void> | void;
2025-06-24 11:48:26 +08:00
}