@certd/pipeline 1.0.3 → 1.0.4

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.
@@ -1,103 +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
+ 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,6 +1,6 @@
1
- export type AutowireProp = {
2
- name?: string;
3
- type?: any;
4
- };
5
- export declare const AUTOWIRE_KEY = "pipeline:autowire";
6
- export declare function Autowire(props?: AutowireProp): PropertyDecorator;
1
+ export type AutowireProp = {
2
+ name?: string;
3
+ type?: any;
4
+ };
5
+ export declare const AUTOWIRE_KEY = "pipeline:autowire";
6
+ export declare function Autowire(props?: AutowireProp): PropertyDecorator;
@@ -1,2 +1,2 @@
1
- export * from "./utils";
2
- export * from "./common";
1
+ export * from "./utils";
2
+ export * from "./common";
@@ -1,11 +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
+ 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 {};
package/dist/d/index.d.ts CHANGED
@@ -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
+ import "util";
2
+ export * from "./core";
3
+ export * from "./d.ts";
4
+ export * from "./access";
5
+ export * from "./registry";
6
+ export * from "./plugin";
7
+ export * from "./utils";
8
+ export * from "./context";
9
+ export * from "./decorator";
@@ -1,48 +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
- };
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
+ };
@@ -1,7 +1,8 @@
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
+ import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api";
2
+ import "reflect-metadata";
3
+ export declare const PLUGIN_CLASS_KEY = "pipeline:plugin";
4
+ export declare function IsTaskPlugin(define: PluginDefine): ClassDecorator;
5
+ export declare const PLUGIN_INPUT_KEY = "pipeline:plugin:input";
6
+ export declare function TaskInput(input?: TaskInputDefine): PropertyDecorator;
7
+ export declare const PLUGIN_OUTPUT_KEY = "pipeline:plugin:output";
8
+ 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,3 +1,3 @@
1
- import { Registry } from "../registry";
2
- import { AbstractTaskPlugin } from "./api";
3
- export declare const pluginRegistry: Registry<AbstractTaskPlugin>;
1
+ import { Registry } from "../registry";
2
+ import { AbstractTaskPlugin } from "./api";
3
+ export declare const pluginRegistry: Registry<AbstractTaskPlugin>;
@@ -1,8 +1,6 @@
1
- import { ILogger } from "@midwayjs/logger";
2
- import { ITaskPlugin } from "../api";
3
- export declare class EchoPlugin implements ITaskPlugin {
4
- test?: string;
5
- logger: ILogger;
6
- onInstance(): Promise<void>;
7
- execute(): Promise<void>;
8
- }
1
+ import { ITaskPlugin } from "../api";
2
+ export declare class EchoPlugin implements ITaskPlugin {
3
+ test?: string;
4
+ onInstance(): Promise<void>;
5
+ execute(): Promise<void>;
6
+ }
@@ -1 +1 @@
1
- export * from "./registry";
1
+ export * from "./registry";
@@ -1,26 +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
- }
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
+ }
@@ -1,6 +1,6 @@
1
- import sleep from "./util.sleep";
2
- export * from "./util.log";
3
- export declare const utils: {
4
- sleep: typeof sleep;
5
- http: import("axios").AxiosInstance;
6
- };
1
+ import sleep from "./util.sleep";
2
+ export * from "./util.log";
3
+ export declare const utils: {
4
+ sleep: typeof sleep;
5
+ http: import("axios").AxiosInstance;
6
+ };
@@ -1,4 +1,4 @@
1
- import log4js, { Logger } from "log4js";
2
- export declare const logger: log4js.Logger;
3
- export declare function buildLogger(write: (text: string) => void): log4js.Logger;
4
- export type ILogger = Logger;
1
+ import log4js, { Logger } from "log4js";
2
+ export declare const logger: log4js.Logger;
3
+ export declare function buildLogger(write: (text: string) => void): log4js.Logger;
4
+ export type ILogger = Logger;
@@ -1 +1 @@
1
- export declare const request: import("axios").AxiosInstance;
1
+ export declare const request: import("axios").AxiosInstance;
@@ -1 +1 @@
1
- export default function (timeout: number): Promise<unknown>;
1
+ export default function (timeout: number): Promise<unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@certd/pipeline",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "main": "./dist/bundle.js",
6
6
  "module": "./dist/pipeline.mjs",
7
7
  "types": "./dist/d/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "qs": "^6.11.2"
18
18
  },
19
19
  "devDependencies": {
20
- "@certd/acme-client": "^1.0.3",
20
+ "@certd/acme-client": "^1.0.4",
21
21
  "@rollup/plugin-commonjs": "^23.0.4",
22
22
  "@rollup/plugin-json": "^6.0.0",
23
23
  "@rollup/plugin-node-resolve": "^15.0.1",
@@ -49,5 +49,5 @@
49
49
  "vite": "^4.3.8",
50
50
  "vue-tsc": "^1.6.5"
51
51
  },
52
- "gitHead": "a43c5b0824d2cb19a731c16f62c5e7464f6635d6"
52
+ "gitHead": "420b835b09af99d9e583c5fac700792994539eb8"
53
53
  }
package/rollup.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const resolve = require("@rollup/plugin-node-resolve");
2
2
  const commonjs = require("@rollup/plugin-commonjs");
3
- const rollupTypescript = require("rollup-plugin-typescript2");
3
+ //const Typescript = require("rollup-plugin-typescript2");
4
+ const Typescript = require("@rollup/plugin-typescript");
4
5
  const json = require("@rollup/plugin-json");
5
6
  const terser = require("@rollup/plugin-terser");
6
7
  module.exports = {
@@ -14,7 +15,14 @@ module.exports = {
14
15
  resolve(),
15
16
  // 识别 commonjs 模式第三方依赖
16
17
  commonjs(),
17
- rollupTypescript(),
18
+ Typescript({
19
+ target: "esnext",
20
+ rootDir: "src",
21
+ declaration: true,
22
+ declarationDir: "dist/d",
23
+ exclude: ["./node_modules/**", "./src/**/*.vue"],
24
+ allowSyntheticDefaultImports: true,
25
+ }),
18
26
  json(),
19
27
  terser(),
20
28
  ],
@@ -31,9 +39,5 @@ module.exports = {
31
39
  "@certd/plugin-host",
32
40
  "@certd/plugin-tencent",
33
41
  "@certd/plugin-util",
34
- "log4js",
35
- "@midwayjs/core",
36
- "@midwayjs/decorator",
37
- "reflect-metadata",
38
42
  ],
39
43
  };
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src";