mirror of
https://github.com/certd/certd.git
synced 2026-04-03 14:10:54 +08:00
61 lines
1.0 KiB
TypeScript
61 lines
1.0 KiB
TypeScript
import { Registrable } from "../registry";
|
|
import { FormItemProps } from "../d.ts";
|
|
|
|
export enum ContextScope {
|
|
global,
|
|
pipeline,
|
|
runtime,
|
|
}
|
|
|
|
export type Storage = {
|
|
scope: ContextScope;
|
|
path: string;
|
|
};
|
|
|
|
export type TaskOutputDefine = {
|
|
title: string;
|
|
value?: any;
|
|
storage?: Storage;
|
|
};
|
|
export type TaskInputDefine = FormItemProps;
|
|
|
|
export type PluginDefine = Registrable & {
|
|
default?: any;
|
|
input?: {
|
|
[key: string]: TaskInputDefine;
|
|
};
|
|
output?: {
|
|
[key: string]: TaskOutputDefine;
|
|
};
|
|
|
|
autowire?: {
|
|
[key: string]: any;
|
|
};
|
|
};
|
|
|
|
export type ITaskPlugin = {
|
|
onInstance(): Promise<void>;
|
|
execute(): Promise<void>;
|
|
[key: string]: any;
|
|
};
|
|
|
|
export type TaskResult = {
|
|
clearLastStatus?: boolean;
|
|
};
|
|
export abstract class AbstractTaskPlugin implements ITaskPlugin {
|
|
result: TaskResult = {};
|
|
clearLastStatus() {
|
|
this.result.clearLastStatus = true;
|
|
}
|
|
async onInstance(): Promise<void> {
|
|
return;
|
|
}
|
|
abstract execute(): Promise<void>;
|
|
}
|
|
|
|
export type OutputVO = {
|
|
key: string;
|
|
title: string;
|
|
value: any;
|
|
};
|