@nocobase/plugin-workflow 0.7.0-alpha.9 → 0.7.1-alpha.6
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/lib/Plugin.d.ts +18 -0
- package/lib/Plugin.js +285 -0
- package/lib/Processor.d.ts +40 -0
- package/lib/Processor.js +440 -0
- package/lib/actions/index.d.ts +3 -1
- package/lib/actions/index.js +33 -26
- package/{esm/actions/flow_nodes.d.ts → lib/actions/nodes.d.ts} +1 -0
- package/lib/actions/nodes.js +321 -0
- package/lib/actions/workflows.d.ts +2 -0
- package/lib/actions/workflows.js +197 -0
- package/lib/calculators/index.d.ts +2 -2
- package/lib/calculators/index.js +144 -92
- package/lib/collections/executions.js +32 -38
- package/lib/collections/flow_nodes.js +60 -72
- package/lib/collections/jobs.js +26 -47
- package/lib/collections/workflows.d.ts +1 -2
- package/lib/collections/workflows.js +70 -63
- package/lib/constants.js +22 -17
- package/lib/index.d.ts +4 -3
- package/lib/index.js +85 -22
- package/lib/instructions/calculation.d.ts +1 -1
- package/lib/instructions/calculation.js +32 -29
- package/lib/instructions/condition.d.ts +2 -2
- package/lib/instructions/condition.js +91 -88
- package/lib/instructions/create.d.ts +2 -2
- package/lib/instructions/create.js +39 -25
- package/lib/instructions/delay.d.ts +14 -0
- package/lib/instructions/delay.js +138 -0
- package/lib/instructions/destroy.d.ts +1 -1
- package/lib/instructions/destroy.js +38 -25
- package/lib/instructions/index.d.ts +11 -8
- package/lib/instructions/index.js +76 -25
- package/lib/instructions/parallel.d.ts +3 -3
- package/lib/instructions/parallel.js +95 -84
- package/lib/instructions/prompt.d.ts +2 -2
- package/lib/instructions/prompt.js +21 -13
- package/lib/instructions/query.d.ts +2 -1
- package/lib/instructions/query.js +42 -25
- package/lib/instructions/update.d.ts +2 -1
- package/lib/instructions/update.js +40 -25
- package/lib/models/Execution.d.ts +3 -33
- package/lib/models/Execution.js +18 -254
- package/lib/models/FlowNode.js +18 -5
- package/lib/models/Job.js +18 -5
- package/lib/models/Workflow.d.ts +5 -6
- package/lib/models/Workflow.js +18 -76
- package/lib/triggers/collection.d.ts +12 -0
- package/lib/triggers/collection.js +184 -0
- package/lib/triggers/index.d.ts +11 -7
- package/lib/triggers/index.js +64 -11
- package/lib/triggers/schedule.d.ts +38 -0
- package/lib/triggers/schedule.js +672 -0
- package/package.json +8 -12
- package/esm/actions/flow_nodes.js +0 -139
- package/esm/actions/flow_nodes.js.map +0 -1
- package/esm/actions/index.d.ts +0 -1
- package/esm/actions/index.js +0 -8
- package/esm/actions/index.js.map +0 -1
- package/esm/calculators/index.d.ts +0 -38
- package/esm/calculators/index.js +0 -128
- package/esm/calculators/index.js.map +0 -1
- package/esm/collections/executions.d.ts +0 -3
- package/esm/collections/executions.js +0 -38
- package/esm/collections/executions.js.map +0 -1
- package/esm/collections/flow_nodes.d.ts +0 -3
- package/esm/collections/flow_nodes.js +0 -72
- package/esm/collections/flow_nodes.js.map +0 -1
- package/esm/collections/jobs.d.ts +0 -3
- package/esm/collections/jobs.js +0 -47
- package/esm/collections/jobs.js.map +0 -1
- package/esm/collections/workflows.d.ts +0 -3
- package/esm/collections/workflows.js +0 -63
- package/esm/collections/workflows.js.map +0 -1
- package/esm/constants.d.ts +0 -17
- package/esm/constants.js +0 -18
- package/esm/constants.js.map +0 -1
- package/esm/index.d.ts +0 -5
- package/esm/index.js +0 -6
- package/esm/index.js.map +0 -1
- package/esm/instructions/calculation.d.ts +0 -8
- package/esm/instructions/calculation.js +0 -55
- package/esm/instructions/calculation.js.map +0 -1
- package/esm/instructions/condition.d.ts +0 -5
- package/esm/instructions/condition.js +0 -99
- package/esm/instructions/condition.js.map +0 -1
- package/esm/instructions/create.d.ts +0 -8
- package/esm/instructions/create.js +0 -25
- package/esm/instructions/create.js.map +0 -1
- package/esm/instructions/destroy.d.ts +0 -8
- package/esm/instructions/destroy.js +0 -25
- package/esm/instructions/destroy.js.map +0 -1
- package/esm/instructions/index.d.ts +0 -15
- package/esm/instructions/index.js +0 -20
- package/esm/instructions/index.js.map +0 -1
- package/esm/instructions/parallel.d.ts +0 -13
- package/esm/instructions/parallel.js +0 -88
- package/esm/instructions/parallel.js.map +0 -1
- package/esm/instructions/prompt.d.ts +0 -7
- package/esm/instructions/prompt.js +0 -13
- package/esm/instructions/prompt.js.map +0 -1
- package/esm/instructions/query.d.ts +0 -8
- package/esm/instructions/query.js +0 -25
- package/esm/instructions/query.js.map +0 -1
- package/esm/instructions/update.d.ts +0 -8
- package/esm/instructions/update.js +0 -25
- package/esm/instructions/update.js.map +0 -1
- package/esm/models/Execution.d.ts +0 -50
- package/esm/models/Execution.js +0 -250
- package/esm/models/Execution.js.map +0 -1
- package/esm/models/FlowNode.d.ts +0 -17
- package/esm/models/FlowNode.js +0 -4
- package/esm/models/FlowNode.js.map +0 -1
- package/esm/models/Job.d.ts +0 -15
- package/esm/models/Job.js +0 -4
- package/esm/models/Job.js.map +0 -1
- package/esm/models/Workflow.d.ts +0 -27
- package/esm/models/Workflow.js +0 -72
- package/esm/models/Workflow.js.map +0 -1
- package/esm/server.d.ts +0 -5
- package/esm/server.js +0 -62
- package/esm/server.js.map +0 -1
- package/esm/triggers/index.d.ts +0 -9
- package/esm/triggers/index.js +0 -6
- package/esm/triggers/index.js.map +0 -1
- package/esm/triggers/model.d.ts +0 -12
- package/esm/triggers/model.js +0 -47
- package/esm/triggers/model.js.map +0 -1
- package/lib/actions/flow_nodes.d.ts +0 -3
- package/lib/actions/flow_nodes.js +0 -163
- package/lib/actions/flow_nodes.js.map +0 -1
- package/lib/actions/index.js.map +0 -1
- package/lib/calculators/index.js.map +0 -1
- package/lib/collections/executions.js.map +0 -1
- package/lib/collections/flow_nodes.js.map +0 -1
- package/lib/collections/jobs.js.map +0 -1
- package/lib/collections/workflows.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/instructions/calculation.js.map +0 -1
- package/lib/instructions/condition.js.map +0 -1
- package/lib/instructions/create.js.map +0 -1
- package/lib/instructions/destroy.js.map +0 -1
- package/lib/instructions/index.js.map +0 -1
- package/lib/instructions/parallel.js.map +0 -1
- package/lib/instructions/prompt.js.map +0 -1
- package/lib/instructions/query.js.map +0 -1
- package/lib/instructions/update.js.map +0 -1
- package/lib/models/Execution.js.map +0 -1
- package/lib/models/FlowNode.js.map +0 -1
- package/lib/models/Job.js.map +0 -1
- package/lib/models/Workflow.js.map +0 -1
- package/lib/server.d.ts +0 -5
- package/lib/server.js +0 -68
- package/lib/server.js.map +0 -1
- package/lib/triggers/index.js.map +0 -1
- package/lib/triggers/model.d.ts +0 -12
- package/lib/triggers/model.js +0 -49
- package/lib/triggers/model.js.map +0 -1
- package/tsconfig.build.json +0 -9
package/lib/calculators/index.js
CHANGED
|
@@ -1,132 +1,184 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
exports.default = exports.calculators;
|
|
8
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.calculate = calculate;
|
|
7
|
+
exports.default = exports.calculators = void 0;
|
|
8
|
+
|
|
9
|
+
function _lodash() {
|
|
10
|
+
const data = require("lodash");
|
|
11
|
+
|
|
12
|
+
_lodash = function _lodash() {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _utils() {
|
|
20
|
+
const data = require("@nocobase/utils");
|
|
21
|
+
|
|
22
|
+
_utils = function _utils() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const calculators = new (_utils().Registry)();
|
|
30
|
+
exports.calculators = calculators;
|
|
31
|
+
var _default = calculators; // @deprecated
|
|
9
32
|
// HACK: if no path provided, return self
|
|
10
33
|
// @see https://github.com/lodash/lodash/pull/1270
|
|
11
34
|
// TODO(question): should add default value as lodash?
|
|
35
|
+
|
|
36
|
+
exports.default = _default;
|
|
37
|
+
|
|
12
38
|
function get(object, path) {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
// NOTE:
|
|
39
|
+
return path == null || !path.length ? object : (0, _lodash().get)(object, path);
|
|
40
|
+
} // NOTE:
|
|
16
41
|
// this method could only be used in executing nodes.
|
|
17
42
|
// because type of 'job' need loaded jobs in runtime execution.
|
|
18
43
|
// or the execution should be prepared first.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function calculate(operand, lastJob, processor) {
|
|
47
|
+
switch (operand.type) {
|
|
48
|
+
// @Deprecated
|
|
49
|
+
// from execution context
|
|
50
|
+
case '$context':
|
|
51
|
+
return get(processor.execution.context, operand.options.path);
|
|
52
|
+
// @Deprecated
|
|
53
|
+
// from last job (or input job)
|
|
54
|
+
|
|
55
|
+
case '$input':
|
|
56
|
+
return lastJob !== null && lastJob !== void 0 ? lastJob : get(lastJob.result, operand.options.path);
|
|
57
|
+
// @Deprecated
|
|
58
|
+
// from job in execution
|
|
59
|
+
|
|
60
|
+
case '$jobsMapByNodeId':
|
|
61
|
+
// assume jobs have been fetched from execution before
|
|
62
|
+
const job = processor.jobsMapByNodeId[operand.options.nodeId];
|
|
63
|
+
return job && get(job, operand.options.path);
|
|
64
|
+
|
|
65
|
+
case '$calculation':
|
|
66
|
+
const fn = calculators.get(operand.options.calculator);
|
|
67
|
+
|
|
68
|
+
if (!fn) {
|
|
69
|
+
throw new Error(`no calculator function registered for "${operand.options.calculator}"`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return fn(...operand.options.operands.map(item => calculate(item, lastJob, processor)));
|
|
73
|
+
// constant
|
|
74
|
+
|
|
75
|
+
default:
|
|
76
|
+
return operand.value;
|
|
77
|
+
}
|
|
78
|
+
} // built-in functions
|
|
79
|
+
|
|
80
|
+
|
|
48
81
|
function equal(a, b) {
|
|
49
|
-
|
|
82
|
+
return a === b;
|
|
50
83
|
}
|
|
84
|
+
|
|
51
85
|
function notEqual(a, b) {
|
|
52
|
-
|
|
86
|
+
return a !== b;
|
|
53
87
|
}
|
|
88
|
+
|
|
54
89
|
function gt(a, b) {
|
|
55
|
-
|
|
90
|
+
return a > b;
|
|
56
91
|
}
|
|
92
|
+
|
|
57
93
|
function gte(a, b) {
|
|
58
|
-
|
|
94
|
+
return a >= b;
|
|
59
95
|
}
|
|
96
|
+
|
|
60
97
|
function lt(a, b) {
|
|
61
|
-
|
|
98
|
+
return a < b;
|
|
62
99
|
}
|
|
100
|
+
|
|
63
101
|
function lte(a, b) {
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
102
|
+
return a <= b;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
calculators.register('equal', equal);
|
|
106
|
+
calculators.register('notEqual', notEqual);
|
|
107
|
+
calculators.register('gt', gt);
|
|
108
|
+
calculators.register('gte', gte);
|
|
109
|
+
calculators.register('lt', lt);
|
|
110
|
+
calculators.register('lte', lte);
|
|
111
|
+
calculators.register('===', equal);
|
|
112
|
+
calculators.register('!==', notEqual);
|
|
113
|
+
calculators.register('>', gt);
|
|
114
|
+
calculators.register('>=', gte);
|
|
115
|
+
calculators.register('<', lt);
|
|
116
|
+
calculators.register('<=', lte);
|
|
117
|
+
|
|
78
118
|
function add(...args) {
|
|
79
|
-
|
|
119
|
+
return args.reduce((sum, a) => sum + a, 0);
|
|
80
120
|
}
|
|
121
|
+
|
|
81
122
|
function minus(a, b) {
|
|
82
|
-
|
|
123
|
+
return a - b;
|
|
83
124
|
}
|
|
84
|
-
|
|
85
|
-
|
|
125
|
+
|
|
126
|
+
function multiple(...args) {
|
|
127
|
+
return args.reduce((result, a) => result * a, 1);
|
|
86
128
|
}
|
|
129
|
+
|
|
87
130
|
function divide(a, b) {
|
|
88
|
-
|
|
131
|
+
return a / b;
|
|
89
132
|
}
|
|
133
|
+
|
|
90
134
|
function mod(a, b) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
135
|
+
return a % b;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
calculators.register('add', add);
|
|
139
|
+
calculators.register('minus', minus);
|
|
140
|
+
calculators.register('multiple', multiple);
|
|
141
|
+
calculators.register('divide', divide);
|
|
142
|
+
calculators.register('mod', mod);
|
|
143
|
+
calculators.register('+', add);
|
|
144
|
+
calculators.register('-', minus);
|
|
145
|
+
calculators.register('*', multiple);
|
|
146
|
+
calculators.register('/', divide);
|
|
147
|
+
calculators.register('%', mod);
|
|
148
|
+
|
|
103
149
|
function includes(a, b) {
|
|
104
|
-
|
|
150
|
+
return a.includes(b);
|
|
105
151
|
}
|
|
152
|
+
|
|
106
153
|
function notIncludes(a, b) {
|
|
107
|
-
|
|
154
|
+
return !a.includes(b);
|
|
108
155
|
}
|
|
156
|
+
|
|
109
157
|
function startsWith(a, b) {
|
|
110
|
-
|
|
158
|
+
return a.startsWith(b);
|
|
111
159
|
}
|
|
160
|
+
|
|
112
161
|
function notStartsWith(a, b) {
|
|
113
|
-
|
|
162
|
+
return !a.startsWith(b);
|
|
114
163
|
}
|
|
164
|
+
|
|
115
165
|
function endsWith(a, b) {
|
|
116
|
-
|
|
166
|
+
return a.endsWith(b);
|
|
117
167
|
}
|
|
168
|
+
|
|
118
169
|
function notEndsWith(a, b) {
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
170
|
+
return !a.endsWith(b);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
calculators.register('includes', includes);
|
|
174
|
+
calculators.register('notIncludes', notIncludes);
|
|
175
|
+
calculators.register('startsWith', startsWith);
|
|
176
|
+
calculators.register('notStartsWith', notStartsWith);
|
|
177
|
+
calculators.register('endsWith', endsWith);
|
|
178
|
+
calculators.register('notEndsWith', notEndsWith);
|
|
179
|
+
|
|
127
180
|
function before(a, b) {
|
|
128
|
-
|
|
181
|
+
return a < b;
|
|
129
182
|
}
|
|
130
|
-
|
|
131
|
-
// TODO: add more common calculators
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
183
|
+
|
|
184
|
+
calculators.register('now', () => new Date()); // TODO: add more common calculators
|
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
interface: 'select',
|
|
34
|
-
type: 'integer',
|
|
35
|
-
name: 'status',
|
|
36
|
-
title: '状态'
|
|
37
|
-
}
|
|
38
|
-
]
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
name: 'executions',
|
|
9
|
+
fields: [{
|
|
10
|
+
type: 'belongsTo',
|
|
11
|
+
name: 'workflow'
|
|
12
|
+
}, {
|
|
13
|
+
type: 'uid',
|
|
14
|
+
name: 'key'
|
|
15
|
+
}, {
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
name: 'useTransaction',
|
|
18
|
+
defaultValue: false
|
|
19
|
+
}, {
|
|
20
|
+
type: 'uuid',
|
|
21
|
+
name: 'transaction',
|
|
22
|
+
defaultValue: null
|
|
23
|
+
}, {
|
|
24
|
+
type: 'hasMany',
|
|
25
|
+
name: 'jobs'
|
|
26
|
+
}, {
|
|
27
|
+
type: 'jsonb',
|
|
28
|
+
name: 'context'
|
|
29
|
+
}, {
|
|
30
|
+
type: 'integer',
|
|
31
|
+
name: 'status'
|
|
32
|
+
}]
|
|
39
33
|
};
|
|
40
|
-
|
|
34
|
+
exports.default = _default;
|
|
@@ -1,74 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{ label: '等待人工输入', value: 'prompt' },
|
|
62
|
-
{ label: '条件判断', value: 'condition' },
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
interface: 'json',
|
|
67
|
-
type: 'jsonb',
|
|
68
|
-
name: 'config',
|
|
69
|
-
title: '配置',
|
|
70
|
-
defaultValue: {}
|
|
71
|
-
}
|
|
72
|
-
]
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
name: 'flow_nodes',
|
|
9
|
+
// model: 'FlowNodeModel',
|
|
10
|
+
title: 'Workflow Nodes',
|
|
11
|
+
fields: [{
|
|
12
|
+
interface: 'string',
|
|
13
|
+
type: 'string',
|
|
14
|
+
name: 'title',
|
|
15
|
+
title: '名称'
|
|
16
|
+
}, // which workflow belongs to
|
|
17
|
+
{
|
|
18
|
+
interface: 'linkTo',
|
|
19
|
+
name: 'workflow',
|
|
20
|
+
type: 'belongsTo'
|
|
21
|
+
}, {
|
|
22
|
+
interface: 'linkTo',
|
|
23
|
+
name: 'upstream',
|
|
24
|
+
type: 'belongsTo',
|
|
25
|
+
target: 'flow_nodes'
|
|
26
|
+
}, {
|
|
27
|
+
interface: 'linkTo',
|
|
28
|
+
name: 'branches',
|
|
29
|
+
type: 'hasMany',
|
|
30
|
+
target: 'flow_nodes',
|
|
31
|
+
sourceKey: 'id',
|
|
32
|
+
foreignKey: 'upstreamId'
|
|
33
|
+
}, // only works when upstream node is branching type, such as condition and parallel.
|
|
34
|
+
// put here because the design of flow-links model is not really necessary for now.
|
|
35
|
+
// or it should be put into flow-links model.
|
|
36
|
+
{
|
|
37
|
+
interface: 'select',
|
|
38
|
+
name: 'branchIndex',
|
|
39
|
+
type: 'integer',
|
|
40
|
+
title: 'branch index'
|
|
41
|
+
}, // Note: for reasons:
|
|
42
|
+
// 1. redirect type node to solve cycle flow.
|
|
43
|
+
// 2. recognize as real next node after branches.
|
|
44
|
+
{
|
|
45
|
+
interface: 'linkTo',
|
|
46
|
+
name: 'downstream',
|
|
47
|
+
type: 'belongsTo',
|
|
48
|
+
target: 'flow_nodes'
|
|
49
|
+
}, {
|
|
50
|
+
interface: 'select',
|
|
51
|
+
type: 'string',
|
|
52
|
+
name: 'type',
|
|
53
|
+
title: '类型'
|
|
54
|
+
}, {
|
|
55
|
+
interface: 'json',
|
|
56
|
+
type: 'jsonb',
|
|
57
|
+
name: 'config',
|
|
58
|
+
title: '配置',
|
|
59
|
+
defaultValue: {}
|
|
60
|
+
}]
|
|
73
61
|
};
|
|
74
|
-
|
|
62
|
+
exports.default = _default;
|
package/lib/collections/jobs.js
CHANGED
|
@@ -1,49 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// pending / resolved / rejected
|
|
28
|
-
{
|
|
29
|
-
interface: 'status',
|
|
30
|
-
type: 'integer',
|
|
31
|
-
name: 'status',
|
|
32
|
-
title: '处理状态'
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
interface: 'json',
|
|
36
|
-
type: 'jsonb',
|
|
37
|
-
name: 'result',
|
|
38
|
-
title: '处理结果'
|
|
39
|
-
},
|
|
40
|
-
// TODO: possibly need node snapshot in case if node has been changed
|
|
41
|
-
// {
|
|
42
|
-
// interface: 'json',
|
|
43
|
-
// type: 'jsonb',
|
|
44
|
-
// name: 'nodeSnapshot',
|
|
45
|
-
// title: 'node snapshot'
|
|
46
|
-
// }
|
|
47
|
-
]
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
name: 'jobs',
|
|
9
|
+
fields: [{
|
|
10
|
+
type: 'belongsTo',
|
|
11
|
+
name: 'execution'
|
|
12
|
+
}, {
|
|
13
|
+
type: 'belongsTo',
|
|
14
|
+
name: 'node',
|
|
15
|
+
target: 'flow_nodes'
|
|
16
|
+
}, {
|
|
17
|
+
type: 'belongsTo',
|
|
18
|
+
name: 'upstream',
|
|
19
|
+
target: 'jobs'
|
|
20
|
+
}, {
|
|
21
|
+
type: 'integer',
|
|
22
|
+
name: 'status'
|
|
23
|
+
}, {
|
|
24
|
+
type: 'jsonb',
|
|
25
|
+
name: 'result'
|
|
26
|
+
}]
|
|
48
27
|
};
|
|
49
|
-
|
|
28
|
+
exports.default = _default;
|