@nocobase/plugin-workflow 0.9.2-alpha.4 → 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/FieldsSelect.js +2 -1
- package/lib/client/nodes/calculation.js +7 -7
- 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.js +4 -5
- package/lib/server/functions/index.d.ts +7 -1
- package/lib/server/instructions/calculation.js +5 -6
- package/package.json +12 -13
|
@@ -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;
|
|
@@ -32,16 +32,16 @@ function _client2() {
|
|
|
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;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const data =
|
|
44
|
-
|
|
42
|
+
function _antd2() {
|
|
43
|
+
const data = require("antd");
|
|
44
|
+
_antd2 = function _antd2() {
|
|
45
45
|
return data;
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
@@ -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
|
}), {})
|
|
@@ -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;
|
package/lib/server/Processor.js
CHANGED
|
@@ -18,15 +18,14 @@ function _evaluators() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _utils() {
|
|
22
|
+
const data = require("@nocobase/utils");
|
|
23
|
+
_utils = function _utils() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
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;
|
|
@@ -11,15 +11,14 @@ function _evaluators() {
|
|
|
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,10 +35,10 @@ 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
43
|
const evaluator = _evaluators().evaluators.get(engine);
|
|
45
44
|
try {
|
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
|
}
|