@nocobase/plugin-workflow 0.9.2-alpha.3 → 0.9.3-alpha.1
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/client/components/DynamicExpression.js +19 -19
- package/lib/client/components/FieldsSelect.js +2 -1
- package/lib/client/components/renderEngineReference.js +9 -9
- package/lib/client/interfaces/expression.js +2 -1
- package/lib/client/nodes/calculation.d.ts +1 -1
- package/lib/client/nodes/calculation.js +21 -21
- package/lib/client/nodes/condition.d.ts +1 -1
- package/lib/client/nodes/condition.js +30 -30
- package/lib/client/nodes/create.d.ts +1 -0
- package/lib/client/nodes/destroy.d.ts +1 -0
- package/lib/client/nodes/index.js +1 -8
- package/lib/client/nodes/manual/WorkflowTodo.js +1 -8
- package/lib/client/nodes/query.d.ts +1 -0
- package/lib/client/nodes/update.d.ts +1 -0
- package/lib/client/schemas/collection.d.ts +1 -0
- package/lib/client/schemas/collection.js +1 -0
- package/lib/client/triggers/collection.d.ts +2 -0
- package/lib/client/triggers/collection.js +1 -0
- package/lib/client/variable.js +1 -1
- package/lib/server/Plugin.d.ts +5 -2
- package/lib/server/Processor.d.ts +2 -2
- package/lib/server/Processor.js +8 -9
- package/lib/server/functions/index.d.ts +7 -1
- package/lib/server/instructions/calculation.js +9 -10
- package/lib/server/instructions/condition.js +7 -8
- package/package.json +12 -13
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DynamicExpression = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireWildcard(require("react"));
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _core() {
|
|
15
8
|
const data = require("@formily/core");
|
|
16
9
|
_core = function _core() {
|
|
@@ -18,9 +11,9 @@ function _core() {
|
|
|
18
11
|
};
|
|
19
12
|
return data;
|
|
20
13
|
}
|
|
21
|
-
function
|
|
14
|
+
function _react() {
|
|
22
15
|
const data = require("@formily/react");
|
|
23
|
-
|
|
16
|
+
_react = function _react() {
|
|
24
17
|
return data;
|
|
25
18
|
};
|
|
26
19
|
return data;
|
|
@@ -32,6 +25,13 @@ function _antd() {
|
|
|
32
25
|
};
|
|
33
26
|
return data;
|
|
34
27
|
}
|
|
28
|
+
function _react2() {
|
|
29
|
+
const data = _interopRequireWildcard(require("react"));
|
|
30
|
+
_react2 = function _react2() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
35
|
function _reactI18next() {
|
|
36
36
|
const data = require("react-i18next");
|
|
37
37
|
_reactI18next = function _reactI18next() {
|
|
@@ -61,15 +61,15 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
61
61
|
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; }
|
|
62
62
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
63
63
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
64
|
-
const InternalExpression = (0,
|
|
64
|
+
const InternalExpression = (0, _react().observer)(props => {
|
|
65
65
|
const onChange = props.onChange;
|
|
66
|
-
const _useForm = (0,
|
|
66
|
+
const _useForm = (0, _react().useForm)(),
|
|
67
67
|
values = _useForm.values;
|
|
68
|
-
const _useState = (0,
|
|
68
|
+
const _useState = (0, _react2().useState)(values === null || values === void 0 ? void 0 : values.sourceCollection),
|
|
69
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
70
70
|
collection = _useState2[0],
|
|
71
71
|
setCollection = _useState2[1];
|
|
72
|
-
(0,
|
|
72
|
+
(0, _react().useFormEffects)(() => {
|
|
73
73
|
(0, _core().onFormInitialValuesChange)(form => {
|
|
74
74
|
setCollection(form.values.sourceCollection);
|
|
75
75
|
});
|
|
@@ -79,9 +79,9 @@ const InternalExpression = (0, _react2().observer)(props => {
|
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
const options = (0, _variable.useCollectionFieldOptions)({
|
|
82
|
-
collection
|
|
82
|
+
collection: collection
|
|
83
83
|
});
|
|
84
|
-
return
|
|
84
|
+
return _react2().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
85
85
|
scope: options
|
|
86
86
|
}));
|
|
87
87
|
});
|
|
@@ -89,14 +89,14 @@ function Result(props) {
|
|
|
89
89
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
90
90
|
t = _useTranslation.t;
|
|
91
91
|
const values = (0, _client().useRecord)();
|
|
92
|
-
const options = (0,
|
|
92
|
+
const options = (0, _react2().useMemo)(() => (0, _variable.useCollectionFieldOptions)({
|
|
93
93
|
collection: values.sourceCollection
|
|
94
94
|
}), [values.sourceCollection, values.sourceCollection]);
|
|
95
|
-
return props.value ?
|
|
95
|
+
return props.value ? _react2().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
96
96
|
scope: options
|
|
97
|
-
})) :
|
|
97
|
+
})) : _react2().default.createElement(_antd().Tag, null, t('Unconfigured', {
|
|
98
98
|
ns: _locale.NAMESPACE
|
|
99
99
|
}));
|
|
100
100
|
}
|
|
101
|
-
const DynamicExpression = (0,
|
|
101
|
+
const DynamicExpression = (0, _react().connect)(InternalExpression, (0, _react().mapReadPretty)(Result));
|
|
102
102
|
exports.DynamicExpression = DynamicExpression;
|
|
@@ -52,7 +52,8 @@ const FieldsSelect = (0, _react2().observer)(props => {
|
|
|
52
52
|
values = _useForm.values;
|
|
53
53
|
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
54
54
|
return _react().default.createElement(_antd().Select, _objectSpread(_objectSpread({
|
|
55
|
-
className: "full-width"
|
|
55
|
+
className: "full-width",
|
|
56
|
+
dropdownMatchSelectWidth: false
|
|
56
57
|
}, others), {}, {
|
|
57
58
|
options: fields.filter(filter).map(field => {
|
|
58
59
|
var _field$uiSchema;
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderEngineReference = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireDefault(require("react"));
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _css() {
|
|
15
8
|
const data = require("@emotion/css");
|
|
16
9
|
_css = function _css() {
|
|
@@ -26,15 +19,22 @@ function _client() {
|
|
|
26
19
|
return data;
|
|
27
20
|
}
|
|
28
21
|
function _client2() {
|
|
29
|
-
const data =
|
|
22
|
+
const data = require("@nocobase/evaluators/client");
|
|
30
23
|
_client2 = function _client2() {
|
|
31
24
|
return data;
|
|
32
25
|
};
|
|
33
26
|
return data;
|
|
34
27
|
}
|
|
28
|
+
function _react() {
|
|
29
|
+
const data = _interopRequireDefault(require("react"));
|
|
30
|
+
_react = function _react() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
36
|
const renderEngineReference = key => {
|
|
37
|
-
const engine = _client2().
|
|
37
|
+
const engine = _client2().evaluators.get(key);
|
|
38
38
|
if (!engine) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
|
-
import { useWorkflowVariableOptions } from '../variable';
|
|
3
2
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
3
|
+
import { useWorkflowVariableOptions } from '../variable';
|
|
4
4
|
declare function useWorkflowVariableEntityOptions(): {
|
|
5
5
|
label: any;
|
|
6
6
|
value: any;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _css() {
|
|
8
|
+
const data = require("@emotion/css");
|
|
9
|
+
_css = function _css() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -18,23 +18,23 @@ function _antd() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data = require("@
|
|
23
|
-
|
|
21
|
+
function _client() {
|
|
22
|
+
const data = require("@nocobase/client");
|
|
23
|
+
_client = function _client() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data =
|
|
30
|
-
|
|
28
|
+
function _client2() {
|
|
29
|
+
const data = require("@nocobase/evaluators/client");
|
|
30
|
+
_client2 = function _client2() {
|
|
31
31
|
return data;
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const data = require("
|
|
37
|
-
|
|
35
|
+
function _client3() {
|
|
36
|
+
const data = require("@nocobase/utils/client");
|
|
37
|
+
_client3 = function _client3() {
|
|
38
38
|
return data;
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
@@ -46,25 +46,25 @@ function _antd2() {
|
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const data = require("
|
|
51
|
-
|
|
49
|
+
function _react() {
|
|
50
|
+
const data = _interopRequireDefault(require("react"));
|
|
51
|
+
_react = function _react() {
|
|
52
52
|
return data;
|
|
53
53
|
};
|
|
54
54
|
return data;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const data = require("
|
|
58
|
-
|
|
56
|
+
function _reactI18next() {
|
|
57
|
+
const data = require("react-i18next");
|
|
58
|
+
_reactI18next = function _reactI18next() {
|
|
59
59
|
return data;
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
63
|
var _FlowContext = require("../FlowContext");
|
|
64
|
-
var _locale = require("../locale");
|
|
65
|
-
var _variable = require("../variable");
|
|
66
64
|
var _RadioWithTooltip = require("../components/RadioWithTooltip");
|
|
67
65
|
var _renderEngineReference = require("../components/renderEngineReference");
|
|
66
|
+
var _locale = require("../locale");
|
|
67
|
+
var _variable = require("../variable");
|
|
68
68
|
const _excluded = ["node", "insert"];
|
|
69
69
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
70
70
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -231,7 +231,7 @@ var _default = {
|
|
|
231
231
|
if (!execution) {
|
|
232
232
|
return (0, _locale.lang)('Calculation result');
|
|
233
233
|
}
|
|
234
|
-
const result = (0,
|
|
234
|
+
const result = (0, _client3().parse)(dataSource)({
|
|
235
235
|
$jobsMapByNodeId: ((_execution$jobs = execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
|
|
236
236
|
[job.nodeId]: job.result
|
|
237
237
|
}), {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Registry } from '@nocobase/utils/client';
|
|
3
|
-
import { useWorkflowVariableOptions } from '../variable';
|
|
4
3
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
4
|
+
import { useWorkflowVariableOptions } from '../variable';
|
|
5
5
|
interface Calculator {
|
|
6
6
|
name: string;
|
|
7
7
|
type: 'boolean' | 'number' | 'string' | 'date' | 'unknown' | 'null' | 'array';
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Calculation = Calculation;
|
|
7
7
|
exports.default = exports.calculators = void 0;
|
|
8
|
-
function
|
|
9
|
-
const data =
|
|
10
|
-
|
|
8
|
+
function _icons() {
|
|
9
|
+
const data = require("@ant-design/icons");
|
|
10
|
+
_icons = function _icons() {
|
|
11
11
|
return data;
|
|
12
12
|
};
|
|
13
13
|
return data;
|
|
@@ -19,44 +19,44 @@ function _css() {
|
|
|
19
19
|
};
|
|
20
20
|
return data;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const data = require("
|
|
24
|
-
|
|
22
|
+
function _client() {
|
|
23
|
+
const data = require("@nocobase/client");
|
|
24
|
+
_client = function _client() {
|
|
25
25
|
return data;
|
|
26
26
|
};
|
|
27
27
|
return data;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const data = require("@
|
|
31
|
-
|
|
29
|
+
function _client2() {
|
|
30
|
+
const data = require("@nocobase/evaluators/client");
|
|
31
|
+
_client2 = function _client2() {
|
|
32
32
|
return data;
|
|
33
33
|
};
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const data = require("
|
|
38
|
-
|
|
36
|
+
function _client3() {
|
|
37
|
+
const data = require("@nocobase/utils/client");
|
|
38
|
+
_client3 = function _client3() {
|
|
39
39
|
return data;
|
|
40
40
|
};
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const data = require("
|
|
45
|
-
|
|
43
|
+
function _antd() {
|
|
44
|
+
const data = require("antd");
|
|
45
|
+
_antd = function _antd() {
|
|
46
46
|
return data;
|
|
47
47
|
};
|
|
48
48
|
return data;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const data = require("
|
|
52
|
-
|
|
50
|
+
function _react() {
|
|
51
|
+
const data = _interopRequireDefault(require("react"));
|
|
52
|
+
_react = function _react() {
|
|
53
53
|
return data;
|
|
54
54
|
};
|
|
55
55
|
return data;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const data = require("
|
|
59
|
-
|
|
57
|
+
function _reactI18next() {
|
|
58
|
+
const data = require("react-i18next");
|
|
59
|
+
_reactI18next = function _reactI18next() {
|
|
60
60
|
return data;
|
|
61
61
|
};
|
|
62
62
|
return data;
|
|
@@ -64,18 +64,18 @@ function _client3() {
|
|
|
64
64
|
var _ = require(".");
|
|
65
65
|
var _Branch = require("../Branch");
|
|
66
66
|
var _FlowContext = require("../FlowContext");
|
|
67
|
-
var _style = require("../style");
|
|
68
|
-
var _locale = require("../locale");
|
|
69
|
-
var _variable = require("../variable");
|
|
70
67
|
var _RadioWithTooltip = require("../components/RadioWithTooltip");
|
|
71
68
|
var _renderEngineReference = require("../components/renderEngineReference");
|
|
69
|
+
var _locale = require("../locale");
|
|
70
|
+
var _style = require("../style");
|
|
71
|
+
var _variable = require("../variable");
|
|
72
72
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
73
73
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
74
74
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
75
75
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
76
76
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
77
77
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
78
|
-
const calculators = new (
|
|
78
|
+
const calculators = new (_client3().Registry)();
|
|
79
79
|
exports.calculators = calculators;
|
|
80
80
|
calculators.register('equal', {
|
|
81
81
|
name: '=',
|
|
@@ -188,7 +188,7 @@ function Calculation({
|
|
|
188
188
|
operands = [],
|
|
189
189
|
onChange: _onChange
|
|
190
190
|
}) {
|
|
191
|
-
const compile = (0,
|
|
191
|
+
const compile = (0, _client().useCompile)();
|
|
192
192
|
const options = (0, _variable.useWorkflowVariableOptions)();
|
|
193
193
|
return _react().default.createElement("fieldset", {
|
|
194
194
|
className: (0, _css().css)`
|
|
@@ -197,7 +197,7 @@ function Calculation({
|
|
|
197
197
|
align-items: center;
|
|
198
198
|
flex-wrap: wrap;
|
|
199
199
|
`
|
|
200
|
-
}, _react().default.createElement(
|
|
200
|
+
}, _react().default.createElement(_client().Variable.Input, {
|
|
201
201
|
value: operands[0],
|
|
202
202
|
onChange: v => _onChange({
|
|
203
203
|
calculator,
|
|
@@ -220,7 +220,7 @@ function Calculation({
|
|
|
220
220
|
}]) => _react().default.createElement(_antd().Select.Option, {
|
|
221
221
|
key: value,
|
|
222
222
|
value: value
|
|
223
|
-
}, compile(name)))))), _react().default.createElement(
|
|
223
|
+
}, compile(name)))))), _react().default.createElement(_client().Variable.Input, {
|
|
224
224
|
value: operands[1],
|
|
225
225
|
onChange: v => _onChange({
|
|
226
226
|
calculator,
|
|
@@ -405,7 +405,7 @@ var _default = {
|
|
|
405
405
|
'x-component-props': {
|
|
406
406
|
options: [['basic', {
|
|
407
407
|
label: `{{t("Basic", { ns: "${_locale.NAMESPACE}" })}}`
|
|
408
|
-
}], ...Array.from(
|
|
408
|
+
}], ...Array.from(_client2().evaluators.getEntities())].reduce((result, [value, options]) => result.concat(_objectSpread({
|
|
409
409
|
value
|
|
410
410
|
}, options)), [])
|
|
411
411
|
},
|
|
@@ -439,7 +439,7 @@ var _default = {
|
|
|
439
439
|
form
|
|
440
440
|
}) {
|
|
441
441
|
const values = form.values;
|
|
442
|
-
const _evaluators$get =
|
|
442
|
+
const _evaluators$get = _client2().evaluators.get(values.engine),
|
|
443
443
|
evaluate = _evaluators$get.evaluate;
|
|
444
444
|
const exp = value.trim().replace(/{{([^{}]+)}}/g, ' 1 ');
|
|
445
445
|
try {
|
|
@@ -53,13 +53,6 @@ function _reactI18next() {
|
|
|
53
53
|
};
|
|
54
54
|
return data;
|
|
55
55
|
}
|
|
56
|
-
function _jsonTemplates() {
|
|
57
|
-
const data = _interopRequireDefault(require("json-templates"));
|
|
58
|
-
_jsonTemplates = function _jsonTemplates() {
|
|
59
|
-
return data;
|
|
60
|
-
};
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
56
|
function _client() {
|
|
64
57
|
const data = require("@nocobase/utils/client");
|
|
65
58
|
_client = function _client() {
|
|
@@ -229,7 +222,7 @@ function RemoveButton() {
|
|
|
229
222
|
if (node === current) {
|
|
230
223
|
return false;
|
|
231
224
|
}
|
|
232
|
-
const template = (0,
|
|
225
|
+
const template = (0, _client().parse)(node.config);
|
|
233
226
|
const refs = template.parameters.filter(({
|
|
234
227
|
key
|
|
235
228
|
}) => key.startsWith(`$jobsMapByNodeId.${current.id}.`) || key === `$jobsMapByNodeId.${current.id}`);
|
|
@@ -25,13 +25,6 @@ function _antd() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function _jsonTemplates() {
|
|
29
|
-
const data = _interopRequireDefault(require("json-templates"));
|
|
30
|
-
_jsonTemplates = function _jsonTemplates() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
28
|
function _css() {
|
|
36
29
|
const data = require("@emotion/css");
|
|
37
30
|
_css = function _css() {
|
|
@@ -468,7 +461,7 @@ function useFlowRecordFromBlock(opts) {
|
|
|
468
461
|
dataSource = _useFieldSchema['x-context-datasource'];
|
|
469
462
|
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
470
463
|
execution = _useFlowContext.execution;
|
|
471
|
-
const result = (0,
|
|
464
|
+
const result = (0, _client2().parse)(dataSource)({
|
|
472
465
|
$context: execution === null || execution === void 0 ? void 0 : execution.context,
|
|
473
466
|
$jobsMapByNodeId: ((_execution$jobs = execution === null || execution === void 0 ? void 0 : execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
|
|
474
467
|
[job.nodeId]: job.result
|
|
@@ -20,6 +20,7 @@ declare const _default: {
|
|
|
20
20
|
'x-decorator': string;
|
|
21
21
|
'x-component': string;
|
|
22
22
|
'x-component-props': {
|
|
23
|
+
dropdownMatchSelectWidth: boolean;
|
|
23
24
|
placeholder: string;
|
|
24
25
|
};
|
|
25
26
|
};
|
|
@@ -29,6 +30,7 @@ declare const _default: {
|
|
|
29
30
|
'x-decorator': string;
|
|
30
31
|
'x-component': string;
|
|
31
32
|
'x-component-props': {
|
|
33
|
+
dropdownMatchSelectWidth: boolean;
|
|
32
34
|
options: {
|
|
33
35
|
label: string;
|
|
34
36
|
value: number;
|
package/lib/client/variable.js
CHANGED
|
@@ -81,7 +81,7 @@ function matchFieldType(field, type) {
|
|
|
81
81
|
const inputType = typeof type;
|
|
82
82
|
if (inputType === 'string') {
|
|
83
83
|
var _BaseTypeSets$type;
|
|
84
|
-
return
|
|
84
|
+
return (_BaseTypeSets$type = BaseTypeSets[type]) === null || _BaseTypeSets$type === void 0 ? void 0 : _BaseTypeSets$type.has(field.interface);
|
|
85
85
|
}
|
|
86
86
|
if (inputType === 'object' && type.type === 'reference') {
|
|
87
87
|
if (isAssociationField(field)) {
|
package/lib/server/Plugin.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import ExecutionModel from './models/Execution';
|
|
|
5
5
|
import WorkflowModel from './models/Workflow';
|
|
6
6
|
import Processor from './Processor';
|
|
7
7
|
import { Trigger } from './triggers';
|
|
8
|
+
import { CustomFunction } from './functions';
|
|
8
9
|
import { Logger } from '@nocobase/logger';
|
|
9
10
|
declare type ID = number | string;
|
|
10
11
|
export default class WorkflowPlugin extends Plugin {
|
|
11
12
|
instructions: Registry<Instruction>;
|
|
12
13
|
triggers: Registry<Trigger>;
|
|
13
|
-
functions: Registry<
|
|
14
|
+
functions: Registry<CustomFunction>;
|
|
14
15
|
private executing;
|
|
15
16
|
private pending;
|
|
16
17
|
private events;
|
|
@@ -19,7 +20,9 @@ export default class WorkflowPlugin extends Plugin {
|
|
|
19
20
|
onBeforeSave: (instance: WorkflowModel, options: any) => Promise<void>;
|
|
20
21
|
load(): Promise<void>;
|
|
21
22
|
toggle(workflow: WorkflowModel, enable?: boolean): void;
|
|
22
|
-
trigger(workflow: WorkflowModel, context:
|
|
23
|
+
trigger(workflow: WorkflowModel, context: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}, options?: {
|
|
23
26
|
context?: any;
|
|
24
27
|
}): void;
|
|
25
28
|
private prepare;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Logger } from '@nocobase/logger';
|
|
1
2
|
import { Transaction, Transactionable } from 'sequelize';
|
|
2
3
|
import Plugin from '.';
|
|
3
4
|
import ExecutionModel from './models/Execution';
|
|
4
|
-
import JobModel from './models/Job';
|
|
5
5
|
import FlowNodeModel from './models/FlowNode';
|
|
6
|
-
import
|
|
6
|
+
import JobModel from './models/Job';
|
|
7
7
|
export interface ProcessorOptions extends Transactionable {
|
|
8
8
|
plugin: Plugin;
|
|
9
9
|
}
|
package/lib/server/Processor.js
CHANGED
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function _jsonTemplates() {
|
|
8
|
-
const data = _interopRequireDefault(require("json-templates"));
|
|
9
|
-
_jsonTemplates = function _jsonTemplates() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _database() {
|
|
15
8
|
const data = require("@nocobase/database");
|
|
16
9
|
_database = function _database() {
|
|
@@ -25,8 +18,14 @@ function _evaluators() {
|
|
|
25
18
|
};
|
|
26
19
|
return data;
|
|
27
20
|
}
|
|
21
|
+
function _utils() {
|
|
22
|
+
const data = require("@nocobase/utils");
|
|
23
|
+
_utils = function _utils() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
28
|
var _constants = require("./constants");
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
31
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -350,7 +349,7 @@ class Processor {
|
|
|
350
349
|
};
|
|
351
350
|
}
|
|
352
351
|
getParsedValue(value, node) {
|
|
353
|
-
const template = (0,
|
|
352
|
+
const template = (0, _utils().parse)(value);
|
|
354
353
|
const scope = this.getScope(node);
|
|
355
354
|
template.parameters.forEach(({
|
|
356
355
|
key
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import Plugin from '..';
|
|
2
|
+
import ExecutionModel from '../models/Execution';
|
|
3
|
+
import FlowNodeModel from '../models/FlowNode';
|
|
4
|
+
export declare type CustomFunction = (this: {
|
|
5
|
+
execution: ExecutionModel;
|
|
6
|
+
node?: FlowNodeModel;
|
|
7
|
+
}) => any;
|
|
2
8
|
export default function ({ functions }: Plugin, more?: {
|
|
3
|
-
[key: string]:
|
|
9
|
+
[key: string]: CustomFunction;
|
|
4
10
|
}): void;
|
|
@@ -4,22 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _evaluators() {
|
|
8
|
+
const data = require("@nocobase/evaluators");
|
|
9
|
+
_evaluators = function _evaluators() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data =
|
|
16
|
-
|
|
14
|
+
function _utils() {
|
|
15
|
+
const data = require("@nocobase/utils");
|
|
16
|
+
_utils = function _utils() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
var _constants = require("../constants");
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
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); } }
|
|
24
23
|
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); }); }; }
|
|
25
24
|
var _default = {
|
|
@@ -36,12 +35,12 @@ var _default = {
|
|
|
36
35
|
let scope = processor.getScope();
|
|
37
36
|
if (dynamic) {
|
|
38
37
|
var _parse, _parse2, _node$config$scope;
|
|
39
|
-
const parsed = (_parse = (0,
|
|
38
|
+
const parsed = (_parse = (0, _utils().parse)(dynamic)(scope)) !== null && _parse !== void 0 ? _parse : {};
|
|
40
39
|
engine = parsed.engine;
|
|
41
40
|
expression = parsed.expression;
|
|
42
|
-
scope = (_parse2 = (0,
|
|
41
|
+
scope = (_parse2 = (0, _utils().parse)((_node$config$scope = node.config.scope) !== null && _node$config$scope !== void 0 ? _node$config$scope : '')(scope)) !== null && _parse2 !== void 0 ? _parse2 : {};
|
|
43
42
|
}
|
|
44
|
-
const evaluator = _evaluators().
|
|
43
|
+
const evaluator = _evaluators().evaluators.get(engine);
|
|
45
44
|
try {
|
|
46
45
|
const result = evaluator && expression ? evaluator(expression, scope) : null;
|
|
47
46
|
return {
|
|
@@ -4,22 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.calculators = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@nocobase/
|
|
9
|
-
|
|
7
|
+
function _evaluators() {
|
|
8
|
+
const data = require("@nocobase/evaluators");
|
|
9
|
+
_evaluators = function _evaluators() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data =
|
|
16
|
-
|
|
14
|
+
function _utils() {
|
|
15
|
+
const data = require("@nocobase/utils");
|
|
16
|
+
_utils = function _utils() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
var _constants = require("../constants");
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
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); } }
|
|
24
23
|
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); }); }; }
|
|
25
24
|
const calculators = new (_utils().Registry)();
|
|
@@ -106,7 +105,7 @@ var _default = {
|
|
|
106
105
|
calculation = _ref.calculation,
|
|
107
106
|
expression = _ref.expression,
|
|
108
107
|
rejectOnFalse = _ref.rejectOnFalse;
|
|
109
|
-
const evaluator = _evaluators().
|
|
108
|
+
const evaluator = _evaluators().evaluators.get(engine);
|
|
110
109
|
let result = true;
|
|
111
110
|
try {
|
|
112
111
|
result = evaluator ? evaluator(expression, processor.getScope()) : logicCalculate(processor.getParsedValue(calculation));
|
package/package.json
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-workflow",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/actions": "0.9.
|
|
10
|
-
"@nocobase/client": "0.9.
|
|
11
|
-
"@nocobase/database": "0.9.
|
|
12
|
-
"@nocobase/evaluators": "0.9.
|
|
13
|
-
"@nocobase/logger": "0.9.
|
|
14
|
-
"@nocobase/resourcer": "0.9.
|
|
15
|
-
"@nocobase/server": "0.9.
|
|
16
|
-
"@nocobase/utils": "0.9.
|
|
9
|
+
"@nocobase/actions": "0.9.3-alpha.1",
|
|
10
|
+
"@nocobase/client": "0.9.3-alpha.1",
|
|
11
|
+
"@nocobase/database": "0.9.3-alpha.1",
|
|
12
|
+
"@nocobase/evaluators": "0.9.3-alpha.1",
|
|
13
|
+
"@nocobase/logger": "0.9.3-alpha.1",
|
|
14
|
+
"@nocobase/resourcer": "0.9.3-alpha.1",
|
|
15
|
+
"@nocobase/server": "0.9.3-alpha.1",
|
|
16
|
+
"@nocobase/utils": "0.9.3-alpha.1",
|
|
17
17
|
"antd": "4.22.8",
|
|
18
18
|
"axios": "^0.27.2",
|
|
19
19
|
"classnames": "^2.3.1",
|
|
20
20
|
"cron-parser": "4.4.0",
|
|
21
|
-
"json-templates": "^4.2.0",
|
|
22
21
|
"lru-cache": "8.0.5",
|
|
23
22
|
"moment": "^2.29.2",
|
|
24
23
|
"react-js-cron": "^3.1.0"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@nocobase/plugin-formula-field": "0.9.
|
|
28
|
-
"@nocobase/test": "0.9.
|
|
26
|
+
"@nocobase/plugin-formula-field": "0.9.3-alpha.1",
|
|
27
|
+
"@nocobase/test": "0.9.3-alpha.1",
|
|
29
28
|
"@types/ejs": "^3.1.1"
|
|
30
29
|
},
|
|
31
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "24979bc561537c0b84469c161eeef1a6de4c4684"
|
|
32
31
|
}
|