@certd/pipeline 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/LICENSE +661 -0
- package/dist/bundle.js +8 -0
- package/dist/d/access/api.d.ts +16 -0
- package/dist/d/access/decorator.d.ts +5 -0
- package/{src/plugin/index.ts → dist/d/access/index.d.ts} +3 -3
- package/dist/d/access/registry.d.ts +2 -0
- package/{src/context/index.ts → dist/d/context/index.d.ts} +5 -6
- package/dist/d/core/context.d.ts +32 -0
- package/dist/d/core/executor.d.ts +32 -0
- package/{src/core/index.ts → dist/d/core/index.d.ts} +4 -4
- package/dist/d/core/run-history.d.ts +39 -0
- package/dist/d/core/storage.d.ts +30 -0
- package/dist/d/d.ts/fast-crud.d.ts +107 -0
- package/{src/d.ts/index.ts → dist/d/d.ts/index.d.ts} +2 -2
- package/dist/d/d.ts/pipeline.d.ts +103 -0
- package/dist/d/decorator/common.d.ts +6 -0
- package/{src/decorator/index.ts → dist/d/decorator/index.d.ts} +2 -2
- package/dist/d/decorator/utils.d.ts +11 -0
- package/{src/index.ts → dist/d/index.d.ts} +9 -9
- package/dist/d/midway/configuration.d.ts +8 -0
- package/dist/d/midway/index.d.ts +1 -0
- package/dist/d/plugin/api.d.ts +48 -0
- package/dist/d/plugin/decorator.d.ts +7 -0
- package/{src/access/index.ts → dist/d/plugin/index.d.ts} +3 -3
- package/{src/plugin/registry.ts → dist/d/plugin/registry.d.ts} +3 -4
- package/dist/d/plugin/test/echo-plugin.d.ts +8 -0
- package/{src/registry/index.ts → dist/d/registry/index.d.ts} +1 -1
- package/dist/d/registry/registry.d.ts +26 -0
- package/dist/d/utils/index.d.ts +6 -0
- package/dist/d/utils/util.log.d.ts +4 -0
- package/dist/d/utils/util.request.d.ts +1 -0
- package/dist/d/utils/util.sleep.d.ts +1 -0
- package/dist/pipeline.mjs +11 -0
- package/dist/pipeline.umd.js +1 -0
- package/package.json +34 -42
- package/rollup.config.js +39 -0
- package/test/echo-plugin.ts +1 -4
- package/tsconfig.json +7 -4
- package/vite.config.js +30 -6
- package/src/access/api.ts +0 -18
- package/src/access/decorator.ts +0 -39
- package/src/access/registry.ts +0 -4
- package/src/core/context.ts +0 -88
- package/src/core/executor.ts +0 -207
- package/src/core/run-history.ts +0 -158
- package/src/core/storage.ts +0 -140
- package/src/d.ts/fast-crud.ts +0 -115
- package/src/d.ts/pipeline.ts +0 -119
- package/src/decorator/common.ts +0 -17
- package/src/decorator/utils.ts +0 -42
- package/src/midway/configuration.ts +0 -52
- package/src/midway/index.ts +0 -5
- package/src/plugin/api.ts +0 -60
- package/src/plugin/decorator.ts +0 -63
- package/src/plugin/test/echo-plugin.ts +0 -31
- package/src/registry/registry.ts +0 -57
- package/src/utils/index.ts +0 -7
- package/src/utils/util.log.ts +0 -35
- package/src/utils/util.request.ts +0 -58
- package/src/utils/util.sleep.ts +0 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Registrable } from "../registry";
|
|
2
|
+
import { FormItemProps } from "../d.ts";
|
|
3
|
+
export type AccessInputDefine = FormItemProps & {
|
|
4
|
+
title: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type AccessDefine = Registrable & {
|
|
8
|
+
input?: {
|
|
9
|
+
[key: string]: AccessInputDefine;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export interface IAccessService {
|
|
13
|
+
getById(id: any): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
export interface IAccess {
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AccessDefine, AccessInputDefine } from "./api";
|
|
2
|
+
export declare const ACCESS_CLASS_KEY = "pipeline:access";
|
|
3
|
+
export declare const ACCESS_INPUT_KEY = "pipeline:access:input";
|
|
4
|
+
export declare function IsAccess(define: AccessDefine): ClassDecorator;
|
|
5
|
+
export declare function AccessInput(input?: AccessInputDefine): PropertyDecorator;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./registry";
|
|
3
|
-
export * from "./decorator";
|
|
1
|
+
export * from "./api";
|
|
2
|
+
export * from "./registry";
|
|
3
|
+
export * from "./decorator";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios";
|
|
2
|
-
import { IContext } from "../core";
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type PipelineContext = IContext;
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { IContext } from "../core";
|
|
3
|
+
export type HttpClient = AxiosInstance;
|
|
4
|
+
export type UserContext = IContext;
|
|
5
|
+
export type PipelineContext = IContext;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IStorage } from "./storage";
|
|
2
|
+
export interface IContext {
|
|
3
|
+
getInt(key: string): Promise<number>;
|
|
4
|
+
get(key: string): Promise<string | null>;
|
|
5
|
+
set(key: string, value: string): Promise<void>;
|
|
6
|
+
getObj<T = any>(key: string): Promise<T | null>;
|
|
7
|
+
setObj<T = any>(key: string, value: T): Promise<void>;
|
|
8
|
+
updateVersion(): Promise<void>;
|
|
9
|
+
initVersion(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class ContextFactory {
|
|
12
|
+
storage: IStorage;
|
|
13
|
+
memoryStorage: IStorage;
|
|
14
|
+
constructor(storage: IStorage);
|
|
15
|
+
getContext(scope: string, namespace: string): IContext;
|
|
16
|
+
getMemoryContext(scope: string, namespace: string): IContext;
|
|
17
|
+
}
|
|
18
|
+
export declare class StorageContext implements IContext {
|
|
19
|
+
storage: IStorage;
|
|
20
|
+
namespace: string;
|
|
21
|
+
scope: string;
|
|
22
|
+
_version: number;
|
|
23
|
+
_initialVersion: number;
|
|
24
|
+
constructor(scope: string, namespace: string, storage: IStorage);
|
|
25
|
+
initVersion(): Promise<void>;
|
|
26
|
+
updateVersion(): Promise<void>;
|
|
27
|
+
get(key: string): Promise<string | null>;
|
|
28
|
+
set(key: string, value: string): Promise<void>;
|
|
29
|
+
getInt(key: string): Promise<number>;
|
|
30
|
+
getObj<T = any>(key: string): Promise<T | null>;
|
|
31
|
+
setObj<T = any>(key: string, value: T): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Pipeline, ResultType, Runnable, Stage } from "../d.ts";
|
|
2
|
+
import { RunHistory, RunnableCollection } from "./run-history";
|
|
3
|
+
import { ContextFactory, IContext } from "./context";
|
|
4
|
+
import { IStorage } from "./storage";
|
|
5
|
+
import { Logger } from "log4js";
|
|
6
|
+
import { IAccessService } from "../access";
|
|
7
|
+
export declare class Executor {
|
|
8
|
+
userId: any;
|
|
9
|
+
pipeline: Pipeline;
|
|
10
|
+
runtime: RunHistory;
|
|
11
|
+
accessService: IAccessService;
|
|
12
|
+
contextFactory: ContextFactory;
|
|
13
|
+
logger: Logger;
|
|
14
|
+
pipelineContext: IContext;
|
|
15
|
+
lastStatusMap: RunnableCollection;
|
|
16
|
+
onChanged: (history: RunHistory) => void;
|
|
17
|
+
constructor(options: {
|
|
18
|
+
userId: any;
|
|
19
|
+
pipeline: Pipeline;
|
|
20
|
+
storage: IStorage;
|
|
21
|
+
onChanged: (history: RunHistory) => Promise<void>;
|
|
22
|
+
accessService: IAccessService;
|
|
23
|
+
});
|
|
24
|
+
init(): Promise<void>;
|
|
25
|
+
run(runtimeId: any, triggerType: string): Promise<void>;
|
|
26
|
+
runWithHistory(runnable: Runnable, runnableType: string, run: () => Promise<void>): Promise<ResultType.success | ResultType.skip>;
|
|
27
|
+
private runStages;
|
|
28
|
+
runStage(stage: Stage): Promise<ResultType.success | ResultType.error>;
|
|
29
|
+
compositionResultType(resList: ResultType[]): ResultType.success | ResultType.error;
|
|
30
|
+
private runTask;
|
|
31
|
+
private runStep;
|
|
32
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./executor";
|
|
2
|
-
export * from "./run-history";
|
|
3
|
-
export * from "./context";
|
|
4
|
-
export * from "./storage";
|
|
1
|
+
export * from "./executor";
|
|
2
|
+
export * from "./run-history";
|
|
3
|
+
export * from "./context";
|
|
4
|
+
export * from "./storage";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Context, HistoryResult, Pipeline, Runnable } from "../d.ts";
|
|
2
|
+
import { Logger } from "log4js";
|
|
3
|
+
export type HistoryStatus = {
|
|
4
|
+
result: HistoryResult;
|
|
5
|
+
logs: string[];
|
|
6
|
+
};
|
|
7
|
+
export type RunTrigger = {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function NewRunHistory(obj: any): RunHistory;
|
|
11
|
+
export declare class RunHistory {
|
|
12
|
+
id: string;
|
|
13
|
+
context: Context;
|
|
14
|
+
pipeline: Pipeline;
|
|
15
|
+
logs: {
|
|
16
|
+
[runnableId: string]: string[];
|
|
17
|
+
};
|
|
18
|
+
_loggers: {
|
|
19
|
+
[runnableId: string]: Logger;
|
|
20
|
+
};
|
|
21
|
+
trigger: RunTrigger;
|
|
22
|
+
constructor(runtimeId: any, trigger: RunTrigger, pipeline: Pipeline);
|
|
23
|
+
start(runnable: Runnable): HistoryResult;
|
|
24
|
+
success(runnable: Runnable): void;
|
|
25
|
+
skip(runnable: Runnable): void;
|
|
26
|
+
error(runnable: Runnable, e: Error): void;
|
|
27
|
+
log(runnable: Runnable, text: string): void;
|
|
28
|
+
logError(runnable: Runnable, e: Error): void;
|
|
29
|
+
finally(runnable: Runnable): void;
|
|
30
|
+
}
|
|
31
|
+
export declare class RunnableCollection {
|
|
32
|
+
private collection;
|
|
33
|
+
private pipeline;
|
|
34
|
+
constructor(pipeline?: Pipeline);
|
|
35
|
+
private each;
|
|
36
|
+
private toMap;
|
|
37
|
+
get(id: string): Runnable | undefined;
|
|
38
|
+
clear(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface IStorage {
|
|
2
|
+
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
|
3
|
+
set(scope: string, namespace: string, version: string, key: string, value: string): Promise<void>;
|
|
4
|
+
remove(scope: string, namespace: string, version: string, key: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare class FileStorage implements IStorage {
|
|
7
|
+
root: string;
|
|
8
|
+
constructor(rootDir?: string);
|
|
9
|
+
remove(scope: string, namespace: string, version: string, key: string): Promise<void>;
|
|
10
|
+
writeFile(filePath: string, value: string): string;
|
|
11
|
+
readFile(filePath: string): string | null;
|
|
12
|
+
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
|
13
|
+
set(scope: string, namespace: string, version: string, key: string, value: string): Promise<void>;
|
|
14
|
+
private buildPath;
|
|
15
|
+
}
|
|
16
|
+
export declare class MemoryStorage implements IStorage {
|
|
17
|
+
/**
|
|
18
|
+
* 范围: user / pipeline / runtime / task
|
|
19
|
+
*/
|
|
20
|
+
scope: any;
|
|
21
|
+
namespace: any;
|
|
22
|
+
context: {
|
|
23
|
+
[scope: string]: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
|
28
|
+
set(scope: string, namespace: string, version: string, key: string, value: string): Promise<void>;
|
|
29
|
+
remove(scope: string, namespace?: string, version?: string, key?: string): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [x]-col的配置
|
|
3
|
+
*/
|
|
4
|
+
export type ColProps = {
|
|
5
|
+
span?: number;
|
|
6
|
+
[props: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export type FormItemProps = {
|
|
9
|
+
/**
|
|
10
|
+
* 字段label
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 表单字段组件配置
|
|
15
|
+
*/
|
|
16
|
+
component?: ComponentProps;
|
|
17
|
+
/**
|
|
18
|
+
* 表单字段 [a|el|n]-col的配置
|
|
19
|
+
* 一般用来配置跨列:{span:24} 占满一行
|
|
20
|
+
*/
|
|
21
|
+
col?: ColProps;
|
|
22
|
+
/**
|
|
23
|
+
* 默认值
|
|
24
|
+
*/
|
|
25
|
+
value?: any;
|
|
26
|
+
/**
|
|
27
|
+
* 帮助提示配置
|
|
28
|
+
*/
|
|
29
|
+
helper?: string | FormItemHelperProps;
|
|
30
|
+
/**
|
|
31
|
+
* 排序号
|
|
32
|
+
*/
|
|
33
|
+
order?: number;
|
|
34
|
+
/**
|
|
35
|
+
* 是否显示此字段
|
|
36
|
+
*/
|
|
37
|
+
show?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 是否是空白占位栏
|
|
40
|
+
*/
|
|
41
|
+
blank?: boolean;
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* 表单字段帮助说明配置
|
|
46
|
+
*/
|
|
47
|
+
export type FormItemHelperProps = {
|
|
48
|
+
/**
|
|
49
|
+
* 自定义渲染帮助说明
|
|
50
|
+
* @param scope
|
|
51
|
+
*/
|
|
52
|
+
render?: (scope: any) => any;
|
|
53
|
+
/**
|
|
54
|
+
* 帮助文本
|
|
55
|
+
*/
|
|
56
|
+
text?: string;
|
|
57
|
+
/**
|
|
58
|
+
* 帮助说明所在的位置,[ undefined | label]
|
|
59
|
+
*/
|
|
60
|
+
position?: string;
|
|
61
|
+
/**
|
|
62
|
+
* [a|el|n]-tooltip配置
|
|
63
|
+
*/
|
|
64
|
+
tooltip?: object;
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* 组件配置
|
|
69
|
+
*/
|
|
70
|
+
export type ComponentProps = {
|
|
71
|
+
/**
|
|
72
|
+
* 组件的名称
|
|
73
|
+
*/
|
|
74
|
+
name?: string | object;
|
|
75
|
+
/**
|
|
76
|
+
* vmodel绑定的目标属性名
|
|
77
|
+
*/
|
|
78
|
+
vModel?: string;
|
|
79
|
+
/**
|
|
80
|
+
* 当原始组件名的参数被以上属性名占用时,可以配置在这里
|
|
81
|
+
* 例如:原始组件有一个叫name的属性,你想要配置它,则可以按如下配置
|
|
82
|
+
* ```
|
|
83
|
+
* component:{
|
|
84
|
+
* name:"组件的名称"
|
|
85
|
+
* props:{
|
|
86
|
+
* name:"组件的name属性" <-----------
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
props?: {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* 组件事件监听
|
|
96
|
+
*/
|
|
97
|
+
on?: {
|
|
98
|
+
[key: string]: (context?: any) => void;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* 组件其他参数
|
|
102
|
+
* 事件:onXxx:(event)=>void 组件原始事件监听
|
|
103
|
+
* on.onXxx:(context)=>void 组件事件监听(对原始事件包装)
|
|
104
|
+
* 样式:style、class等
|
|
105
|
+
*/
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./pipeline";
|
|
2
|
-
export * from "./fast-crud";
|
|
1
|
+
export * from "./pipeline";
|
|
2
|
+
export * from "./fast-crud";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export declare enum RunStrategy {
|
|
2
|
+
AlwaysRun = 0,
|
|
3
|
+
SkipWhenSucceed = 1
|
|
4
|
+
}
|
|
5
|
+
export declare enum ConcurrencyStrategy {
|
|
6
|
+
Serial = 0,
|
|
7
|
+
Parallel = 1
|
|
8
|
+
}
|
|
9
|
+
export declare enum NextStrategy {
|
|
10
|
+
AllSuccess = 0,
|
|
11
|
+
OneSuccess = 1
|
|
12
|
+
}
|
|
13
|
+
export declare enum HandlerType {
|
|
14
|
+
ClearFollowStatus = 0,
|
|
15
|
+
SendEmail = 1
|
|
16
|
+
}
|
|
17
|
+
export type EventHandler = {
|
|
18
|
+
type: HandlerType;
|
|
19
|
+
params: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type RunnableStrategy = {
|
|
24
|
+
runStrategy?: RunStrategy;
|
|
25
|
+
onSuccess?: EventHandler[];
|
|
26
|
+
onError?: EventHandler[];
|
|
27
|
+
};
|
|
28
|
+
export type Step = Runnable & {
|
|
29
|
+
type: string;
|
|
30
|
+
input: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type Task = Runnable & {
|
|
35
|
+
steps: Step[];
|
|
36
|
+
};
|
|
37
|
+
export type Stage = Runnable & {
|
|
38
|
+
tasks: Task[];
|
|
39
|
+
concurrency: ConcurrencyStrategy;
|
|
40
|
+
next: NextStrategy;
|
|
41
|
+
};
|
|
42
|
+
export type Trigger = {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
cron: string;
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
export type Runnable = {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
strategy?: RunnableStrategy;
|
|
52
|
+
runnableType?: string;
|
|
53
|
+
status?: HistoryResult;
|
|
54
|
+
default?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type Pipeline = Runnable & {
|
|
59
|
+
version?: number;
|
|
60
|
+
userId: any;
|
|
61
|
+
stages: Stage[];
|
|
62
|
+
triggers: Trigger[];
|
|
63
|
+
};
|
|
64
|
+
export type Context = {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
};
|
|
67
|
+
export type Log = {
|
|
68
|
+
title: string;
|
|
69
|
+
time: number;
|
|
70
|
+
level: string;
|
|
71
|
+
text: string;
|
|
72
|
+
};
|
|
73
|
+
export declare enum ResultType {
|
|
74
|
+
start = "start",
|
|
75
|
+
success = "success",
|
|
76
|
+
error = "error",
|
|
77
|
+
skip = "skip",
|
|
78
|
+
none = "none"
|
|
79
|
+
}
|
|
80
|
+
export type HistoryResultGroup = {
|
|
81
|
+
[key: string]: {
|
|
82
|
+
runnable: Runnable;
|
|
83
|
+
res: HistoryResult;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type HistoryResult = {
|
|
87
|
+
input: any;
|
|
88
|
+
output: any;
|
|
89
|
+
/**
|
|
90
|
+
* 任务状态
|
|
91
|
+
*/
|
|
92
|
+
status: ResultType;
|
|
93
|
+
startTime: number;
|
|
94
|
+
endTime?: number;
|
|
95
|
+
/**
|
|
96
|
+
* 处理结果
|
|
97
|
+
*/
|
|
98
|
+
result?: ResultType;
|
|
99
|
+
message?: string;
|
|
100
|
+
};
|
|
101
|
+
export type RunnableMap = {
|
|
102
|
+
[id: string]: Runnable;
|
|
103
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./utils";
|
|
2
|
-
export * from "./common";
|
|
1
|
+
export * from "./utils";
|
|
2
|
+
export * from "./common";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function attachProperty(target: any, propertyKey: string | symbol): void;
|
|
2
|
+
declare function getClassProperties(target: any): any;
|
|
3
|
+
declare function target(target: any, propertyKey?: string | symbol): any;
|
|
4
|
+
declare function inject(define: any, instance: any, context: any, preHandler?: (item: any, key: string, instance: any, context: any) => void): void;
|
|
5
|
+
export declare const Decorator: {
|
|
6
|
+
target: typeof target;
|
|
7
|
+
attachProperty: typeof attachProperty;
|
|
8
|
+
getClassProperties: typeof getClassProperties;
|
|
9
|
+
inject: typeof inject;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./core";
|
|
2
|
-
export * from "./d.ts";
|
|
3
|
-
export * from "./access";
|
|
4
|
-
export * from "./registry";
|
|
5
|
-
export * from "./plugin";
|
|
6
|
-
export * from "./utils";
|
|
7
|
-
export * from "./midway";
|
|
8
|
-
export * from "./context";
|
|
9
|
-
export * from "./decorator";
|
|
1
|
+
export * from "./core";
|
|
2
|
+
export * from "./d.ts";
|
|
3
|
+
export * from "./access";
|
|
4
|
+
export * from "./registry";
|
|
5
|
+
export * from "./plugin";
|
|
6
|
+
export * from "./utils";
|
|
7
|
+
export * from "./midway";
|
|
8
|
+
export * from "./context";
|
|
9
|
+
export * from "./decorator";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ILogger } from "@midwayjs/logger";
|
|
2
|
+
import { IMidwayContainer, MidwayDecoratorService } from "@midwayjs/core";
|
|
3
|
+
export declare class PipelineConfiguration {
|
|
4
|
+
config: any;
|
|
5
|
+
logger: ILogger;
|
|
6
|
+
decoratorService: MidwayDecoratorService;
|
|
7
|
+
onReady(container: IMidwayContainer): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PipelineConfiguration } from "./configuration";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Registrable } from "../registry";
|
|
2
|
+
import { FormItemProps } from "../d.ts";
|
|
3
|
+
export declare enum ContextScope {
|
|
4
|
+
global = 0,
|
|
5
|
+
pipeline = 1,
|
|
6
|
+
runtime = 2
|
|
7
|
+
}
|
|
8
|
+
export type Storage = {
|
|
9
|
+
scope: ContextScope;
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
export type TaskOutputDefine = {
|
|
13
|
+
title: string;
|
|
14
|
+
value?: any;
|
|
15
|
+
storage?: Storage;
|
|
16
|
+
};
|
|
17
|
+
export type TaskInputDefine = FormItemProps;
|
|
18
|
+
export type PluginDefine = Registrable & {
|
|
19
|
+
default?: any;
|
|
20
|
+
input?: {
|
|
21
|
+
[key: string]: TaskInputDefine;
|
|
22
|
+
};
|
|
23
|
+
output?: {
|
|
24
|
+
[key: string]: TaskOutputDefine;
|
|
25
|
+
};
|
|
26
|
+
autowire?: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type ITaskPlugin = {
|
|
31
|
+
onInstance(): Promise<void>;
|
|
32
|
+
execute(): Promise<void>;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
export type TaskResult = {
|
|
36
|
+
clearLastStatus?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare abstract class AbstractTaskPlugin implements ITaskPlugin {
|
|
39
|
+
result: TaskResult;
|
|
40
|
+
clearLastStatus(): void;
|
|
41
|
+
onInstance(): Promise<void>;
|
|
42
|
+
abstract execute(): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export type OutputVO = {
|
|
45
|
+
key: string;
|
|
46
|
+
title: string;
|
|
47
|
+
value: any;
|
|
48
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api";
|
|
2
|
+
export declare const PLUGIN_CLASS_KEY = "pipeline:plugin";
|
|
3
|
+
export declare function IsTaskPlugin(define: PluginDefine): ClassDecorator;
|
|
4
|
+
export declare const PLUGIN_INPUT_KEY = "pipeline:plugin:input";
|
|
5
|
+
export declare function TaskInput(input?: TaskInputDefine): PropertyDecorator;
|
|
6
|
+
export declare const PLUGIN_OUTPUT_KEY = "pipeline:plugin:output";
|
|
7
|
+
export declare function TaskOutput(output?: TaskOutputDefine): PropertyDecorator;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./registry";
|
|
3
|
-
export * from "./decorator";
|
|
1
|
+
export * from "./api";
|
|
2
|
+
export * from "./registry";
|
|
3
|
+
export * from "./decorator";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Registry } from "../registry";
|
|
2
|
-
import { AbstractTaskPlugin } from "./api";
|
|
3
|
-
|
|
4
|
-
export const pluginRegistry = new Registry<AbstractTaskPlugin>();
|
|
1
|
+
import { Registry } from "../registry";
|
|
2
|
+
import { AbstractTaskPlugin } from "./api";
|
|
3
|
+
export declare const pluginRegistry: Registry<AbstractTaskPlugin>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./registry";
|
|
1
|
+
export * from "./registry";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type Registrable = {
|
|
2
|
+
name: string;
|
|
3
|
+
title: string;
|
|
4
|
+
desc?: string;
|
|
5
|
+
};
|
|
6
|
+
export type RegistryItem<T> = {
|
|
7
|
+
define: Registrable;
|
|
8
|
+
target: T;
|
|
9
|
+
};
|
|
10
|
+
export declare class Registry<T> {
|
|
11
|
+
storage: {
|
|
12
|
+
[key: string]: RegistryItem<T>;
|
|
13
|
+
};
|
|
14
|
+
register(key: string, value: RegistryItem<T>): void;
|
|
15
|
+
get(name: string): RegistryItem<T>;
|
|
16
|
+
getStorage(): {
|
|
17
|
+
[key: string]: RegistryItem<T>;
|
|
18
|
+
};
|
|
19
|
+
getDefineList(): {
|
|
20
|
+
key: string;
|
|
21
|
+
name: string;
|
|
22
|
+
title: string;
|
|
23
|
+
desc?: string | undefined;
|
|
24
|
+
}[];
|
|
25
|
+
getDefine(key: string): Registrable | undefined;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const request: import("axios").AxiosInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (timeout: number): Promise<unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
2
|
+
const r = require("tslib");
|
|
3
|
+
r.__exportStar(require("./core"), exports);
|
|
4
|
+
r.__exportStar(require("./d.ts"), exports);
|
|
5
|
+
r.__exportStar(require("./access"), exports);
|
|
6
|
+
r.__exportStar(require("./registry"), exports);
|
|
7
|
+
r.__exportStar(require("./plugin"), exports);
|
|
8
|
+
r.__exportStar(require("./utils"), exports);
|
|
9
|
+
r.__exportStar(require("./midway"), exports);
|
|
10
|
+
r.__exportStar(require("./context"), exports);
|
|
11
|
+
r.__exportStar(require("./decorator"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e){typeof define=="function"&&define.amd?define(e):e()})(function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("tslib");e.__exportStar(require("./core"),exports),e.__exportStar(require("./d.ts"),exports),e.__exportStar(require("./access"),exports),e.__exportStar(require("./registry"),exports),e.__exportStar(require("./plugin"),exports),e.__exportStar(require("./utils"),exports),e.__exportStar(require("./midway"),exports),e.__exportStar(require("./context"),exports),e.__exportStar(require("./decorator"),exports)});
|