@nocobase/plugin-workflow 0.9.4-alpha.2 → 0.10.0-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/lib/client/AddButton.d.ts +2 -2
- package/lib/client/Branch.d.ts +2 -2
- package/lib/client/CanvasContent.d.ts +2 -2
- package/lib/client/ExecutionCanvas.d.ts +2 -2
- package/lib/client/ExecutionCanvas.js +1 -1
- package/lib/client/ExecutionLink.d.ts +2 -1
- package/lib/client/ExecutionPage.d.ts +2 -1
- package/lib/client/ExecutionPage.js +14 -15
- package/lib/client/ExecutionResourceProvider.d.ts +2 -1
- package/lib/client/WorkflowCanvas.d.ts +2 -2
- package/lib/client/WorkflowCanvas.js +31 -31
- package/lib/client/WorkflowLink.d.ts +2 -1
- package/lib/client/WorkflowPage.d.ts +2 -1
- package/lib/client/WorkflowPage.js +11 -10
- package/lib/client/WorkflowProvider.d.ts +1 -1
- package/lib/client/WorkflowProvider.js +15 -15
- package/lib/client/components/CollectionBlockInitializer.d.ts +2 -7
- package/lib/client/components/CollectionBlockInitializer.js +49 -17
- package/lib/client/components/CollectionFieldset.d.ts +2 -2
- package/lib/client/components/CollectionFieldset.js +18 -15
- package/lib/client/components/Duration.d.ts +2 -2
- package/lib/client/components/DynamicExpression.d.ts +3 -1
- package/lib/client/components/DynamicExpression.js +2 -0
- package/lib/client/components/FieldsSelect.d.ts +1 -1
- package/lib/client/components/FieldsSelect.js +2 -0
- package/lib/client/components/FilterDynamicComponent.d.ts +2 -2
- package/lib/client/components/NodeDescription.d.ts +2 -2
- package/lib/client/components/OpenDrawer.d.ts +2 -2
- package/lib/client/components/OpenDrawer.js +1 -1
- package/lib/client/components/RadioWithTooltip.d.ts +2 -2
- package/lib/client/components/renderEngineReference.d.ts +2 -1
- package/lib/client/constants.d.ts +2 -1
- package/lib/client/locale/zh-CN.d.ts +3 -0
- package/lib/client/locale/zh-CN.js +3 -0
- package/lib/client/nodes/aggregate.d.ts +1 -1
- package/lib/client/nodes/calculation.d.ts +4 -3
- package/lib/client/nodes/condition.d.ts +6 -4
- package/lib/client/nodes/condition.js +3 -1
- package/lib/client/nodes/create.d.ts +3 -6
- package/lib/client/nodes/create.js +1 -4
- package/lib/client/nodes/index.d.ts +5 -5
- package/lib/client/nodes/index.js +7 -4
- package/lib/client/nodes/loop.d.ts +4 -1
- package/lib/client/nodes/loop.js +3 -1
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +2 -2
- package/lib/client/nodes/manual/DetailsBlockProvider.d.ts +2 -0
- package/lib/client/nodes/manual/DetailsBlockProvider.js +106 -0
- package/lib/client/nodes/manual/FormBlockInitializer.d.ts +2 -0
- package/lib/client/nodes/manual/FormBlockInitializer.js +106 -0
- package/lib/client/nodes/manual/FormBlockProvider.d.ts +2 -0
- package/lib/client/nodes/manual/FormBlockProvider.js +113 -0
- package/lib/client/nodes/manual/ModeConfig.d.ts +2 -2
- package/lib/client/nodes/manual/SchemaConfig.d.ts +43 -3
- package/lib/client/nodes/manual/SchemaConfig.js +42 -79
- package/lib/client/nodes/manual/WorkflowTodo.d.ts +5 -8
- package/lib/client/nodes/manual/WorkflowTodo.js +111 -76
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -2
- package/lib/client/nodes/manual/forms/create.d.ts +3 -0
- package/lib/client/nodes/manual/forms/create.js +104 -0
- package/lib/client/nodes/manual/forms/custom.d.ts +3 -0
- package/lib/client/nodes/manual/forms/{customForm.js → custom.js} +63 -45
- package/lib/client/nodes/manual/forms/update.d.ts +3 -0
- package/lib/client/nodes/manual/forms/update.js +161 -0
- package/lib/client/nodes/manual/index.d.ts +2 -5
- package/lib/client/nodes/manual/index.js +17 -16
- package/lib/client/nodes/manual/utils.d.ts +2 -0
- package/lib/client/nodes/manual/utils.js +31 -0
- package/lib/client/nodes/parallel.d.ts +4 -1
- package/lib/client/nodes/parallel.js +3 -1
- package/lib/client/nodes/query.d.ts +2 -5
- package/lib/client/nodes/query.js +2 -5
- package/lib/client/nodes/request.d.ts +1 -1
- package/lib/client/nodes/request.js +1 -11
- package/lib/client/nodes/update.d.ts +1 -1
- package/lib/client/schemas/collection.js +1 -1
- package/lib/client/schemas/executions.d.ts +2 -0
- package/lib/client/triggers/collection.d.ts +2 -5
- package/lib/client/triggers/collection.js +5 -8
- package/lib/client/triggers/index.d.ts +1 -2
- package/lib/client/triggers/index.js +4 -3
- package/lib/client/triggers/schedule/DateFieldsSelect.js +14 -12
- package/lib/client/triggers/schedule/EndsByField.d.ts +2 -2
- package/lib/client/triggers/schedule/OnField.d.ts +2 -2
- package/lib/client/triggers/schedule/RepeatField.d.ts +2 -2
- package/lib/client/triggers/schedule/ScheduleConfig.d.ts +2 -1
- package/lib/client/triggers/schedule/index.d.ts +3 -6
- package/lib/client/triggers/schedule/index.js +1 -4
- package/lib/server/Processor.js +1 -2
- package/lib/server/instructions/manual/actions.js +42 -47
- package/lib/server/instructions/manual/forms/create.d.ts +5 -0
- package/lib/server/instructions/manual/forms/create.js +46 -0
- package/lib/server/instructions/manual/forms/index.d.ts +6 -0
- package/lib/server/instructions/manual/forms/index.js +15 -0
- package/lib/server/instructions/manual/forms/update.d.ts +6 -0
- package/lib/server/instructions/manual/forms/update.js +47 -0
- package/lib/server/instructions/manual/index.d.ts +3 -0
- package/lib/server/instructions/manual/index.js +16 -3
- package/lib/server/instructions/request.js +1 -1
- package/lib/server/migrations/20230612021134-manual-collection-block.d.ts +4 -0
- package/lib/server/migrations/20230612021134-manual-collection-block.js +155 -0
- package/package.json +16 -13
- package/lib/client/WorkflowShortcut.d.ts +0 -1
- package/lib/client/WorkflowShortcut.js +0 -48
- package/lib/client/components/CollectionFieldInitializers.d.ts +0 -2
- package/lib/client/components/CollectionFieldInitializers.js +0 -70
- package/lib/client/nodes/manual/forms/customForm.d.ts +0 -40
|
@@ -165,7 +165,7 @@ declare const _default: {
|
|
|
165
165
|
view: {};
|
|
166
166
|
scope: {};
|
|
167
167
|
components: {
|
|
168
|
-
ArrayItems: import("react").FC<import("react").HTMLAttributes<HTMLDivElement>> & import("@formily/antd").ArrayBaseMixins & {
|
|
168
|
+
ArrayItems: import("react").FC<import("react").PropsWithChildren<import("react").HTMLAttributes<HTMLDivElement> & import("@formily/antd").IArrayBaseProps>> & import("@formily/antd").ArrayBaseMixins & {
|
|
169
169
|
Item?: import("react").FC<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
170
170
|
type?: "divide" | "card";
|
|
171
171
|
}>;
|
|
@@ -11,13 +11,6 @@ function _antd() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _css() {
|
|
15
|
-
const data = require("@emotion/css");
|
|
16
|
-
_css = function _css() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
var _locale = require("../locale");
|
|
22
15
|
var _variable = require("../variable");
|
|
23
16
|
var _default = {
|
|
@@ -171,10 +164,7 @@ var _default = {
|
|
|
171
164
|
minRows: 10
|
|
172
165
|
},
|
|
173
166
|
placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
174
|
-
className:
|
|
175
|
-
font-size: 90%;
|
|
176
|
-
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
177
|
-
`)
|
|
167
|
+
className: 'full-width'
|
|
178
168
|
},
|
|
179
169
|
description: `{{t("Only support standard JSON data", { ns: "${_locale.NAMESPACE}" })}}`
|
|
180
170
|
},
|
|
@@ -54,7 +54,7 @@ declare const _default: {
|
|
|
54
54
|
};
|
|
55
55
|
components: {
|
|
56
56
|
FilterDynamicComponent: typeof FilterDynamicComponent;
|
|
57
|
-
CollectionFieldset: import("react").MemoExoticComponent<import("react").
|
|
57
|
+
CollectionFieldset: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
export default _default;
|
|
@@ -82,7 +82,7 @@ const appends = {
|
|
|
82
82
|
'x-component': 'FieldsSelect',
|
|
83
83
|
'x-component-props': {
|
|
84
84
|
mode: 'multiple',
|
|
85
|
-
placeholder: '{{t("Select
|
|
85
|
+
placeholder: '{{t("Select field")}}',
|
|
86
86
|
filter(field) {
|
|
87
87
|
return ['linkTo', 'belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
88
88
|
}
|
|
@@ -59,6 +59,7 @@ export declare const executionCollection: {
|
|
|
59
59
|
"x-editable"?: boolean;
|
|
60
60
|
"x-read-only"?: boolean;
|
|
61
61
|
"x-read-pretty"?: boolean;
|
|
62
|
+
"x-compile-omitted"?: string[];
|
|
62
63
|
}>;
|
|
63
64
|
}[];
|
|
64
65
|
};
|
|
@@ -133,6 +134,7 @@ export declare const executionSchema: {
|
|
|
133
134
|
"x-editable"?: boolean;
|
|
134
135
|
"x-read-only"?: boolean;
|
|
135
136
|
"x-read-pretty"?: boolean;
|
|
137
|
+
"x-compile-omitted"?: string[];
|
|
136
138
|
}>;
|
|
137
139
|
}[];
|
|
138
140
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
|
|
2
|
-
import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
4
|
type: string;
|
|
@@ -104,12 +103,10 @@ declare const _default: {
|
|
|
104
103
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
105
104
|
};
|
|
106
105
|
components: {
|
|
107
|
-
FieldsSelect: import("react").MemoExoticComponent<import("react").
|
|
106
|
+
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
108
107
|
};
|
|
109
108
|
useVariables(config: any, options: any): import("../variable").VariableOption[];
|
|
110
109
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
111
|
-
initializers: {
|
|
112
|
-
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
113
|
-
};
|
|
110
|
+
initializers: {};
|
|
114
111
|
};
|
|
115
112
|
export default _default;
|
|
@@ -11,12 +11,11 @@ function _client() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
var _collection = require("../schemas/collection");
|
|
15
|
-
var _variable = require("../variable");
|
|
16
14
|
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
17
|
-
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
18
|
-
var _locale = require("../locale");
|
|
19
15
|
var _FieldsSelect = require("../components/FieldsSelect");
|
|
16
|
+
var _locale = require("../locale");
|
|
17
|
+
var _collection = require("../schemas/collection");
|
|
18
|
+
var _variable = require("../variable");
|
|
20
19
|
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; }
|
|
21
20
|
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; }
|
|
22
21
|
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; }
|
|
@@ -92,7 +91,7 @@ var _default = {
|
|
|
92
91
|
'x-component': 'FieldsSelect',
|
|
93
92
|
'x-component-props': {
|
|
94
93
|
mode: 'multiple',
|
|
95
|
-
placeholder: '{{t("Select
|
|
94
|
+
placeholder: '{{t("Select field")}}',
|
|
96
95
|
filter(field) {
|
|
97
96
|
return !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
98
97
|
}
|
|
@@ -166,8 +165,6 @@ var _default = {
|
|
|
166
165
|
dataSource: '{{$context.data}}'
|
|
167
166
|
};
|
|
168
167
|
},
|
|
169
|
-
initializers: {
|
|
170
|
-
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
171
|
-
}
|
|
168
|
+
initializers: {}
|
|
172
169
|
};
|
|
173
170
|
exports.default = _default;
|
|
@@ -17,10 +17,9 @@ export interface Trigger {
|
|
|
17
17
|
components?: {
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
};
|
|
20
|
-
render?(props: any): React.ReactNode;
|
|
21
20
|
useInitializers?(config: any): SchemaInitializerItemOptions | null;
|
|
22
21
|
initializers?: any;
|
|
23
22
|
}
|
|
24
23
|
export declare const triggers: Registry<Trigger>;
|
|
25
|
-
export declare const TriggerConfig: () => JSX.Element;
|
|
24
|
+
export declare const TriggerConfig: () => React.JSX.Element;
|
|
26
25
|
export declare function useTrigger(): Trigger;
|
|
@@ -126,7 +126,7 @@ function TriggerExecution() {
|
|
|
126
126
|
'x-component-props': {
|
|
127
127
|
title: _react().default.createElement(_icons().InfoOutlined, null),
|
|
128
128
|
shape: 'circle',
|
|
129
|
-
className:
|
|
129
|
+
className: _style.nodeJobButtonClass,
|
|
130
130
|
type: 'primary'
|
|
131
131
|
},
|
|
132
132
|
properties: {
|
|
@@ -234,7 +234,8 @@ const TriggerConfig = () => {
|
|
|
234
234
|
}
|
|
235
235
|
const whiteSet = new Set(['workflow-node-meta', 'workflow-node-config-button', 'ant-input-disabled']);
|
|
236
236
|
for (let el = ev.target; el && el !== ev.currentTarget; el = el.parentNode) {
|
|
237
|
-
|
|
237
|
+
var _el$classList;
|
|
238
|
+
if (Array.from((_el$classList = el.classList) !== null && _el$classList !== void 0 ? _el$classList : []).some(name => whiteSet.has(name))) {
|
|
238
239
|
setEditingConfig(true);
|
|
239
240
|
ev.stopPropagation();
|
|
240
241
|
return;
|
|
@@ -253,7 +254,7 @@ const TriggerConfig = () => {
|
|
|
253
254
|
onChange: ev => setEditingTitle(ev.target.value),
|
|
254
255
|
onBlur: ev => onChangeTitle(ev.target.value),
|
|
255
256
|
autoSize: true
|
|
256
|
-
})), _react().default.createElement(TriggerExecution, null), _react().default.createElement(_client2().
|
|
257
|
+
})), _react().default.createElement(TriggerExecution, null), _react().default.createElement(_client2().ActionContextProvider, {
|
|
257
258
|
value: {
|
|
258
259
|
visible: editingConfig,
|
|
259
260
|
setVisible: setEditingConfig
|
|
@@ -5,22 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DateFieldsSelect = void 0;
|
|
7
7
|
function _react() {
|
|
8
|
-
const data =
|
|
8
|
+
const data = require("@formily/react");
|
|
9
9
|
_react = function _react() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("
|
|
16
|
-
|
|
14
|
+
function _antd() {
|
|
15
|
+
const data = require("antd");
|
|
16
|
+
_antd = function _antd() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data = require("
|
|
23
|
-
|
|
21
|
+
function _react2() {
|
|
22
|
+
const data = _interopRequireDefault(require("react"));
|
|
23
|
+
_react2 = function _react2() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -45,23 +45,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
45
45
|
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; }
|
|
46
46
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
47
47
|
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); }
|
|
48
|
-
const DateFieldsSelect = (0,
|
|
48
|
+
const DateFieldsSelect = (0, _react().observer)(props => {
|
|
49
49
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
50
50
|
t = _useTranslation.t;
|
|
51
51
|
const compile = (0, _client().useCompile)();
|
|
52
52
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
53
53
|
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
54
|
-
const _useForm = (0,
|
|
54
|
+
const _useForm = (0, _react().useForm)(),
|
|
55
55
|
values = _useForm.values;
|
|
56
56
|
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
57
|
-
return
|
|
58
|
-
placeholder: t('Select
|
|
57
|
+
return _react2().default.createElement(_antd().Select, _objectSpread({
|
|
58
|
+
placeholder: t('Select field')
|
|
59
59
|
}, props), fields.filter(field => !field.hidden && (field.uiSchema ? field.type === 'date' : false)).map(field => {
|
|
60
60
|
var _field$uiSchema;
|
|
61
|
-
return
|
|
61
|
+
return _react2().default.createElement(_antd().Select.Option, {
|
|
62
62
|
key: field.name,
|
|
63
63
|
value: field.name
|
|
64
64
|
}, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
|
|
65
65
|
}));
|
|
66
|
+
}, {
|
|
67
|
+
displayName: 'DateFieldsSelect'
|
|
66
68
|
});
|
|
67
69
|
exports.DateFieldsSelect = DateFieldsSelect;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ScheduleConfig: () => React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCollectionDataSource, SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
|
-
import { CollectionFieldInitializers } from '../../components/CollectionFieldInitializers';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
4
|
type: string;
|
|
@@ -34,15 +33,13 @@ declare const _default: {
|
|
|
34
33
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
35
34
|
};
|
|
36
35
|
components: {
|
|
37
|
-
ScheduleConfig: () => JSX.Element;
|
|
38
|
-
FieldsSelect: import("react").MemoExoticComponent<import("react").
|
|
36
|
+
ScheduleConfig: () => import("react").JSX.Element;
|
|
37
|
+
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
39
38
|
};
|
|
40
39
|
useVariables(config: any, { types }: {
|
|
41
40
|
types: any;
|
|
42
41
|
}): any[];
|
|
43
42
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
44
|
-
initializers: {
|
|
45
|
-
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
46
|
-
};
|
|
43
|
+
initializers: {};
|
|
47
44
|
};
|
|
48
45
|
export default _default;
|
|
@@ -14,7 +14,6 @@ function _client() {
|
|
|
14
14
|
var _ScheduleConfig = require("./ScheduleConfig");
|
|
15
15
|
var _constants = require("./constants");
|
|
16
16
|
var _locale = require("../../locale");
|
|
17
|
-
var _CollectionFieldInitializers = require("../../components/CollectionFieldInitializers");
|
|
18
17
|
var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
|
|
19
18
|
var _variable = require("../../variable");
|
|
20
19
|
var _collection = require("../../schemas/collection");
|
|
@@ -91,8 +90,6 @@ var _default = {
|
|
|
91
90
|
dataSource: '{{$context.data}}'
|
|
92
91
|
};
|
|
93
92
|
},
|
|
94
|
-
initializers: {
|
|
95
|
-
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
96
|
-
}
|
|
93
|
+
initializers: {}
|
|
97
94
|
};
|
|
98
95
|
exports.default = _default;
|
package/lib/server/Processor.js
CHANGED
|
@@ -125,7 +125,6 @@ class Processor {
|
|
|
125
125
|
} else {
|
|
126
126
|
yield _this3.exit(null);
|
|
127
127
|
}
|
|
128
|
-
yield _this3.commit();
|
|
129
128
|
})();
|
|
130
129
|
}
|
|
131
130
|
resume(job) {
|
|
@@ -138,7 +137,6 @@ class Processor {
|
|
|
138
137
|
yield _this4.prepare();
|
|
139
138
|
const node = _this4.nodesMap.get(job.nodeId);
|
|
140
139
|
yield _this4.recall(node, job);
|
|
141
|
-
yield _this4.commit();
|
|
142
140
|
})();
|
|
143
141
|
}
|
|
144
142
|
commit() {
|
|
@@ -250,6 +248,7 @@ class Processor {
|
|
|
250
248
|
}, {
|
|
251
249
|
transaction: _this10.transaction
|
|
252
250
|
});
|
|
251
|
+
yield _this10.commit();
|
|
253
252
|
return null;
|
|
254
253
|
})();
|
|
255
254
|
}
|
|
@@ -25,6 +25,7 @@ function submit(_x, _x2) {
|
|
|
25
25
|
}
|
|
26
26
|
function _submit() {
|
|
27
27
|
_submit = _asyncToGenerator(function* (context, next) {
|
|
28
|
+
var _values$result, _forms$formKey, _forms$formKey$action, _userJob$node$config$2, _userJob$result;
|
|
28
29
|
const repository = _actions().utils.getRepositoryFromParams(context);
|
|
29
30
|
const _context$action$param = context.action.params,
|
|
30
31
|
filterByTk = _context$action$param.filterByTk,
|
|
@@ -34,53 +35,47 @@ function _submit() {
|
|
|
34
35
|
return context.throw(401);
|
|
35
36
|
}
|
|
36
37
|
const plugin = context.app.pm.get('workflow');
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
return function (_x3) {
|
|
80
|
-
return _ref.apply(this, arguments);
|
|
81
|
-
};
|
|
82
|
-
}());
|
|
83
|
-
// await transaction.commit();
|
|
38
|
+
const instruction = plugin.instructions.get('manual');
|
|
39
|
+
const userJob = yield repository.findOne({
|
|
40
|
+
filterByTk,
|
|
41
|
+
// filter: {
|
|
42
|
+
// userId: currentUser?.id
|
|
43
|
+
// },
|
|
44
|
+
appends: ['job', 'node', 'execution', 'workflow'],
|
|
45
|
+
context
|
|
46
|
+
});
|
|
47
|
+
if (!userJob) {
|
|
48
|
+
return context.throw(404);
|
|
49
|
+
}
|
|
50
|
+
const _userJob$node$config$ = userJob.node.config.forms,
|
|
51
|
+
forms = _userJob$node$config$ === void 0 ? {} : _userJob$node$config$;
|
|
52
|
+
const _Object$keys = Object.keys((_values$result = values.result) !== null && _values$result !== void 0 ? _values$result : {}),
|
|
53
|
+
_Object$keys2 = _slicedToArray(_Object$keys, 1),
|
|
54
|
+
formKey = _Object$keys2[0];
|
|
55
|
+
// NOTE: validate status
|
|
56
|
+
if (userJob.status !== _constants.JOB_STATUS.PENDING || userJob.job.status !== _constants.JOB_STATUS.PENDING || userJob.execution.status !== _constants.EXECUTION_STATUS.STARTED || !userJob.workflow.enabled || !((_forms$formKey = forms[formKey]) === null || _forms$formKey === void 0 ? void 0 : (_forms$formKey$action = _forms$formKey.actions) === null || _forms$formKey$action === void 0 ? void 0 : _forms$formKey$action.includes(values.status))) {
|
|
57
|
+
return context.throw(400);
|
|
58
|
+
}
|
|
59
|
+
userJob.execution.workflow = userJob.workflow;
|
|
60
|
+
const processor = plugin.createProcessor(userJob.execution);
|
|
61
|
+
yield processor.prepare();
|
|
62
|
+
// NOTE: validate assignee
|
|
63
|
+
const assignees = processor.getParsedValue((_userJob$node$config$2 = userJob.node.config.assignees) !== null && _userJob$node$config$2 !== void 0 ? _userJob$node$config$2 : []);
|
|
64
|
+
if (!assignees.includes(currentUser.id) || userJob.userId !== currentUser.id) {
|
|
65
|
+
return context.throw(403);
|
|
66
|
+
}
|
|
67
|
+
userJob.set({
|
|
68
|
+
status: values.status,
|
|
69
|
+
result: values.status ? values.result : Object.assign((_userJob$result = userJob.result) !== null && _userJob$result !== void 0 ? _userJob$result : {}, values.result)
|
|
70
|
+
});
|
|
71
|
+
const handler = instruction.formTypes.get(forms[formKey].type);
|
|
72
|
+
if (handler && userJob.status) {
|
|
73
|
+
yield handler.call(instruction, userJob, forms[formKey], processor);
|
|
74
|
+
}
|
|
75
|
+
yield userJob.save({
|
|
76
|
+
transaction: processor.transaction
|
|
77
|
+
});
|
|
78
|
+
yield processor.exit(userJob.job);
|
|
84
79
|
context.body = userJob;
|
|
85
80
|
context.status = 202;
|
|
86
81
|
yield next();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
|
+
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); }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
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); } }
|
|
19
|
+
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); }); }; }
|
|
20
|
+
function _default(_x, _x2, _x3) {
|
|
21
|
+
return _ref.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
function _ref() {
|
|
24
|
+
_ref = _asyncToGenerator(function* (instance, {
|
|
25
|
+
collection
|
|
26
|
+
}, processor) {
|
|
27
|
+
const repo = this.plugin.db.getRepository(collection);
|
|
28
|
+
if (!repo) {
|
|
29
|
+
throw new Error(`collection ${collection} for create data on manual node not found`);
|
|
30
|
+
}
|
|
31
|
+
const _Object$values = Object.values(instance.result),
|
|
32
|
+
_Object$values2 = _slicedToArray(_Object$values, 1),
|
|
33
|
+
values = _Object$values2[0];
|
|
34
|
+
yield repo.create({
|
|
35
|
+
values: _objectSpread(_objectSpread({}, values !== null && values !== void 0 ? values : {}), {}, {
|
|
36
|
+
createdBy: instance.userId,
|
|
37
|
+
updatedBy: instance.userId
|
|
38
|
+
}),
|
|
39
|
+
context: {
|
|
40
|
+
executionId: processor.execution.id
|
|
41
|
+
},
|
|
42
|
+
transaction: processor.transaction
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return _ref.apply(this, arguments);
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Processor } from '../../..';
|
|
2
|
+
import ManualInstruction from '..';
|
|
3
|
+
export declare type FormHandler = (this: ManualInstruction, instance: any, formConfig: any, processor: Processor) => Promise<void>;
|
|
4
|
+
export default function ({ formTypes }: {
|
|
5
|
+
formTypes: any;
|
|
6
|
+
}): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
var _create = _interopRequireDefault(require("./create"));
|
|
8
|
+
var _update = _interopRequireDefault(require("./update"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _default({
|
|
11
|
+
formTypes
|
|
12
|
+
}) {
|
|
13
|
+
formTypes.register('create', _create.default);
|
|
14
|
+
formTypes.register('update', _update.default);
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
|
+
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); }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
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); } }
|
|
19
|
+
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); }); }; }
|
|
20
|
+
function _default(_x, _x2, _x3) {
|
|
21
|
+
return _ref.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
function _ref() {
|
|
24
|
+
_ref = _asyncToGenerator(function* (instance, {
|
|
25
|
+
collection,
|
|
26
|
+
filter = {}
|
|
27
|
+
}, processor) {
|
|
28
|
+
const repo = this.plugin.db.getRepository(collection);
|
|
29
|
+
if (!repo) {
|
|
30
|
+
throw new Error(`collection ${collection} for update data on manual node not found`);
|
|
31
|
+
}
|
|
32
|
+
const _Object$values = Object.values(instance.result),
|
|
33
|
+
_Object$values2 = _slicedToArray(_Object$values, 1),
|
|
34
|
+
values = _Object$values2[0];
|
|
35
|
+
yield repo.update({
|
|
36
|
+
filter: processor.getParsedValue(filter),
|
|
37
|
+
values: _objectSpread(_objectSpread({}, values !== null && values !== void 0 ? values : {}), {}, {
|
|
38
|
+
updatedBy: instance.userId
|
|
39
|
+
}),
|
|
40
|
+
context: {
|
|
41
|
+
executionId: processor.execution.id
|
|
42
|
+
},
|
|
43
|
+
transaction: processor.transaction
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return _ref.apply(this, arguments);
|
|
47
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Registry } from '@nocobase/utils';
|
|
1
2
|
import Plugin from '../..';
|
|
2
3
|
import { Instruction } from '..';
|
|
4
|
+
import { FormHandler } from './forms';
|
|
3
5
|
declare type FormType = {
|
|
4
6
|
type: 'custom' | 'create' | 'update';
|
|
5
7
|
actions: number[];
|
|
@@ -19,6 +21,7 @@ export interface ManualConfig {
|
|
|
19
21
|
}
|
|
20
22
|
export default class implements Instruction {
|
|
21
23
|
protected plugin: Plugin;
|
|
24
|
+
formTypes: Registry<FormHandler>;
|
|
22
25
|
constructor(plugin: Plugin);
|
|
23
26
|
run(node: any, prevJob: any, processor: any): Promise<any>;
|
|
24
27
|
resume(node: any, job: any, processor: any): Promise<any>;
|