@ldsg/workflow 0.2.10 → 0.2.12
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/dist/__tests__/unit/resource.js +24 -84
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +12 -18
- package/dist/types/{workflow-edge-info.d.ts → edge.d.ts} +1 -1
- package/dist/types/edge.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -5
- package/dist/types/node.d.ts +43 -0
- package/dist/types/node.d.ts.map +1 -0
- package/dist/types/variables.d.ts +18 -0
- package/dist/types/variables.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +28 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/utils/get-workflow-output-variables.d.ts +10 -0
- package/dist/utils/get-workflow-output-variables.d.ts.map +1 -0
- package/dist/utils/get-workflow-output-variables.js +12 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +5 -5
- package/dist/types/node-variables.d.ts +0 -4
- package/dist/types/node-variables.d.ts.map +0 -1
- package/dist/types/workflow-data.d.ts +0 -7
- package/dist/types/workflow-data.d.ts.map +0 -1
- package/dist/types/workflow-edge-info.d.ts.map +0 -1
- package/dist/types/workflow-info.d.ts +0 -13
- package/dist/types/workflow-info.d.ts.map +0 -1
- package/dist/types/workflow-node-info.d.ts +0 -53
- package/dist/types/workflow-node-info.d.ts.map +0 -1
- package/dist/types/workflow-node-info.js +0 -25
- package/dist/utils/get-end-node-output-variables.d.ts +0 -10
- package/dist/utils/get-end-node-output-variables.d.ts.map +0 -1
- package/dist/utils/get-end-node-output-variables.js +0 -12
- /package/dist/types/{node-variables.js → edge.js} +0 -0
- /package/dist/types/{workflow-data.js → node.js} +0 -0
- /package/dist/types/{workflow-edge-info.js → variables.js} +0 -0
- /package/dist/types/{workflow-info.js → workflow.js} +0 -0
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../../constants");
|
|
4
3
|
const resource_1 = require("../../resource");
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const getWorkflowNodeExecute = (params) => {
|
|
5
|
+
const { id } = params;
|
|
6
|
+
const res = async (params) => {
|
|
7
|
+
const res = {
|
|
8
|
+
variables: `hello, ${id}`,
|
|
9
|
+
};
|
|
10
|
+
return res;
|
|
11
|
+
};
|
|
12
|
+
return res;
|
|
13
|
+
};
|
|
14
|
+
const nodeIdList = ["1", "2", "3", "4", "5"];
|
|
15
|
+
const nodes = nodeIdList.map((id) => {
|
|
16
|
+
const res = {
|
|
17
|
+
id,
|
|
18
|
+
execute: getWorkflowNodeExecute({ id }),
|
|
19
|
+
};
|
|
20
|
+
return res;
|
|
21
|
+
});
|
|
22
|
+
class TestWorkflowResource extends resource_1.WorkflowResource {
|
|
7
23
|
constructor() {
|
|
8
24
|
super(...arguments);
|
|
9
25
|
this.getWorkflowData = () => {
|
|
@@ -26,83 +42,7 @@ class AWorkflowResource extends resource_1.WorkflowResource {
|
|
|
26
42
|
targetWorkflowNodeResourceId: "5",
|
|
27
43
|
},
|
|
28
44
|
],
|
|
29
|
-
nodes
|
|
30
|
-
{
|
|
31
|
-
id: "1",
|
|
32
|
-
workflowNodeTypeResourceId: constants_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.start,
|
|
33
|
-
Executer: class AWorkflowNodeExecuter extends types_1.WorkflowNodeExecuter {
|
|
34
|
-
constructor() {
|
|
35
|
-
super(...arguments);
|
|
36
|
-
this.execute = async () => {
|
|
37
|
-
const { setVariables } = this;
|
|
38
|
-
setVariables({
|
|
39
|
-
variables: "abc",
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: "2",
|
|
47
|
-
workflowNodeTypeResourceId: "",
|
|
48
|
-
Executer: class AWorkflowNodeExecuter extends types_1.WorkflowNodeExecuter {
|
|
49
|
-
constructor() {
|
|
50
|
-
super(...arguments);
|
|
51
|
-
this.execute = async () => {
|
|
52
|
-
const { setVariables } = this;
|
|
53
|
-
setVariables({
|
|
54
|
-
variables: "def",
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "3",
|
|
62
|
-
workflowNodeTypeResourceId: "",
|
|
63
|
-
Executer: class AWorkflowNodeExecuter extends types_1.WorkflowNodeExecuter {
|
|
64
|
-
constructor() {
|
|
65
|
-
super(...arguments);
|
|
66
|
-
this.execute = async () => {
|
|
67
|
-
const { setVariables } = this;
|
|
68
|
-
setVariables({
|
|
69
|
-
variables: "ghi",
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: "4",
|
|
77
|
-
workflowNodeTypeResourceId: "",
|
|
78
|
-
Executer: class AWorkflowNodeExecuter extends types_1.WorkflowNodeExecuter {
|
|
79
|
-
constructor() {
|
|
80
|
-
super(...arguments);
|
|
81
|
-
this.execute = async () => {
|
|
82
|
-
const { setVariables } = this;
|
|
83
|
-
setVariables({
|
|
84
|
-
variables: "jkl",
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: "5",
|
|
92
|
-
workflowNodeTypeResourceId: constants_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.end,
|
|
93
|
-
Executer: class AWorkflowNodeExecuter extends types_1.WorkflowNodeExecuter {
|
|
94
|
-
constructor() {
|
|
95
|
-
super(...arguments);
|
|
96
|
-
this.execute = async () => {
|
|
97
|
-
const { setVariables } = this;
|
|
98
|
-
setVariables({
|
|
99
|
-
variables: "mno",
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
],
|
|
45
|
+
nodes,
|
|
106
46
|
};
|
|
107
47
|
const res = {
|
|
108
48
|
workflowData,
|
|
@@ -112,7 +52,7 @@ class AWorkflowResource extends resource_1.WorkflowResource {
|
|
|
112
52
|
}
|
|
113
53
|
}
|
|
114
54
|
test("WorkflowResource execute", async () => {
|
|
115
|
-
const
|
|
55
|
+
const testWorkflowResource = new TestWorkflowResource({
|
|
116
56
|
id: "test",
|
|
117
57
|
kind: "workflow",
|
|
118
58
|
parentId: "root",
|
|
@@ -123,10 +63,10 @@ test("WorkflowResource execute", async () => {
|
|
|
123
63
|
endWorkflowNodeResourceId: "5",
|
|
124
64
|
},
|
|
125
65
|
});
|
|
126
|
-
const {
|
|
127
|
-
|
|
66
|
+
const { variables } = await testWorkflowResource.execute({
|
|
67
|
+
variables: {
|
|
128
68
|
hello: "world",
|
|
129
69
|
},
|
|
130
70
|
});
|
|
131
|
-
expect(
|
|
71
|
+
expect(variables).toEqual("hello, 5");
|
|
132
72
|
});
|
package/dist/resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAGL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,gCAAgC,EAGjC,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;CAC1C;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,0BAA0B,CAAC;AAEvE,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;CAC1C;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,0BAA0B,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,gBAAiB,SAAQ,QAAQ,CAAC,gCAAgC,CAAC;IAC9E,uBAAuB,EAAE,uBAAuB,CA4B9C;IAEF,uBAAuB,EAAE,uBAAuB,CAsB9C;IAEF,eAAe,EAAE,eAAe,CAiB9B;IAEF,OAAO,EAAE,eAAe,CA0DtB;IAEF,eAAe,EAAE,eAAe,CAY9B;CACH"}
|
package/dist/resource.js
CHANGED
|
@@ -56,9 +56,9 @@ class WorkflowResource extends resource_1.Resource {
|
|
|
56
56
|
return res;
|
|
57
57
|
};
|
|
58
58
|
this.execute = async (params) => {
|
|
59
|
-
const {
|
|
59
|
+
const { variables: workflowInputVariables } = params;
|
|
60
60
|
const { getWorkflowData, settings: { startWorkflowNodeResourceId, endWorkflowNodeResourceId }, } = this;
|
|
61
|
-
const
|
|
61
|
+
const workflowVariablesMap = new Map();
|
|
62
62
|
const { workflowData } = getWorkflowData();
|
|
63
63
|
const { nodes } = workflowData;
|
|
64
64
|
const startNode = nodes.find((value) => value.id === startWorkflowNodeResourceId);
|
|
@@ -71,27 +71,21 @@ class WorkflowResource extends resource_1.Resource {
|
|
|
71
71
|
startNode,
|
|
72
72
|
endNode,
|
|
73
73
|
});
|
|
74
|
-
const
|
|
75
|
-
const { id,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
const executer = new Executer({
|
|
80
|
-
nodeId: id,
|
|
81
|
-
nodeIdToVariablesMap,
|
|
74
|
+
for (const node of orderedNodeList) {
|
|
75
|
+
const { id, execute } = node;
|
|
76
|
+
const workflowVariablesRecord = Object.fromEntries(workflowVariablesMap);
|
|
77
|
+
const executeRes = await execute({
|
|
82
78
|
...(id === startWorkflowNodeResourceId
|
|
83
|
-
? {
|
|
79
|
+
? { workflowInputVariables }
|
|
84
80
|
: {}),
|
|
81
|
+
workflowVariablesRecord,
|
|
85
82
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
for (const execute of executeList) {
|
|
90
|
-
await execute();
|
|
83
|
+
const { variables } = executeRes;
|
|
84
|
+
workflowVariablesMap.set(id, variables);
|
|
91
85
|
}
|
|
92
|
-
const res = (0, utils_1.
|
|
86
|
+
const res = (0, utils_1.getWorkflowOutputVariables)({
|
|
93
87
|
endNode,
|
|
94
|
-
|
|
88
|
+
workflowVariablesMap,
|
|
95
89
|
});
|
|
96
90
|
return res;
|
|
97
91
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/types/edge.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,sBAAsB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./edge";
|
|
2
|
+
export * from "./node";
|
|
2
3
|
export * from "./specific-resource-settings";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./workflow
|
|
5
|
-
export * from "./workflow-info";
|
|
6
|
-
export * from "./workflow-node-info";
|
|
4
|
+
export * from "./variables";
|
|
5
|
+
export * from "./workflow";
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -14,9 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./edge"), exports);
|
|
18
|
+
__exportStar(require("./node"), exports);
|
|
18
19
|
__exportStar(require("./specific-resource-settings"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./workflow
|
|
21
|
-
__exportStar(require("./workflow-info"), exports);
|
|
22
|
-
__exportStar(require("./workflow-node-info"), exports);
|
|
20
|
+
__exportStar(require("./variables"), exports);
|
|
21
|
+
__exportStar(require("./workflow"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WorkflowVariablesRecord } from "./variables";
|
|
2
|
+
export type WorkflowNodeExecuterExecute = () => void | Promise<void>;
|
|
3
|
+
export interface WorkflowNodeExecuteParams {
|
|
4
|
+
/**
|
|
5
|
+
* 工作流输入变量
|
|
6
|
+
* 用作于工作流开始节点的输入变量
|
|
7
|
+
*/
|
|
8
|
+
workflowInputVariables?: any;
|
|
9
|
+
/**
|
|
10
|
+
* 工作流变量记录
|
|
11
|
+
*/
|
|
12
|
+
workflowVariablesRecord: WorkflowVariablesRecord;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowNodeExecuteRes {
|
|
15
|
+
/**
|
|
16
|
+
* 工作流节点输出变量
|
|
17
|
+
*/
|
|
18
|
+
variables: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 工作流执行方法
|
|
22
|
+
* 工作执行时,实际运行的方法
|
|
23
|
+
*/
|
|
24
|
+
export type WorkflowNodeExecute = (params: WorkflowNodeExecuteParams) => Promise<WorkflowNodeExecuteRes>;
|
|
25
|
+
export interface WorkflowNodeInfo {
|
|
26
|
+
/**
|
|
27
|
+
* ID
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* 工作流节点执行方法
|
|
32
|
+
* 工作流节点执行时,实际运行的方法
|
|
33
|
+
*/
|
|
34
|
+
execute: WorkflowNodeExecute;
|
|
35
|
+
}
|
|
36
|
+
export interface GetWorkflowNodeInfoRes {
|
|
37
|
+
/**
|
|
38
|
+
* Workflow Node Info
|
|
39
|
+
*/
|
|
40
|
+
workflowNodeInfo: WorkflowNodeInfo;
|
|
41
|
+
}
|
|
42
|
+
export type GetWorkflowNodeInfo = () => GetWorkflowNodeInfoRes;
|
|
43
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/types/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,GAAG,CAAC;IAE7B;;OAEG;IACH,uBAAuB,EAAE,uBAAuB,CAAC;CAClD;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,yBAAyB,KAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作流变量
|
|
3
|
+
*/
|
|
4
|
+
export type WorkflowVariables = any;
|
|
5
|
+
/**
|
|
6
|
+
* 工作流变量映射
|
|
7
|
+
* key 为资源 ID,可以是工作流节点资源 ID,也可以是工作流资源 ID
|
|
8
|
+
*/
|
|
9
|
+
export type WorkflowVariablesMap = Map<string, WorkflowVariables>;
|
|
10
|
+
/**
|
|
11
|
+
* 工作流变量记录
|
|
12
|
+
*/
|
|
13
|
+
export type WorkflowVariablesRecord = Record<string, WorkflowVariables>;
|
|
14
|
+
export interface SetWorkflowVariablesParams {
|
|
15
|
+
variables: WorkflowVariables;
|
|
16
|
+
}
|
|
17
|
+
export type SetWorkflowVariables = (params: SetWorkflowVariablesParams) => void;
|
|
18
|
+
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/types/variables.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAExE,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WorkflowEdgeInfo } from "./edge";
|
|
2
|
+
import { WorkflowNodeInfo } from "./node";
|
|
3
|
+
import { WorkflowVariables } from "./variables";
|
|
4
|
+
export interface WorkflowData {
|
|
5
|
+
edges: WorkflowEdgeInfo[];
|
|
6
|
+
nodes: WorkflowNodeInfo[];
|
|
7
|
+
}
|
|
8
|
+
export interface WorkflowExecuteParams {
|
|
9
|
+
/**
|
|
10
|
+
* 工作流输入变量
|
|
11
|
+
*/
|
|
12
|
+
variables: WorkflowVariables;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowExecuteRes {
|
|
15
|
+
/**
|
|
16
|
+
* 工作流输出变量
|
|
17
|
+
*/
|
|
18
|
+
variables: WorkflowVariables;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 工作流执行方法
|
|
22
|
+
* 工作流执行时,实际运行的方法
|
|
23
|
+
*/
|
|
24
|
+
export type WorkflowExecute = (params: WorkflowExecuteParams) => Promise<WorkflowExecuteRes>;
|
|
25
|
+
export interface WorkflowInfo {
|
|
26
|
+
execute: WorkflowExecute;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/types/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,EAAE,qBAAqB,KAC1B,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,eAAe,CAAC;CAC1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkflowExecuteRes, WorkflowNodeInfo, WorkflowVariablesMap } from "../types";
|
|
2
|
+
export interface GetWorkflowOutputVariablesParams {
|
|
3
|
+
endNode: WorkflowNodeInfo;
|
|
4
|
+
workflowVariablesMap: WorkflowVariablesMap;
|
|
5
|
+
}
|
|
6
|
+
export interface GetWorkflowOutputVariablesRes extends WorkflowExecuteRes {
|
|
7
|
+
}
|
|
8
|
+
export type GetWorkflowOutputVariables = (params: GetWorkflowOutputVariablesParams) => GetWorkflowOutputVariablesRes;
|
|
9
|
+
export declare const getWorkflowOutputVariables: GetWorkflowOutputVariables;
|
|
10
|
+
//# sourceMappingURL=get-workflow-output-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-workflow-output-variables.d.ts","sourceRoot":"","sources":["../../src/utils/get-workflow-output-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C;AAED,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;CAAG;AAE5E,MAAM,MAAM,0BAA0B,GAAG,CACvC,MAAM,EAAE,gCAAgC,KACrC,6BAA6B,CAAC;AAEnC,eAAO,MAAM,0BAA0B,EAAE,0BAYxC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkflowOutputVariables = void 0;
|
|
4
|
+
const getWorkflowOutputVariables = (params) => {
|
|
5
|
+
const { endNode, workflowVariablesMap } = params;
|
|
6
|
+
const variables = workflowVariablesMap.get(endNode.id);
|
|
7
|
+
const res = {
|
|
8
|
+
variables,
|
|
9
|
+
};
|
|
10
|
+
return res;
|
|
11
|
+
};
|
|
12
|
+
exports.getWorkflowOutputVariables = getWorkflowOutputVariables;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./get-
|
|
17
|
+
__exportStar(require("./get-workflow-output-variables"), exports);
|
|
18
18
|
__exportStar(require("./get-ordered-node-list"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
|
-
"@ldsg/handler": "0.2.
|
|
19
|
-
"@ldsg/resource": "0.2.
|
|
20
|
-
"@ldsg/resource-definition": "0.2.
|
|
18
|
+
"@ldsg/handler": "0.2.12",
|
|
19
|
+
"@ldsg/resource": "0.2.12",
|
|
20
|
+
"@ldsg/resource-definition": "0.2.12"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/lodash": "^4.14.202",
|
|
24
|
-
"@ldsg/types": "0.2.
|
|
24
|
+
"@ldsg/types": "0.2.12"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-variables.d.ts","sourceRoot":"","sources":["../../src/types/node-variables.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-data.d.ts","sourceRoot":"","sources":["../../src/types/workflow-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-edge-info.d.ts","sourceRoot":"","sources":["../../src/types/workflow-edge-info.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { GetEndNodeOutputVariablesRes } from "../utils";
|
|
2
|
-
import { NodeVariables } from "./node-variables";
|
|
3
|
-
export interface WorkflowExecuteParams {
|
|
4
|
-
startNodeInputVariables: NodeVariables;
|
|
5
|
-
}
|
|
6
|
-
export interface WorkflowExecuteRes {
|
|
7
|
-
endNodeOutputVariables: NodeVariables;
|
|
8
|
-
}
|
|
9
|
-
export type WorkflowExecute = (params: WorkflowExecuteParams) => Promise<GetEndNodeOutputVariablesRes>;
|
|
10
|
-
export interface WorkflowInfo {
|
|
11
|
-
execute: WorkflowExecute;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=workflow-info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-info.d.ts","sourceRoot":"","sources":["../../src/types/workflow-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,uBAAuB,EAAE,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,sBAAsB,EAAE,aAAa,CAAC;CACvC;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,EAAE,qBAAqB,KAC1B,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,eAAe,CAAC;CAC1B"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { NodeId, NodeIdToVariablesMap, NodeVariables } from "./node-variables";
|
|
2
|
-
export type WorkflowNodeExecuterExecute = () => void | Promise<void>;
|
|
3
|
-
interface WorkflowNodeExecuterConstructorParams {
|
|
4
|
-
nodeId: NodeId;
|
|
5
|
-
nodeIdToVariablesMap: NodeIdToVariablesMap;
|
|
6
|
-
/**
|
|
7
|
-
* input variables
|
|
8
|
-
* only in start node
|
|
9
|
-
*/
|
|
10
|
-
inputVariables?: any;
|
|
11
|
-
}
|
|
12
|
-
interface SetVariablesParams {
|
|
13
|
-
variables: NodeVariables;
|
|
14
|
-
}
|
|
15
|
-
type SetVariables = (params: SetVariablesParams) => void;
|
|
16
|
-
export declare class WorkflowNodeExecuter implements WorkflowNodeExecuterConstructorParams {
|
|
17
|
-
nodeId: NodeId;
|
|
18
|
-
nodeIdToVariablesMap: NodeIdToVariablesMap;
|
|
19
|
-
/**
|
|
20
|
-
* input variables
|
|
21
|
-
* only in start node
|
|
22
|
-
*/
|
|
23
|
-
inputVariables?: any;
|
|
24
|
-
constructor(params: WorkflowNodeExecuterConstructorParams);
|
|
25
|
-
/**
|
|
26
|
-
* Set Current Node Output Variables
|
|
27
|
-
*/
|
|
28
|
-
setVariables: SetVariables;
|
|
29
|
-
execute: WorkflowNodeExecuterExecute;
|
|
30
|
-
}
|
|
31
|
-
export interface WorkflowNodeInfo {
|
|
32
|
-
/**
|
|
33
|
-
* ID
|
|
34
|
-
*/
|
|
35
|
-
id: string;
|
|
36
|
-
/**
|
|
37
|
-
* Workflow Node Type Resource ID
|
|
38
|
-
*/
|
|
39
|
-
workflowNodeTypeResourceId: string;
|
|
40
|
-
/**
|
|
41
|
-
* Executer
|
|
42
|
-
*/
|
|
43
|
-
Executer: typeof WorkflowNodeExecuter;
|
|
44
|
-
}
|
|
45
|
-
export interface GetWorkflowNodeInfoRes {
|
|
46
|
-
/**
|
|
47
|
-
* Workflow Node Info
|
|
48
|
-
*/
|
|
49
|
-
workflowNodeInfo: WorkflowNodeInfo;
|
|
50
|
-
}
|
|
51
|
-
export type GetWorkflowNodeInfo = () => GetWorkflowNodeInfoRes;
|
|
52
|
-
export {};
|
|
53
|
-
//# sourceMappingURL=workflow-node-info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-node-info.d.ts","sourceRoot":"","sources":["../../src/types/workflow-node-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,MAAM,2BAA2B,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAErE,UAAU,qCAAqC;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,oBAAoB,EAAE,oBAAoB,CAAC;IAE3C;;;OAGG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC1B,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,KAAK,YAAY,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEzD,qBAAa,oBACX,YAAW,qCAAqC;IAEhD,MAAM,EAAE,MAAM,CAAC;IAEf,oBAAoB,EAAE,oBAAoB,CAAC;IAE3C;;;OAGG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;gBAET,MAAM,EAAE,qCAAqC;IAQzD;;OAEG;IACH,YAAY,EAAE,YAAY,CAMxB;IAEF,OAAO,EAAE,2BAA2B,CASlC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,0BAA0B,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,QAAQ,EAAE,OAAO,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowNodeExecuter = void 0;
|
|
4
|
-
class WorkflowNodeExecuter {
|
|
5
|
-
constructor(params) {
|
|
6
|
-
/**
|
|
7
|
-
* Set Current Node Output Variables
|
|
8
|
-
*/
|
|
9
|
-
this.setVariables = (params) => {
|
|
10
|
-
const { variables } = params;
|
|
11
|
-
const { nodeId, nodeIdToVariablesMap } = this;
|
|
12
|
-
nodeIdToVariablesMap.set(nodeId, variables);
|
|
13
|
-
};
|
|
14
|
-
this.execute = () => {
|
|
15
|
-
const { nodeId, nodeIdToVariablesMap } = this;
|
|
16
|
-
console.info("WorkflowNodeExecuter execute nodeId", nodeId);
|
|
17
|
-
console.info("WorkflowNodeExecuter execute nodeIdToVariablesMap", nodeIdToVariablesMap);
|
|
18
|
-
};
|
|
19
|
-
const { nodeId, nodeIdToVariablesMap, inputVariables } = params;
|
|
20
|
-
this.nodeId = nodeId;
|
|
21
|
-
this.nodeIdToVariablesMap = nodeIdToVariablesMap;
|
|
22
|
-
this.inputVariables = inputVariables;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.WorkflowNodeExecuter = WorkflowNodeExecuter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NodeIdToVariablesMap, WorkflowExecuteRes, WorkflowNodeInfo } from "../types";
|
|
2
|
-
export interface GetEndNodeOutputVariablesParams {
|
|
3
|
-
endNode: WorkflowNodeInfo;
|
|
4
|
-
nodeIdToVariablesMap: NodeIdToVariablesMap;
|
|
5
|
-
}
|
|
6
|
-
export interface GetEndNodeOutputVariablesRes extends WorkflowExecuteRes {
|
|
7
|
-
}
|
|
8
|
-
export type GetEndNodeOutputVariables = (params: GetEndNodeOutputVariablesParams) => GetEndNodeOutputVariablesRes;
|
|
9
|
-
export declare const getEndNodeOutputVariables: GetEndNodeOutputVariables;
|
|
10
|
-
//# sourceMappingURL=get-end-node-output-variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-end-node-output-variables.d.ts","sourceRoot":"","sources":["../../src/utils/get-end-node-output-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C;AAED,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;CAAG;AAE3E,MAAM,MAAM,yBAAyB,GAAG,CACtC,MAAM,EAAE,+BAA+B,KACpC,4BAA4B,CAAC;AAElC,eAAO,MAAM,yBAAyB,EAAE,yBAYvC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEndNodeOutputVariables = void 0;
|
|
4
|
-
const getEndNodeOutputVariables = (params) => {
|
|
5
|
-
const { endNode, nodeIdToVariablesMap } = params;
|
|
6
|
-
const endNodeOutputVariables = nodeIdToVariablesMap.get(endNode.id);
|
|
7
|
-
const res = {
|
|
8
|
-
endNodeOutputVariables,
|
|
9
|
-
};
|
|
10
|
-
return res;
|
|
11
|
-
};
|
|
12
|
-
exports.getEndNodeOutputVariables = getEndNodeOutputVariables;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|