@nocobase/plugin-workflow 0.9.0-alpha.2 → 0.9.1-alpha.2
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/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/lib/client/AddButton.d.ts +1 -1
- package/lib/client/AddButton.js +43 -27
- package/lib/client/Branch.d.ts +1 -1
- package/lib/client/ExecutionCanvas.js +5 -10
- package/lib/client/WorkflowCanvas.js +12 -42
- package/lib/client/WorkflowProvider.js +10 -1
- package/lib/client/components/CollectionBlockInitializer.d.ts +7 -0
- package/lib/client/components/CollectionBlockInitializer.js +81 -0
- package/lib/client/components/CollectionFieldInitializers.d.ts +2 -0
- package/lib/client/components/CollectionFieldInitializers.js +89 -0
- package/lib/client/components/CollectionFieldset.js +25 -33
- package/lib/client/components/FilterDynamicComponent.d.ts +6 -0
- package/lib/client/components/FilterDynamicComponent.js +43 -0
- package/lib/client/components/NullRender.d.ts +1 -0
- package/lib/client/components/NullRender.js +10 -0
- package/lib/client/components/RadioWithTooltip.d.ts +7 -0
- package/lib/client/components/RadioWithTooltip.js +94 -0
- package/lib/client/constants.d.ts +10 -8
- package/lib/client/constants.js +52 -14
- package/lib/client/index.d.ts +0 -1
- package/lib/client/index.js +1 -10
- package/lib/client/locale/en-US.d.ts +18 -18
- package/lib/client/locale/en-US.js +19 -19
- package/lib/client/locale/zh-CN.d.ts +47 -20
- package/lib/client/locale/zh-CN.js +48 -21
- package/lib/client/nodes/calculation.d.ts +39 -7
- package/lib/client/nodes/calculation.js +165 -19
- package/lib/client/nodes/condition.d.ts +67 -4
- package/lib/client/nodes/condition.js +283 -31
- package/lib/client/nodes/create.d.ts +10 -10
- package/lib/client/nodes/create.js +28 -42
- package/lib/client/nodes/delay.d.ts +4 -4
- package/lib/client/nodes/delay.js +10 -8
- package/lib/client/nodes/destroy.d.ts +4 -7
- package/lib/client/nodes/destroy.js +4 -5
- package/lib/client/nodes/index.d.ts +10 -2
- package/lib/client/nodes/index.js +217 -110
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +65 -0
- package/lib/client/nodes/manual/ModeConfig.d.ts +5 -0
- package/lib/client/nodes/manual/ModeConfig.js +160 -0
- package/lib/client/nodes/manual/SchemaConfig.d.ts +6 -0
- package/lib/client/nodes/manual/SchemaConfig.js +715 -0
- package/lib/client/nodes/manual/WorkflowTodo.d.ts +8 -0
- package/lib/client/nodes/manual/WorkflowTodo.js +691 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +5 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +75 -0
- package/lib/client/nodes/manual/index.d.ts +62 -0
- package/lib/client/nodes/manual/index.js +137 -0
- package/lib/client/nodes/parallel.d.ts +12 -7
- package/lib/client/nodes/parallel.js +32 -39
- package/lib/client/nodes/query.d.ts +11 -19
- package/lib/client/nodes/query.js +40 -47
- package/lib/client/nodes/request.d.ts +77 -42
- package/lib/client/nodes/request.js +123 -69
- package/lib/client/nodes/update.d.ts +33 -29
- package/lib/client/nodes/update.js +14 -7
- package/lib/client/schemas/collection.d.ts +0 -3
- package/lib/client/schemas/collection.js +2 -7
- package/lib/client/schemas/executions.js +1 -1
- package/lib/client/schemas/workflows.js +1 -1
- package/lib/client/style.js +51 -9
- package/lib/client/triggers/collection.d.ts +44 -15
- package/lib/client/triggers/collection.js +104 -82
- package/lib/client/triggers/index.d.ts +6 -3
- package/lib/client/triggers/index.js +167 -74
- package/lib/client/triggers/schedule/DateFieldsSelect.js +1 -3
- package/lib/client/triggers/schedule/ScheduleConfig.js +15 -17
- package/lib/client/triggers/schedule/index.d.ts +7 -6
- package/lib/client/triggers/schedule/index.js +39 -81
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +38 -0
- package/lib/client/variable.d.ts +21 -0
- package/lib/client/variable.js +147 -0
- package/lib/server/Plugin.d.ts +3 -3
- package/lib/server/Plugin.js +12 -21
- package/lib/server/Processor.d.ts +9 -2
- package/lib/server/Processor.js +33 -33
- package/lib/server/actions/index.js +2 -4
- package/lib/server/actions/workflows.d.ts +1 -0
- package/lib/server/actions/workflows.js +80 -23
- package/lib/server/collections/executions.js +5 -7
- package/lib/server/collections/flow_nodes.js +6 -18
- package/lib/server/collections/jobs.js +3 -1
- package/lib/server/collections/workflows.js +8 -4
- package/lib/server/constants.d.ts +9 -3
- package/lib/server/constants.js +11 -5
- package/lib/server/functions/index.d.ts +4 -0
- package/lib/server/functions/index.js +38 -0
- package/lib/server/index.d.ts +0 -1
- package/lib/server/index.js +0 -14
- package/lib/server/instructions/calculation.d.ts +2 -7
- package/lib/server/instructions/calculation.js +32 -37
- package/lib/server/instructions/condition.d.ts +4 -4
- package/lib/server/instructions/condition.js +126 -54
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/manual/actions.js +101 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
- package/lib/server/instructions/manual/index.d.ts +25 -0
- package/lib/server/instructions/manual/index.js +200 -0
- package/lib/server/instructions/parallel.js +11 -7
- package/lib/server/instructions/request.d.ts +5 -4
- package/lib/server/instructions/request.js +60 -79
- package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
- package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
- package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
- package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
- package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
- package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
- package/lib/server/triggers/schedule.js +11 -3
- package/package.json +10 -10
- package/lib/client/calculators.d.ts +0 -89
- package/lib/client/calculators.js +0 -668
- package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
- package/lib/client/components/CollectionFieldSelect.js +0 -106
- package/lib/client/components/EjsTextArea.d.ts +0 -2
- package/lib/client/components/EjsTextArea.js +0 -232
- package/lib/server/actions/jobs.d.ts +0 -2
- package/lib/server/actions/jobs.js +0 -39
- package/lib/server/calculators/index.d.ts +0 -40
- package/lib/server/calculators/index.js +0 -187
- package/lib/server/extensions/assignees/actions.js +0 -75
- package/lib/server/extensions/assignees/index.d.ts +0 -2
- package/lib/server/extensions/assignees/index.js +0 -273
- package/lib/server/extensions/index.d.ts +0 -3
- package/lib/server/extensions/index.js +0 -13
- package/lib/server/instructions/prompt.d.ts +0 -19
- package/lib/server/instructions/prompt.js +0 -131
- /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.d.ts +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.destroy = destroy;
|
|
6
7
|
exports.revision = revision;
|
|
7
8
|
exports.update = update;
|
|
8
9
|
|
|
@@ -16,6 +17,16 @@ function _actions() {
|
|
|
16
17
|
return data;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
function _database() {
|
|
21
|
+
const data = require("@nocobase/database");
|
|
22
|
+
|
|
23
|
+
_database = function _database() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
31
|
|
|
21
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -56,13 +67,16 @@ function _update() {
|
|
|
56
67
|
|
|
57
68
|
const _context$action$param = context.action.params,
|
|
58
69
|
filterByTk = _context$action$param.filterByTk,
|
|
59
|
-
values = _context$action$param.values;
|
|
70
|
+
values = _context$action$param.values;
|
|
71
|
+
context.action.mergeParams({
|
|
72
|
+
whitelist: ['title', 'description', 'enabled', 'config']
|
|
73
|
+
}); // only enable/disable
|
|
60
74
|
|
|
61
|
-
if (Object.keys(values).
|
|
75
|
+
if (Object.keys(values).includes('config')) {
|
|
62
76
|
const workflow = yield repository.findById(filterByTk);
|
|
63
77
|
|
|
64
78
|
if (workflow.get('executed')) {
|
|
65
|
-
return context.throw(400, 'executed workflow can not be updated');
|
|
79
|
+
return context.throw(400, 'config of executed workflow can not be updated');
|
|
66
80
|
}
|
|
67
81
|
}
|
|
68
82
|
|
|
@@ -71,6 +85,54 @@ function _update() {
|
|
|
71
85
|
return _update.apply(this, arguments);
|
|
72
86
|
}
|
|
73
87
|
|
|
88
|
+
function destroy(_x3, _x4) {
|
|
89
|
+
return _destroy.apply(this, arguments);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function _destroy() {
|
|
93
|
+
_destroy = _asyncToGenerator(function* (context, next) {
|
|
94
|
+
const repository = _actions().utils.getRepositoryFromParams(context);
|
|
95
|
+
|
|
96
|
+
const _context$action$param2 = context.action.params,
|
|
97
|
+
filterByTk = _context$action$param2.filterByTk,
|
|
98
|
+
filter = _context$action$param2.filter;
|
|
99
|
+
yield context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
100
|
+
var _ref = _asyncToGenerator(function* (transaction) {
|
|
101
|
+
const items = yield repository.find({
|
|
102
|
+
filterByTk,
|
|
103
|
+
filter,
|
|
104
|
+
fields: ['id', 'key', 'current'],
|
|
105
|
+
transaction
|
|
106
|
+
});
|
|
107
|
+
const ids = new Set(items.map(item => item.id));
|
|
108
|
+
const keysSet = new Set(items.filter(item => item.current).map(item => item.key));
|
|
109
|
+
const revisions = yield repository.find({
|
|
110
|
+
filter: {
|
|
111
|
+
key: Array.from(keysSet),
|
|
112
|
+
current: {
|
|
113
|
+
[_database().Op.not]: true
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
fields: ['id'],
|
|
117
|
+
transaction
|
|
118
|
+
});
|
|
119
|
+
revisions.forEach(item => ids.add(item.id));
|
|
120
|
+
context.body = yield repository.destroy({
|
|
121
|
+
filterByTk: Array.from(ids),
|
|
122
|
+
individualHooks: true,
|
|
123
|
+
transaction
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return function (_x7) {
|
|
128
|
+
return _ref.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}());
|
|
131
|
+
next();
|
|
132
|
+
});
|
|
133
|
+
return _destroy.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
|
|
74
136
|
function typeOf(value) {
|
|
75
137
|
if (Array.isArray(value)) {
|
|
76
138
|
return 'array';
|
|
@@ -105,20 +167,15 @@ function migrateConfig(config, oldToNew) {
|
|
|
105
167
|
return value.map(item => migrate(item));
|
|
106
168
|
|
|
107
169
|
case 'string':
|
|
108
|
-
|
|
170
|
+
return value.replace(/(\{\{\$jobsMapByNodeId\.)([\w-]+)/g, (_, jobVar, oldNodeId) => {
|
|
171
|
+
const newNode = oldToNew.get(Number.parseInt(oldNodeId, 10));
|
|
109
172
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const oldNodeId = Number.parseInt(matcher[2], 10);
|
|
115
|
-
const newNode = oldToNew.get(oldNodeId);
|
|
116
|
-
|
|
117
|
-
if (!newNode) {
|
|
118
|
-
throw new Error('node configurated for result is not existed');
|
|
119
|
-
}
|
|
173
|
+
if (!newNode) {
|
|
174
|
+
throw new Error('node configurated for result is not existed');
|
|
175
|
+
}
|
|
120
176
|
|
|
121
|
-
|
|
177
|
+
return `{{$jobsMapByNodeId.${newNode.id}`;
|
|
178
|
+
});
|
|
122
179
|
|
|
123
180
|
default:
|
|
124
181
|
return value;
|
|
@@ -128,7 +185,7 @@ function migrateConfig(config, oldToNew) {
|
|
|
128
185
|
return migrate(config);
|
|
129
186
|
}
|
|
130
187
|
|
|
131
|
-
function revision(
|
|
188
|
+
function revision(_x5, _x6) {
|
|
132
189
|
return _revision.apply(this, arguments);
|
|
133
190
|
}
|
|
134
191
|
|
|
@@ -138,12 +195,12 @@ function _revision() {
|
|
|
138
195
|
|
|
139
196
|
const repository = _actions().utils.getRepositoryFromParams(context);
|
|
140
197
|
|
|
141
|
-
const _context$action$
|
|
142
|
-
filterByTk = _context$action$
|
|
143
|
-
_context$action$
|
|
144
|
-
filter = _context$action$
|
|
198
|
+
const _context$action$param3 = context.action.params,
|
|
199
|
+
filterByTk = _context$action$param3.filterByTk,
|
|
200
|
+
_context$action$param4 = _context$action$param3.filter,
|
|
201
|
+
filter = _context$action$param4 === void 0 ? {} : _context$action$param4;
|
|
145
202
|
context.body = yield db.sequelize.transaction( /*#__PURE__*/function () {
|
|
146
|
-
var
|
|
203
|
+
var _ref2 = _asyncToGenerator(function* (transaction) {
|
|
147
204
|
const origin = yield repository.findOne({
|
|
148
205
|
filterByTk,
|
|
149
206
|
filter,
|
|
@@ -256,8 +313,8 @@ function _revision() {
|
|
|
256
313
|
return instance;
|
|
257
314
|
});
|
|
258
315
|
|
|
259
|
-
return function (
|
|
260
|
-
return
|
|
316
|
+
return function (_x8) {
|
|
317
|
+
return _ref2.apply(this, arguments);
|
|
261
318
|
};
|
|
262
319
|
}());
|
|
263
320
|
yield next();
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
|
+
namespace: 'workflow',
|
|
9
|
+
duplicator: 'optional',
|
|
8
10
|
name: 'executions',
|
|
9
11
|
fields: [{
|
|
10
12
|
type: 'belongsTo',
|
|
@@ -16,16 +18,12 @@ var _default = {
|
|
|
16
18
|
type: 'boolean',
|
|
17
19
|
name: 'useTransaction',
|
|
18
20
|
defaultValue: false
|
|
19
|
-
}, // @deprecated
|
|
20
|
-
{
|
|
21
|
-
type: 'uuid',
|
|
22
|
-
name: 'transaction',
|
|
23
|
-
defaultValue: null
|
|
24
21
|
}, {
|
|
25
22
|
type: 'hasMany',
|
|
26
|
-
name: 'jobs'
|
|
23
|
+
name: 'jobs',
|
|
24
|
+
onDelete: 'CASCADE'
|
|
27
25
|
}, {
|
|
28
|
-
type: '
|
|
26
|
+
type: 'json',
|
|
29
27
|
name: 'context'
|
|
30
28
|
}, {
|
|
31
29
|
type: 'integer',
|
|
@@ -5,26 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
|
+
namespace: 'workflow',
|
|
9
|
+
duplicator: 'required',
|
|
8
10
|
name: 'flow_nodes',
|
|
9
|
-
// model: 'FlowNodeModel',
|
|
10
|
-
title: 'Workflow Nodes',
|
|
11
11
|
fields: [{
|
|
12
|
-
interface: 'string',
|
|
13
12
|
type: 'string',
|
|
14
|
-
name: 'title'
|
|
15
|
-
title: '名称'
|
|
13
|
+
name: 'title'
|
|
16
14
|
}, // which workflow belongs to
|
|
17
15
|
{
|
|
18
|
-
interface: 'linkTo',
|
|
19
16
|
name: 'workflow',
|
|
20
17
|
type: 'belongsTo'
|
|
21
18
|
}, {
|
|
22
|
-
interface: 'linkTo',
|
|
23
19
|
name: 'upstream',
|
|
24
20
|
type: 'belongsTo',
|
|
25
21
|
target: 'flow_nodes'
|
|
26
22
|
}, {
|
|
27
|
-
interface: 'linkTo',
|
|
28
23
|
name: 'branches',
|
|
29
24
|
type: 'hasMany',
|
|
30
25
|
target: 'flow_nodes',
|
|
@@ -34,28 +29,21 @@ var _default = {
|
|
|
34
29
|
// put here because the design of flow-links model is not really necessary for now.
|
|
35
30
|
// or it should be put into flow-links model.
|
|
36
31
|
{
|
|
37
|
-
interface: 'select',
|
|
38
32
|
name: 'branchIndex',
|
|
39
|
-
type: 'integer'
|
|
40
|
-
title: 'branch index'
|
|
33
|
+
type: 'integer'
|
|
41
34
|
}, // Note: for reasons:
|
|
42
35
|
// 1. redirect type node to solve cycle flow.
|
|
43
36
|
// 2. recognize as real next node after branches.
|
|
44
37
|
{
|
|
45
|
-
interface: 'linkTo',
|
|
46
38
|
name: 'downstream',
|
|
47
39
|
type: 'belongsTo',
|
|
48
40
|
target: 'flow_nodes'
|
|
49
41
|
}, {
|
|
50
|
-
interface: 'select',
|
|
51
42
|
type: 'string',
|
|
52
|
-
name: 'type'
|
|
53
|
-
title: '类型'
|
|
43
|
+
name: 'type'
|
|
54
44
|
}, {
|
|
55
|
-
|
|
56
|
-
type: 'jsonb',
|
|
45
|
+
type: 'json',
|
|
57
46
|
name: 'config',
|
|
58
|
-
title: '配置',
|
|
59
47
|
defaultValue: {}
|
|
60
48
|
}]
|
|
61
49
|
};
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
|
+
namespace: 'workflow',
|
|
9
|
+
duplicator: 'optional',
|
|
8
10
|
name: 'jobs',
|
|
9
11
|
fields: [{
|
|
10
12
|
type: 'belongsTo',
|
|
@@ -21,7 +23,7 @@ var _default = {
|
|
|
21
23
|
type: 'integer',
|
|
22
24
|
name: 'status'
|
|
23
25
|
}, {
|
|
24
|
-
type: '
|
|
26
|
+
type: 'json',
|
|
25
27
|
name: 'result'
|
|
26
28
|
}]
|
|
27
29
|
};
|
|
@@ -7,6 +7,8 @@ exports.default = _default;
|
|
|
7
7
|
|
|
8
8
|
function _default() {
|
|
9
9
|
return {
|
|
10
|
+
namespace: 'workflow',
|
|
11
|
+
duplicator: 'required',
|
|
10
12
|
name: 'workflows',
|
|
11
13
|
fields: [{
|
|
12
14
|
name: 'key',
|
|
@@ -27,7 +29,7 @@ function _default() {
|
|
|
27
29
|
name: 'type',
|
|
28
30
|
required: true
|
|
29
31
|
}, {
|
|
30
|
-
type: '
|
|
32
|
+
type: 'json',
|
|
31
33
|
name: 'config',
|
|
32
34
|
required: true,
|
|
33
35
|
defaultValue: {}
|
|
@@ -38,10 +40,12 @@ function _default() {
|
|
|
38
40
|
}, {
|
|
39
41
|
type: 'hasMany',
|
|
40
42
|
name: 'nodes',
|
|
41
|
-
target: 'flow_nodes'
|
|
43
|
+
target: 'flow_nodes',
|
|
44
|
+
onDelete: 'CASCADE'
|
|
42
45
|
}, {
|
|
43
46
|
type: 'hasMany',
|
|
44
|
-
name: 'executions'
|
|
47
|
+
name: 'executions',
|
|
48
|
+
onDelete: 'CASCADE'
|
|
45
49
|
}, {
|
|
46
50
|
type: 'integer',
|
|
47
51
|
name: 'executed',
|
|
@@ -53,7 +57,7 @@ function _default() {
|
|
|
53
57
|
}, {
|
|
54
58
|
type: 'boolean',
|
|
55
59
|
name: 'current',
|
|
56
|
-
defaultValue:
|
|
60
|
+
defaultValue: false
|
|
57
61
|
}, {
|
|
58
62
|
type: 'hasMany',
|
|
59
63
|
name: 'revisions',
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
export declare const EXECUTION_STATUS: {
|
|
2
|
-
|
|
2
|
+
QUEUEING: any;
|
|
3
3
|
STARTED: number;
|
|
4
4
|
RESOLVED: number;
|
|
5
|
-
|
|
5
|
+
FAILED: number;
|
|
6
|
+
ERROR: number;
|
|
7
|
+
ABORTED: number;
|
|
6
8
|
CANCELED: number;
|
|
9
|
+
REJECTED: number;
|
|
7
10
|
};
|
|
8
11
|
export declare const JOB_STATUS: {
|
|
9
12
|
PENDING: number;
|
|
10
13
|
RESOLVED: number;
|
|
11
|
-
|
|
14
|
+
FAILED: number;
|
|
15
|
+
ERROR: number;
|
|
16
|
+
ABORTED: number;
|
|
12
17
|
CANCELED: number;
|
|
18
|
+
REJECTED: number;
|
|
13
19
|
};
|
|
14
20
|
export declare const BRANCH_INDEX: {
|
|
15
21
|
DEFAULT: any;
|
package/lib/server/constants.js
CHANGED
|
@@ -5,18 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.JOB_STATUS = exports.EXECUTION_STATUS = exports.BRANCH_INDEX = void 0;
|
|
7
7
|
const EXECUTION_STATUS = {
|
|
8
|
-
|
|
8
|
+
QUEUEING: null,
|
|
9
9
|
STARTED: 0,
|
|
10
10
|
RESOLVED: 1,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
FAILED: -1,
|
|
12
|
+
ERROR: -2,
|
|
13
|
+
ABORTED: -3,
|
|
14
|
+
CANCELED: -4,
|
|
15
|
+
REJECTED: -5
|
|
13
16
|
};
|
|
14
17
|
exports.EXECUTION_STATUS = EXECUTION_STATUS;
|
|
15
18
|
const JOB_STATUS = {
|
|
16
19
|
PENDING: 0,
|
|
17
20
|
RESOLVED: 1,
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
FAILED: -1,
|
|
22
|
+
ERROR: -2,
|
|
23
|
+
ABORTED: -3,
|
|
24
|
+
CANCELED: -4,
|
|
25
|
+
REJECTED: -5
|
|
20
26
|
};
|
|
21
27
|
exports.JOB_STATUS = JOB_STATUS;
|
|
22
28
|
const BRANCH_INDEX = {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
+
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
20
|
+
function now() {
|
|
21
|
+
return new Date();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function _default({
|
|
25
|
+
functions
|
|
26
|
+
}, more = {}) {
|
|
27
|
+
functions.register('now', now);
|
|
28
|
+
|
|
29
|
+
for (var _i = 0, _Object$entries = Object.entries(more); _i < _Object$entries.length; _i++) {
|
|
30
|
+
const _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
31
|
+
name = _Object$entries$_i[0],
|
|
32
|
+
fn = _Object$entries$_i[1];
|
|
33
|
+
|
|
34
|
+
functions.register(name, fn);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
;
|
package/lib/server/index.d.ts
CHANGED
package/lib/server/index.js
CHANGED
|
@@ -40,20 +40,6 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
var _calculators = require("./calculators");
|
|
44
|
-
|
|
45
|
-
Object.keys(_calculators).forEach(function (key) {
|
|
46
|
-
if (key === "default" || key === "__esModule") return;
|
|
47
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
48
|
-
if (key in exports && exports[key] === _calculators[key]) return;
|
|
49
|
-
Object.defineProperty(exports, key, {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function get() {
|
|
52
|
-
return _calculators[key];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
43
|
var _triggers = require("./triggers");
|
|
58
44
|
|
|
59
45
|
var _Processor = _interopRequireDefault(require("./Processor"));
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const _default:
|
|
3
|
-
run(node: FlowNodeModel, prevJob: any, processor: any): Promise<{
|
|
4
|
-
result: any;
|
|
5
|
-
status: number;
|
|
6
|
-
}>;
|
|
7
|
-
};
|
|
1
|
+
import { Instruction } from ".";
|
|
2
|
+
declare const _default: Instruction;
|
|
8
3
|
export default _default;
|
|
@@ -5,54 +5,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
function _evaluators() {
|
|
9
|
+
const data = _interopRequireDefault(require("@nocobase/evaluators"));
|
|
10
|
+
|
|
11
|
+
_evaluators = function _evaluators() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
var _constants = require("../constants");
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
21
|
|
|
12
22
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
23
|
|
|
14
24
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
15
25
|
|
|
16
|
-
// @calculation: {
|
|
17
|
-
// calculator: 'concat',
|
|
18
|
-
// operands: [
|
|
19
|
-
// {
|
|
20
|
-
// type: 'calculation',
|
|
21
|
-
// options: {
|
|
22
|
-
// calculator: 'add',
|
|
23
|
-
// operands: [{ value: 1 }, { value: 2 }]
|
|
24
|
-
// }
|
|
25
|
-
// },
|
|
26
|
-
// {
|
|
27
|
-
// type: 'constant',
|
|
28
|
-
// value: '{{$context.data.title}}'
|
|
29
|
-
// },
|
|
30
|
-
// {
|
|
31
|
-
// type: 'context',
|
|
32
|
-
// options: {
|
|
33
|
-
// path: 'data.title'
|
|
34
|
-
// }
|
|
35
|
-
// },
|
|
36
|
-
// {
|
|
37
|
-
// type: 'constant',
|
|
38
|
-
// value: 1
|
|
39
|
-
// }
|
|
40
|
-
// ]
|
|
41
|
-
// }
|
|
42
26
|
var _default = {
|
|
43
27
|
run(node, prevJob, processor) {
|
|
44
28
|
return _asyncToGenerator(function* () {
|
|
45
29
|
const _ref = node.config || {},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
_ref$engine = _ref.engine,
|
|
31
|
+
engine = _ref$engine === void 0 ? 'math.js' : _ref$engine,
|
|
32
|
+
_ref$expression = _ref.expression,
|
|
33
|
+
expression = _ref$expression === void 0 ? '' : _ref$expression;
|
|
34
|
+
|
|
35
|
+
const evaluator = _evaluators().default.get(engine);
|
|
36
|
+
|
|
37
|
+
const scope = processor.getScope();
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const result = evaluator && expression ? evaluator(expression, scope) : null;
|
|
41
|
+
return {
|
|
42
|
+
result,
|
|
43
|
+
status: _constants.JOB_STATUS.RESOLVED
|
|
44
|
+
};
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return {
|
|
47
|
+
result: e.toString(),
|
|
48
|
+
status: _constants.JOB_STATUS.ERROR
|
|
49
|
+
};
|
|
50
|
+
}
|
|
56
51
|
})();
|
|
57
52
|
}
|
|
58
53
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Registry } from "@nocobase/utils";
|
|
2
|
+
import { Instruction } from ".";
|
|
3
|
+
export declare const calculators: Registry<Function>;
|
|
4
|
+
declare const _default: Instruction;
|
|
5
5
|
export default _default;
|