@nocobase/plugin-workflow 0.10.1-alpha.1 → 0.11.0-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/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/AddButton.js +1 -8
- package/lib/client/Branch.js +8 -8
- package/lib/client/CanvasContent.js +8 -8
- package/lib/client/ExecutionCanvas.js +20 -27
- package/lib/client/ExecutionPage.js +1 -8
- package/lib/client/WorkflowCanvas.js +3 -10
- package/lib/client/WorkflowPage.js +1 -8
- package/lib/client/WorkflowProvider.js +3 -42
- package/lib/client/components/CollectionFieldset.d.ts +1 -1
- package/lib/client/components/CollectionFieldset.js +8 -15
- package/lib/client/components/Duration.js +5 -5
- package/lib/client/components/DynamicExpression.d.ts +3 -3
- package/lib/client/components/FieldsSelect.d.ts +1 -1
- package/lib/client/components/FieldsSelect.js +6 -6
- package/lib/client/components/NodeDescription.js +11 -11
- package/lib/client/components/RadioWithTooltip.js +13 -20
- package/lib/client/components/ValueBlock.js +14 -21
- package/lib/client/components/renderEngineReference.js +1 -8
- package/lib/client/index.d.ts +12 -4
- package/lib/client/index.js +78 -15
- package/lib/client/nodes/aggregate.d.ts +2 -2
- package/lib/client/nodes/aggregate.js +1 -1
- package/lib/client/nodes/calculation.d.ts +1 -1
- package/lib/client/nodes/calculation.js +16 -23
- package/lib/client/nodes/condition.d.ts +1 -3
- package/lib/client/nodes/condition.js +13 -20
- package/lib/client/nodes/create.d.ts +4 -3
- package/lib/client/nodes/destroy.d.ts +1 -1
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +79 -86
- package/lib/client/nodes/loop.d.ts +1 -1
- package/lib/client/nodes/loop.js +35 -34
- package/lib/client/nodes/manual/ModeConfig.js +23 -30
- package/lib/client/nodes/manual/SchemaConfig.d.ts +3 -3
- package/lib/client/nodes/manual/SchemaConfig.js +18 -17
- package/lib/client/nodes/manual/WorkflowTodo.js +61 -69
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -5
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +6 -5
- package/lib/client/nodes/manual/forms/custom.js +11 -18
- package/lib/client/nodes/parallel.js +20 -20
- package/lib/client/nodes/query.d.ts +3 -2
- package/lib/client/nodes/request.d.ts +2 -2
- package/lib/client/nodes/request.js +7 -7
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +1 -1
- package/lib/client/schemas/collection.d.ts +1 -1
- package/lib/client/schemas/collection.js +3 -10
- package/lib/client/style.js +18 -18
- package/lib/client/triggers/collection.d.ts +4 -3
- package/lib/client/triggers/collection.js +1 -1
- package/lib/client/triggers/index.d.ts +2 -2
- package/lib/client/triggers/index.js +45 -52
- package/lib/client/triggers/schedule/DateFieldsSelect.js +1 -1
- package/lib/client/triggers/schedule/EndsByField.js +11 -11
- package/lib/client/triggers/schedule/OnField.js +11 -11
- package/lib/client/triggers/schedule/RepeatField.js +4 -4
- package/lib/client/triggers/schedule/ScheduleConfig.js +17 -24
- package/lib/client/triggers/schedule/index.d.ts +2 -1
- package/lib/client/triggers/schedule/index.js +2 -2
- package/lib/client/variable.d.ts +2 -2
- package/lib/client/variable.js +5 -5
- package/lib/server/Plugin.d.ts +2 -3
- package/lib/server/Plugin.js +8 -9
- package/lib/server/Processor.d.ts +2 -4
- package/lib/server/actions/nodes.js +7 -7
- package/lib/server/fields/expression-field.d.ts +1 -2
- package/lib/server/fields/expression-field.js +1 -8
- package/lib/server/functions/index.d.ts +2 -3
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +12 -0
- package/lib/server/instructions/aggregate.d.ts +1 -1
- package/lib/server/instructions/aggregate.js +5 -5
- package/lib/server/instructions/condition.d.ts +2 -1
- package/lib/server/instructions/create.d.ts +1 -1
- package/lib/server/instructions/delay.d.ts +3 -3
- package/lib/server/instructions/delay.js +66 -64
- package/lib/server/instructions/destroy.d.ts +1 -1
- package/lib/server/instructions/index.d.ts +5 -5
- package/lib/server/instructions/loop.d.ts +1 -2
- package/lib/server/instructions/manual/actions.js +1 -1
- package/lib/server/instructions/manual/forms/index.d.ts +1 -1
- package/lib/server/instructions/manual/index.d.ts +1 -1
- package/lib/server/instructions/parallel.d.ts +1 -2
- package/lib/server/instructions/query.d.ts +1 -1
- package/lib/server/instructions/request.d.ts +2 -2
- package/lib/server/instructions/request.js +1 -0
- package/lib/server/instructions/update.d.ts +1 -1
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -1
- package/lib/server/migrations/20230221121203-condition-calculation.js +1 -1
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +7 -7
- package/lib/server/migrations/20230411034722-manual-multi-form.js +1 -8
- package/lib/server/triggers/collection.d.ts +1 -1
- package/lib/server/triggers/collection.js +2 -2
- package/lib/server/triggers/index.d.ts +1 -1
- package/lib/server/triggers/schedule.d.ts +1 -1
- package/lib/server/triggers/schedule.js +18 -18
- package/lib/server/{models → types}/Execution.d.ts +2 -3
- package/lib/server/{models → types}/FlowNode.d.ts +1 -2
- package/lib/server/{models → types}/Job.d.ts +1 -2
- package/lib/server/{models → types}/Workflow.d.ts +1 -2
- package/lib/server/types/index.d.ts +4 -0
- package/lib/server/types/index.js +5 -0
- package/package.json +40 -20
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/AddButton.tsx +99 -0
- package/src/client/Branch.tsx +35 -0
- package/src/client/CanvasContent.tsx +23 -0
- package/src/client/ExecutionCanvas.tsx +168 -0
- package/src/client/ExecutionLink.tsx +16 -0
- package/src/client/ExecutionPage.tsx +44 -0
- package/src/client/ExecutionResourceProvider.tsx +21 -0
- package/src/client/FlowContext.ts +7 -0
- package/src/client/WorkflowCanvas.tsx +220 -0
- package/src/client/WorkflowLink.tsx +16 -0
- package/src/client/WorkflowPage.tsx +51 -0
- package/src/client/WorkflowProvider.tsx +84 -0
- package/src/client/components/CollectionBlockInitializer.tsx +71 -0
- package/src/client/components/CollectionFieldset.tsx +158 -0
- package/src/client/components/Duration.tsx +45 -0
- package/src/client/components/DynamicExpression.tsx +53 -0
- package/src/client/components/FieldsSelect.tsx +28 -0
- package/src/client/components/FilterDynamicComponent.tsx +15 -0
- package/src/client/components/NodeDescription.tsx +44 -0
- package/src/client/components/NullRender.tsx +3 -0
- package/src/client/components/OpenDrawer.tsx +24 -0
- package/src/client/components/RadioWithTooltip.tsx +38 -0
- package/src/client/components/ValueBlock.tsx +67 -0
- package/src/client/components/renderEngineReference.tsx +30 -0
- package/src/client/constants.tsx +91 -0
- package/src/client/index.tsx +51 -0
- package/src/client/interfaces/expression.tsx +25 -0
- package/src/client/locale/en-US.ts +136 -0
- package/src/client/locale/es-ES.ts +129 -0
- package/src/client/locale/index.ts +18 -0
- package/src/client/locale/ja-JP.ts +90 -0
- package/src/client/locale/pt-BR.ts +136 -0
- package/src/client/locale/ru-RU.ts +90 -0
- package/src/client/locale/tr-TR.ts +90 -0
- package/src/client/locale/zh-CN.ts +242 -0
- package/src/client/nodes/aggregate.tsx +327 -0
- package/src/client/nodes/calculation.tsx +217 -0
- package/src/client/nodes/condition.tsx +490 -0
- package/src/client/nodes/create.tsx +86 -0
- package/src/client/nodes/delay.tsx +37 -0
- package/src/client/nodes/destroy.tsx +34 -0
- package/src/client/nodes/index.tsx +489 -0
- package/src/client/nodes/loop.tsx +159 -0
- package/src/client/nodes/manual/AssigneesSelect.tsx +33 -0
- package/src/client/nodes/manual/DetailsBlockProvider.tsx +80 -0
- package/src/client/nodes/manual/FormBlockInitializer.tsx +68 -0
- package/src/client/nodes/manual/FormBlockProvider.tsx +75 -0
- package/src/client/nodes/manual/ModeConfig.tsx +84 -0
- package/src/client/nodes/manual/SchemaConfig.tsx +365 -0
- package/src/client/nodes/manual/WorkflowTodo.tsx +611 -0
- package/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx +28 -0
- package/src/client/nodes/manual/forms/create.tsx +88 -0
- package/src/client/nodes/manual/forms/custom.tsx +388 -0
- package/src/client/nodes/manual/forms/update.tsx +130 -0
- package/src/client/nodes/manual/index.tsx +162 -0
- package/src/client/nodes/manual/utils.ts +28 -0
- package/src/client/nodes/parallel.tsx +137 -0
- package/src/client/nodes/query.tsx +89 -0
- package/src/client/nodes/request.tsx +185 -0
- package/src/client/nodes/update.tsx +99 -0
- package/src/client/schemas/collection.ts +75 -0
- package/src/client/schemas/executions.tsx +169 -0
- package/src/client/schemas/workflows.ts +364 -0
- package/src/client/style.tsx +312 -0
- package/src/client/triggers/collection.tsx +186 -0
- package/src/client/triggers/index.tsx +307 -0
- package/src/client/triggers/schedule/DateFieldsSelect.tsx +28 -0
- package/src/client/triggers/schedule/EndsByField.tsx +40 -0
- package/src/client/triggers/schedule/OnField.tsx +50 -0
- package/src/client/triggers/schedule/RepeatField.tsx +116 -0
- package/src/client/triggers/schedule/ScheduleConfig.tsx +225 -0
- package/src/client/triggers/schedule/constants.ts +4 -0
- package/src/client/triggers/schedule/index.tsx +72 -0
- package/src/client/triggers/schedule/locale/Cron.zh-CN.ts +79 -0
- package/src/client/utils.ts +36 -0
- package/src/client/variable.tsx +296 -0
- package/src/index.ts +1 -0
- package/src/server/Plugin.ts +351 -0
- package/src/server/Processor.ts +354 -0
- package/src/server/__tests__/Plugin.test.ts +398 -0
- package/src/server/__tests__/Processor.test.ts +474 -0
- package/src/server/__tests__/actions/workflows.test.ts +419 -0
- package/src/server/__tests__/collections/categories.ts +23 -0
- package/src/server/__tests__/collections/comments.ts +24 -0
- package/src/server/__tests__/collections/posts.ts +42 -0
- package/src/server/__tests__/collections/replies.ts +9 -0
- package/src/server/__tests__/collections/tags.ts +15 -0
- package/src/server/__tests__/index.ts +89 -0
- package/src/server/__tests__/instructions/aggregate.test.ts +294 -0
- package/src/server/__tests__/instructions/calculation.test.ts +265 -0
- package/src/server/__tests__/instructions/condition.test.ts +335 -0
- package/src/server/__tests__/instructions/create.test.ts +129 -0
- package/src/server/__tests__/instructions/delay.test.ts +182 -0
- package/src/server/__tests__/instructions/destroy.test.ts +58 -0
- package/src/server/__tests__/instructions/loop.test.ts +331 -0
- package/src/server/__tests__/instructions/manual.test.ts +854 -0
- package/src/server/__tests__/instructions/parallel.test.ts +445 -0
- package/src/server/__tests__/instructions/query.test.ts +359 -0
- package/src/server/__tests__/instructions/request.test.ts +217 -0
- package/src/server/__tests__/instructions/update.test.ts +189 -0
- package/src/server/__tests__/triggers/collection.test.ts +298 -0
- package/src/server/__tests__/triggers/schedule.test.ts +369 -0
- package/src/server/actions/index.ts +25 -0
- package/src/server/actions/nodes.ts +214 -0
- package/src/server/actions/workflows.ts +178 -0
- package/src/server/collections/executions.ts +35 -0
- package/src/server/collections/flow_nodes.ts +54 -0
- package/src/server/collections/jobs.ts +31 -0
- package/src/server/collections/workflows.ts +88 -0
- package/src/server/constants.ts +26 -0
- package/src/server/fields/expression-field.ts +11 -0
- package/src/server/fields/index.ts +7 -0
- package/src/server/functions/index.ts +16 -0
- package/src/server/index.ts +6 -0
- package/src/server/instructions/aggregate.ts +42 -0
- package/src/server/instructions/calculation.ts +41 -0
- package/src/server/instructions/condition.ts +172 -0
- package/src/server/instructions/create.ts +37 -0
- package/src/server/instructions/delay.ts +105 -0
- package/src/server/instructions/destroy.ts +23 -0
- package/src/server/instructions/index.ts +63 -0
- package/src/server/instructions/loop.ts +99 -0
- package/src/server/instructions/manual/actions.ts +79 -0
- package/src/server/instructions/manual/collecions/jobs.ts +17 -0
- package/src/server/instructions/manual/collecions/users.ts +15 -0
- package/src/server/instructions/manual/collecions/users_jobs.ts +50 -0
- package/src/server/instructions/manual/forms/create.ts +22 -0
- package/src/server/instructions/manual/forms/index.ts +12 -0
- package/src/server/instructions/manual/forms/update.ts +22 -0
- package/src/server/instructions/manual/index.ts +184 -0
- package/src/server/instructions/parallel.ts +121 -0
- package/src/server/instructions/query.ts +31 -0
- package/src/server/instructions/request.ts +87 -0
- package/src/server/instructions/update.ts +24 -0
- package/src/server/migrations/20221129153547-calculation-variables.ts +64 -0
- package/src/server/migrations/20230221032941-change-request-body-type.ts +76 -0
- package/src/server/migrations/20230221071831-calculation-expression.ts +102 -0
- package/src/server/migrations/20230221121203-condition-calculation.ts +82 -0
- package/src/server/migrations/20230221162902-jsonb-to-json.ts +51 -0
- package/src/server/migrations/20230411034722-manual-multi-form.ts +282 -0
- package/src/server/migrations/20230612021134-manual-collection-block.ts +138 -0
- package/src/server/triggers/collection.ts +142 -0
- package/src/server/triggers/index.ts +22 -0
- package/src/server/triggers/schedule.ts +567 -0
- package/src/server/types/Execution.ts +26 -0
- package/src/server/types/FlowNode.ts +21 -0
- package/src/server/types/Job.ts +18 -0
- package/src/server/types/Workflow.ts +36 -0
- package/src/server/types/index.ts +4 -0
- /package/lib/server/{models → types}/Execution.js +0 -0
- /package/lib/server/{models → types}/FlowNode.js +0 -0
- /package/lib/server/{models → types}/Job.js +0 -0
- /package/lib/server/{models → types}/Workflow.js +0 -0
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ScheduleConfig = 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,33 +11,33 @@ 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;
|
|
27
20
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("@
|
|
30
|
-
|
|
21
|
+
function _client() {
|
|
22
|
+
const data = require("@nocobase/client");
|
|
23
|
+
_client = function _client() {
|
|
31
24
|
return data;
|
|
32
25
|
};
|
|
33
26
|
return data;
|
|
34
27
|
}
|
|
35
|
-
function
|
|
36
|
-
const data = require("
|
|
37
|
-
|
|
28
|
+
function _react2() {
|
|
29
|
+
const data = _interopRequireWildcard(require("react"));
|
|
30
|
+
_react2 = function _react2() {
|
|
38
31
|
return data;
|
|
39
32
|
};
|
|
40
33
|
return data;
|
|
41
34
|
}
|
|
35
|
+
var _locale = require("../../locale");
|
|
42
36
|
var _collection = require("../../schemas/collection");
|
|
43
|
-
var
|
|
37
|
+
var _constants = require("./constants");
|
|
44
38
|
var _EndsByField = require("./EndsByField");
|
|
39
|
+
var _OnField = require("./OnField");
|
|
45
40
|
var _RepeatField = require("./RepeatField");
|
|
46
|
-
var _constants = require("./constants");
|
|
47
|
-
var _locale = require("../../locale");
|
|
48
41
|
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); }
|
|
49
42
|
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; }
|
|
50
43
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -195,15 +188,15 @@ const scheduleModeOptions = [{
|
|
|
195
188
|
label: `{{t("Based on date field of collection", { ns: "${_locale.NAMESPACE}" })}}`
|
|
196
189
|
}];
|
|
197
190
|
const ScheduleConfig = () => {
|
|
198
|
-
const _useForm = (0,
|
|
191
|
+
const _useForm = (0, _react().useForm)(),
|
|
199
192
|
_useForm$values = _useForm.values,
|
|
200
193
|
values = _useForm$values === void 0 ? {} : _useForm$values,
|
|
201
194
|
clearFormGraph = _useForm.clearFormGraph;
|
|
202
|
-
const _useState = (0,
|
|
195
|
+
const _useState = (0, _react2().useState)(values.mode),
|
|
203
196
|
_useState2 = _slicedToArray(_useState, 2),
|
|
204
197
|
mode = _useState2[0],
|
|
205
198
|
setMode = _useState2[1];
|
|
206
|
-
(0,
|
|
199
|
+
(0, _react().useFormEffects)(() => {
|
|
207
200
|
(0, _core().onFieldValueChange)('mode', field => {
|
|
208
201
|
setMode(field.value);
|
|
209
202
|
clearFormGraph('collection');
|
|
@@ -213,7 +206,7 @@ const ScheduleConfig = () => {
|
|
|
213
206
|
clearFormGraph('limit');
|
|
214
207
|
});
|
|
215
208
|
});
|
|
216
|
-
return
|
|
209
|
+
return _react2().default.createElement(_react2().default.Fragment, null, _react2().default.createElement(_client().SchemaComponent, {
|
|
217
210
|
schema: {
|
|
218
211
|
type: 'number',
|
|
219
212
|
title: `{{t("Trigger mode", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
@@ -226,7 +219,7 @@ const ScheduleConfig = () => {
|
|
|
226
219
|
required: true,
|
|
227
220
|
default: _constants.SCHEDULE_MODE.STATIC
|
|
228
221
|
}
|
|
229
|
-
}),
|
|
222
|
+
}), _react2().default.createElement(_client().SchemaComponent, {
|
|
230
223
|
schema: {
|
|
231
224
|
type: 'void',
|
|
232
225
|
properties: {
|
|
@@ -234,7 +227,7 @@ const ScheduleConfig = () => {
|
|
|
234
227
|
type: 'void',
|
|
235
228
|
'x-component': 'fieldset',
|
|
236
229
|
'x-component-props': {
|
|
237
|
-
className: (0,
|
|
230
|
+
className: (0, _client().css)`
|
|
238
231
|
.ant-input-number {
|
|
239
232
|
width: 4em;
|
|
240
233
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { useCollectionDataSource, SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
@@ -14,7 +15,7 @@ declare const _default: {
|
|
|
14
15
|
};
|
|
15
16
|
components: {
|
|
16
17
|
ScheduleConfig: () => import("react").JSX.Element;
|
|
17
|
-
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<
|
|
18
|
+
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
|
|
18
19
|
};
|
|
19
20
|
useVariables(config: any, opts: any): any[];
|
|
20
21
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
@@ -45,14 +45,14 @@ var _default = {
|
|
|
45
45
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
46
46
|
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
47
47
|
const options = [];
|
|
48
|
-
if (!(opts
|
|
48
|
+
if (!(opts !== null && opts !== void 0 && opts.types) || opts.types.includes('date')) {
|
|
49
49
|
options.push({
|
|
50
50
|
key: 'date',
|
|
51
51
|
value: 'date',
|
|
52
52
|
label: (0, _locale.lang)('Trigger time')
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
const depth = (
|
|
55
|
+
const depth = (_config$appends = config.appends) !== null && _config$appends !== void 0 && _config$appends.length ? config.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1) + 1 : 1;
|
|
56
56
|
const fieldOptions = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({
|
|
57
57
|
depth
|
|
58
58
|
}, opts), {}, {
|
package/lib/client/variable.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type VariableOption = {
|
|
2
2
|
key?: string;
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
children?: VariableOptions;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type VariableOptions = VariableOption[] | null;
|
|
8
8
|
export declare const nodesOptions: {
|
|
9
9
|
label: string;
|
|
10
10
|
value: string;
|
package/lib/client/variable.js
CHANGED
|
@@ -97,7 +97,7 @@ const systemOptions = {
|
|
|
97
97
|
exports.systemOptions = systemOptions;
|
|
98
98
|
const BaseTypeSets = {
|
|
99
99
|
boolean: new Set(['checkbox']),
|
|
100
|
-
number: new Set(['number', 'percent']),
|
|
100
|
+
number: new Set(['integer', 'number', 'percent']),
|
|
101
101
|
string: new Set(['input', 'password', 'email', 'phone', 'select', 'radioGroup', 'text', 'markdown', 'richText', 'expression', 'time']),
|
|
102
102
|
date: new Set(['date', 'createdAt', 'updatedAt'])
|
|
103
103
|
};
|
|
@@ -142,7 +142,7 @@ function filterTypedFields({
|
|
|
142
142
|
getCollectionFields
|
|
143
143
|
}) {
|
|
144
144
|
return fields.filter(field => {
|
|
145
|
-
const match =
|
|
145
|
+
const match = types !== null && types !== void 0 && types.length ? types.some(type => matchFieldType(field, type, appends)) : true;
|
|
146
146
|
if (isAssociationField(field)) {
|
|
147
147
|
const nextAppends = getNextAppends(field, appends);
|
|
148
148
|
const included = appends.includes(field.name);
|
|
@@ -202,7 +202,7 @@ function getNormalizedFields(collectionName, {
|
|
|
202
202
|
var _field$uiSchema, _field$uiSchema2;
|
|
203
203
|
otherFields.splice(i, 0, _objectSpread(_objectSpread(_objectSpread({}, field), foreignKeyField), {}, {
|
|
204
204
|
uiSchema: _objectSpread(_objectSpread({}, field.uiSchema), {}, {
|
|
205
|
-
title: (
|
|
205
|
+
title: (_field$uiSchema = field.uiSchema) !== null && _field$uiSchema !== void 0 && _field$uiSchema.title ? `${compile((_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title)} ID` : foreignKeyField.name
|
|
206
206
|
})
|
|
207
207
|
}));
|
|
208
208
|
} else {
|
|
@@ -213,7 +213,7 @@ function getNormalizedFields(collectionName, {
|
|
|
213
213
|
isForeignKey: true,
|
|
214
214
|
interface: field.interface,
|
|
215
215
|
uiSchema: _objectSpread(_objectSpread({}, field.uiSchema), {}, {
|
|
216
|
-
title: (
|
|
216
|
+
title: (_field$uiSchema3 = field.uiSchema) !== null && _field$uiSchema3 !== void 0 && _field$uiSchema3.title ? `${compile((_field$uiSchema4 = field.uiSchema) === null || _field$uiSchema4 === void 0 ? void 0 : _field$uiSchema4.title)} ID` : field.name
|
|
217
217
|
})
|
|
218
218
|
}));
|
|
219
219
|
}
|
|
@@ -224,7 +224,7 @@ function getNormalizedFields(collectionName, {
|
|
|
224
224
|
type: field.dataType,
|
|
225
225
|
interface: belongsToField.interface,
|
|
226
226
|
uiSchema: _objectSpread(_objectSpread({}, belongsToField.uiSchema), {}, {
|
|
227
|
-
title: (
|
|
227
|
+
title: (_belongsToField$uiSch = belongsToField.uiSchema) !== null && _belongsToField$uiSch !== void 0 && _belongsToField$uiSch.title ? `${compile((_belongsToField$uiSch2 = belongsToField.uiSchema) === null || _belongsToField$uiSch2 === void 0 ? void 0 : _belongsToField$uiSch2.title)} ID` : field.name
|
|
228
228
|
})
|
|
229
229
|
}));
|
|
230
230
|
}
|
package/lib/server/Plugin.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Plugin } from '@nocobase/server';
|
|
2
2
|
import { Registry } from '@nocobase/utils';
|
|
3
3
|
import { Instruction } from './instructions';
|
|
4
|
-
import ExecutionModel from './models/Execution';
|
|
5
|
-
import WorkflowModel from './models/Workflow';
|
|
6
4
|
import Processor from './Processor';
|
|
7
5
|
import { Trigger } from './triggers';
|
|
8
6
|
import { CustomFunction } from './functions';
|
|
9
7
|
import { Logger } from '@nocobase/logger';
|
|
10
|
-
|
|
8
|
+
import type { WorkflowModel, ExecutionModel } from './types';
|
|
9
|
+
type ID = number | string;
|
|
11
10
|
export default class WorkflowPlugin extends Plugin {
|
|
12
11
|
instructions: Registry<Instruction>;
|
|
13
12
|
triggers: Registry<Trigger>;
|
package/lib/server/Plugin.js
CHANGED
|
@@ -82,7 +82,7 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
82
82
|
this.instructions = new (_utils().Registry)();
|
|
83
83
|
this.triggers = new (_utils().Registry)();
|
|
84
84
|
this.functions = new (_utils().Registry)();
|
|
85
|
-
this.executing =
|
|
85
|
+
this.executing = false;
|
|
86
86
|
this.pending = [];
|
|
87
87
|
this.events = [];
|
|
88
88
|
this.loggerCache = void 0;
|
|
@@ -142,7 +142,7 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
142
142
|
context = _event[1],
|
|
143
143
|
options = _event[2];
|
|
144
144
|
let valid = true;
|
|
145
|
-
if ((_options$context = options.context)
|
|
145
|
+
if ((_options$context = options.context) !== null && _options$context !== void 0 && _options$context.executionId) {
|
|
146
146
|
// NOTE: no transaction here for read-uncommitted execution
|
|
147
147
|
const existed = yield workflow.countExecutions({
|
|
148
148
|
where: {
|
|
@@ -165,10 +165,6 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
165
165
|
}, {
|
|
166
166
|
transaction
|
|
167
167
|
});
|
|
168
|
-
const executed = yield workflow.countExecutions({
|
|
169
|
-
transaction
|
|
170
|
-
});
|
|
171
|
-
// NOTE: not to trigger afterUpdate hook here
|
|
172
168
|
yield workflow.increment('executed', {
|
|
173
169
|
transaction
|
|
174
170
|
});
|
|
@@ -329,6 +325,7 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
329
325
|
if (_this4.executing) {
|
|
330
326
|
return;
|
|
331
327
|
}
|
|
328
|
+
_this4.executing = true;
|
|
332
329
|
let next = null;
|
|
333
330
|
// resuming has high priority
|
|
334
331
|
if (_this4.pending.length) {
|
|
@@ -338,21 +335,23 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
338
335
|
filter: {
|
|
339
336
|
status: _constants.EXECUTION_STATUS.QUEUEING
|
|
340
337
|
},
|
|
338
|
+
appends: ['workflow'],
|
|
341
339
|
sort: 'createdAt'
|
|
342
340
|
});
|
|
343
|
-
if (execution) {
|
|
341
|
+
if (execution && execution.workflow.enabled) {
|
|
344
342
|
next = [execution];
|
|
345
343
|
}
|
|
346
344
|
}
|
|
347
345
|
if (next) {
|
|
348
346
|
_this4.process(...next);
|
|
347
|
+
} else {
|
|
348
|
+
_this4.executing = false;
|
|
349
349
|
}
|
|
350
350
|
})();
|
|
351
351
|
}
|
|
352
352
|
process(execution, job) {
|
|
353
353
|
var _this5 = this;
|
|
354
354
|
return _asyncToGenerator(function* () {
|
|
355
|
-
_this5.executing = execution;
|
|
356
355
|
if (execution.status === _constants.EXECUTION_STATUS.QUEUEING) {
|
|
357
356
|
yield execution.update({
|
|
358
357
|
status: _constants.EXECUTION_STATUS.STARTED
|
|
@@ -366,7 +365,7 @@ class WorkflowPlugin extends _server().Plugin {
|
|
|
366
365
|
} catch (err) {
|
|
367
366
|
_this5.getLogger(execution.workflowId).error(`execution (${execution.id}) error: ${err.message}`, err);
|
|
368
367
|
}
|
|
369
|
-
_this5.executing =
|
|
368
|
+
_this5.executing = false;
|
|
370
369
|
_this5.dispatch();
|
|
371
370
|
})();
|
|
372
371
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { Transaction, Transactionable } from '@nocobase/database';
|
|
1
2
|
import { Logger } from '@nocobase/logger';
|
|
2
|
-
import { Transaction, Transactionable } from 'sequelize';
|
|
3
3
|
import Plugin from '.';
|
|
4
|
-
import ExecutionModel from './
|
|
5
|
-
import FlowNodeModel from './models/FlowNode';
|
|
6
|
-
import JobModel from './models/Job';
|
|
4
|
+
import type { ExecutionModel, FlowNodeModel, JobModel } from './types';
|
|
7
5
|
export interface ProcessorOptions extends Transactionable {
|
|
8
6
|
plugin: Plugin;
|
|
9
7
|
}
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.create = create;
|
|
7
7
|
exports.destroy = destroy;
|
|
8
8
|
exports.update = update;
|
|
9
|
-
function
|
|
10
|
-
const data = require("
|
|
11
|
-
|
|
9
|
+
function _actions() {
|
|
10
|
+
const data = require("@nocobase/actions");
|
|
11
|
+
_actions = function _actions() {
|
|
12
12
|
return data;
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const data = require("@nocobase/
|
|
18
|
-
|
|
16
|
+
function _database() {
|
|
17
|
+
const data = require("@nocobase/database");
|
|
18
|
+
_database = function _database() {
|
|
19
19
|
return data;
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
@@ -102,7 +102,7 @@ function _create() {
|
|
|
102
102
|
const _yield$upstream$getBr = yield upstream.getBranches({
|
|
103
103
|
where: {
|
|
104
104
|
id: {
|
|
105
|
-
[
|
|
105
|
+
[_database().Op.ne]: instance.id
|
|
106
106
|
},
|
|
107
107
|
branchIndex: instance.branchIndex
|
|
108
108
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '
|
|
2
|
-
import { BaseFieldOptions, Field } from '@nocobase/database';
|
|
1
|
+
import { BaseFieldOptions, DataTypes, Field } from '@nocobase/database';
|
|
3
2
|
export interface ExpressionFieldOptions extends BaseFieldOptions {
|
|
4
3
|
type: 'expression';
|
|
5
4
|
}
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ExpressionField = void 0;
|
|
7
|
-
function _sequelize() {
|
|
8
|
-
const data = require("sequelize");
|
|
9
|
-
_sequelize = function _sequelize() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _database() {
|
|
15
8
|
const data = require("@nocobase/database");
|
|
16
9
|
_database = function _database() {
|
|
@@ -20,7 +13,7 @@ function _database() {
|
|
|
20
13
|
}
|
|
21
14
|
class ExpressionField extends _database().Field {
|
|
22
15
|
get dataType() {
|
|
23
|
-
return
|
|
16
|
+
return _database().DataTypes.TEXT;
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
19
|
exports.ExpressionField = ExpressionField;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Plugin from '..';
|
|
2
|
-
import ExecutionModel from '../
|
|
3
|
-
|
|
4
|
-
export declare type CustomFunction = (this: {
|
|
2
|
+
import type { ExecutionModel, FlowNodeModel } from '../types';
|
|
3
|
+
export type CustomFunction = (this: {
|
|
5
4
|
execution: ExecutionModel;
|
|
6
5
|
node?: FlowNodeModel;
|
|
7
6
|
}) => any;
|
package/lib/server/index.d.ts
CHANGED
package/lib/server/index.js
CHANGED
|
@@ -40,4 +40,16 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
40
40
|
var _triggers = require("./triggers");
|
|
41
41
|
var _Processor = _interopRequireDefault(require("./Processor"));
|
|
42
42
|
var _Plugin = _interopRequireDefault(require("./Plugin"));
|
|
43
|
+
var _types = require("./types");
|
|
44
|
+
Object.keys(_types).forEach(function (key) {
|
|
45
|
+
if (key === "default" || key === "__esModule") return;
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
47
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
48
|
+
Object.defineProperty(exports, key, {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _types[key];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
43
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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 = require("
|
|
9
|
-
|
|
7
|
+
function _database() {
|
|
8
|
+
const data = require("@nocobase/database");
|
|
9
|
+
_database = function _database() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -41,14 +41,14 @@ var _default = {
|
|
|
41
41
|
const database = node.constructor.database;
|
|
42
42
|
const repo = associated ? database.getRepository(`${association === null || association === void 0 ? void 0 : association.associatedCollection}.${association.name}`, processor.getParsedValue(association === null || association === void 0 ? void 0 : association.associatedKey)) : database.getRepository(collection);
|
|
43
43
|
if (!options.dataType && aggregator === 'avg') {
|
|
44
|
-
options.dataType =
|
|
44
|
+
options.dataType = _database().DataTypes.DOUBLE;
|
|
45
45
|
}
|
|
46
46
|
const result = yield repo.aggregate(_objectSpread(_objectSpread({}, options), {}, {
|
|
47
47
|
method: aggregators[aggregator],
|
|
48
48
|
transaction: processor.transaction
|
|
49
49
|
}));
|
|
50
50
|
return {
|
|
51
|
-
result: options.dataType ===
|
|
51
|
+
result: options.dataType === _database().DataTypes.DOUBLE ? Number(result) : result,
|
|
52
52
|
status: _constants.JOB_STATUS.RESOLVED
|
|
53
53
|
};
|
|
54
54
|
})();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Registry } from '@nocobase/utils';
|
|
2
2
|
import { Instruction } from '.';
|
|
3
|
-
|
|
3
|
+
type Comparer = (a: any, b: any) => boolean;
|
|
4
|
+
export declare const calculators: Registry<Comparer>;
|
|
4
5
|
declare const _default: Instruction;
|
|
5
6
|
export default _default;
|
|
@@ -6,9 +6,9 @@ export default class implements Instruction {
|
|
|
6
6
|
protected plugin: Plugin;
|
|
7
7
|
timers: Map<number, NodeJS.Timeout>;
|
|
8
8
|
constructor(plugin: Plugin);
|
|
9
|
-
load()
|
|
10
|
-
unload()
|
|
11
|
-
schedule(job: any
|
|
9
|
+
load: () => Promise<void>;
|
|
10
|
+
unload: () => void;
|
|
11
|
+
schedule(job: any): void;
|
|
12
12
|
trigger(job: any): Promise<void>;
|
|
13
13
|
run: (node: any, prevJob: any, processor: Processor) => Promise<any>;
|
|
14
14
|
resume: (node: any, prevJob: any, processor: Processor) => Promise<any>;
|
|
@@ -15,43 +15,9 @@ class _default {
|
|
|
15
15
|
var _this = this;
|
|
16
16
|
this.plugin = void 0;
|
|
17
17
|
this.timers = new Map();
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const job = yield processor.saveJob({
|
|
22
|
-
status: _constants.JOB_STATUS.PENDING,
|
|
23
|
-
result: null,
|
|
24
|
-
nodeId: node.id,
|
|
25
|
-
upstreamId: (_prevJob$id = prevJob === null || prevJob === void 0 ? void 0 : prevJob.id) !== null && _prevJob$id !== void 0 ? _prevJob$id : null
|
|
26
|
-
});
|
|
27
|
-
const duration = node.config.duration;
|
|
28
|
-
// add to schedule
|
|
29
|
-
_this.schedule(job, duration);
|
|
30
|
-
return processor.exit();
|
|
31
|
-
});
|
|
32
|
-
return function (_x, _x2, _x3) {
|
|
33
|
-
return _ref.apply(this, arguments);
|
|
34
|
-
};
|
|
35
|
-
}();
|
|
36
|
-
this.resume = /*#__PURE__*/function () {
|
|
37
|
-
var _ref2 = _asyncToGenerator(function* (node, prevJob, processor) {
|
|
38
|
-
const endStatus = node.config.endStatus;
|
|
39
|
-
prevJob.set('status', endStatus);
|
|
40
|
-
return prevJob;
|
|
41
|
-
});
|
|
42
|
-
return function (_x4, _x5, _x6) {
|
|
43
|
-
return _ref2.apply(this, arguments);
|
|
44
|
-
};
|
|
45
|
-
}();
|
|
46
|
-
this.plugin = plugin;
|
|
47
|
-
plugin.app.on('beforeStart', () => this.load());
|
|
48
|
-
plugin.app.on('beforeStop', () => this.unload());
|
|
49
|
-
}
|
|
50
|
-
load() {
|
|
51
|
-
var _this2 = this;
|
|
52
|
-
return _asyncToGenerator(function* () {
|
|
53
|
-
const _this2$plugin$db$getC = _this2.plugin.db.getCollection('jobs'),
|
|
54
|
-
model = _this2$plugin$db$getC.model;
|
|
18
|
+
this.load = /*#__PURE__*/_asyncToGenerator(function* () {
|
|
19
|
+
const _this$plugin$db$getCo = _this.plugin.db.getCollection('jobs'),
|
|
20
|
+
model = _this$plugin$db$getCo.model;
|
|
55
21
|
const jobs = yield model.findAll({
|
|
56
22
|
where: {
|
|
57
23
|
status: _constants.JOB_STATUS.PENDING
|
|
@@ -73,42 +39,78 @@ class _default {
|
|
|
73
39
|
}]
|
|
74
40
|
});
|
|
75
41
|
jobs.forEach(job => {
|
|
76
|
-
|
|
42
|
+
_this.schedule(job);
|
|
77
43
|
});
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
44
|
+
});
|
|
45
|
+
this.unload = () => {
|
|
46
|
+
var _iterator = _createForOfIteratorHelper(this.timers.values()),
|
|
47
|
+
_step;
|
|
48
|
+
try {
|
|
49
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
50
|
+
const timer = _step.value;
|
|
51
|
+
clearTimeout(timer);
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
_iterator.e(err);
|
|
55
|
+
} finally {
|
|
56
|
+
_iterator.f();
|
|
87
57
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
58
|
+
this.timers = new Map();
|
|
59
|
+
};
|
|
60
|
+
this.run = /*#__PURE__*/function () {
|
|
61
|
+
var _ref2 = _asyncToGenerator(function* (node, prevJob, processor) {
|
|
62
|
+
var _prevJob$id;
|
|
63
|
+
const job = yield processor.saveJob({
|
|
64
|
+
status: _constants.JOB_STATUS.PENDING,
|
|
65
|
+
result: null,
|
|
66
|
+
nodeId: node.id,
|
|
67
|
+
upstreamId: (_prevJob$id = prevJob === null || prevJob === void 0 ? void 0 : prevJob.id) !== null && _prevJob$id !== void 0 ? _prevJob$id : null
|
|
68
|
+
});
|
|
69
|
+
job.node = node;
|
|
70
|
+
// add to schedule
|
|
71
|
+
_this.schedule(job);
|
|
72
|
+
return processor.exit();
|
|
73
|
+
});
|
|
74
|
+
return function (_x, _x2, _x3) {
|
|
75
|
+
return _ref2.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}();
|
|
78
|
+
this.resume = /*#__PURE__*/function () {
|
|
79
|
+
var _ref3 = _asyncToGenerator(function* (node, prevJob, processor) {
|
|
80
|
+
const endStatus = node.config.endStatus;
|
|
81
|
+
prevJob.set('status', endStatus);
|
|
82
|
+
return prevJob;
|
|
83
|
+
});
|
|
84
|
+
return function (_x4, _x5, _x6) {
|
|
85
|
+
return _ref3.apply(this, arguments);
|
|
86
|
+
};
|
|
87
|
+
}();
|
|
88
|
+
this.plugin = plugin;
|
|
89
|
+
plugin.app.on('beforeStart', this.load);
|
|
90
|
+
plugin.app.on('beforeStop', this.unload);
|
|
94
91
|
}
|
|
95
|
-
schedule(job
|
|
92
|
+
schedule(job) {
|
|
96
93
|
const now = new Date();
|
|
97
94
|
const createdAt = Date.parse(job.createdAt);
|
|
98
|
-
const delay = createdAt + duration - now.getTime();
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
const delay = createdAt + job.node.config.duration - now.getTime();
|
|
96
|
+
if (delay > 0) {
|
|
97
|
+
const trigger = this.trigger.bind(this, job);
|
|
98
|
+
this.timers.set(job.id, setTimeout(trigger, delay));
|
|
99
|
+
} else {
|
|
100
|
+
this.trigger(job);
|
|
101
|
+
}
|
|
101
102
|
}
|
|
102
103
|
trigger(job) {
|
|
103
|
-
var
|
|
104
|
+
var _this2 = this;
|
|
104
105
|
return _asyncToGenerator(function* () {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
if (!job.execution) {
|
|
107
|
+
job.execution = yield job.getExecution();
|
|
108
|
+
}
|
|
109
|
+
if (job.execution.status === _constants.EXECUTION_STATUS.STARTED) {
|
|
110
|
+
_this2.plugin.resume(job);
|
|
109
111
|
}
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
+
if (_this2.timers.get(job.id)) {
|
|
113
|
+
_this2.timers.delete(job.id);
|
|
112
114
|
}
|
|
113
115
|
})();
|
|
114
116
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import FlowNodeModel from '../models/FlowNode';
|
|
2
1
|
import Plugin from '..';
|
|
3
2
|
import Processor from '../Processor';
|
|
4
|
-
|
|
3
|
+
import type { FlowNodeModel } from '../types';
|
|
4
|
+
export type Job = {
|
|
5
5
|
status: number;
|
|
6
6
|
result?: unknown;
|
|
7
7
|
[key: string]: unknown;
|
|
8
8
|
} | null;
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type InstructionResult = Job | Promise<Job>;
|
|
10
|
+
export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult;
|
|
11
11
|
export interface Instruction {
|
|
12
12
|
run: Runner;
|
|
13
13
|
resume?: Runner;
|
|
14
14
|
getScope?: (node: FlowNodeModel, job: any, processor: Processor) => any;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type InstructionConstructor<T> = {
|
|
17
17
|
new (p: Plugin): T;
|
|
18
18
|
};
|
|
19
19
|
export default function <T extends Instruction>(plugin: any, more?: {
|