@nocobase/plugin-workflow 0.7.1-alpha.5 → 0.7.2-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 +4 -0
- package/client.js +30 -0
- package/lib/client/ExecutionResourceProvider.d.ts +4 -0
- package/lib/client/ExecutionResourceProvider.js +64 -0
- package/lib/client/WorkflowCanvas.d.ts +15 -0
- package/lib/client/WorkflowCanvas.js +393 -0
- package/lib/client/WorkflowLink.d.ts +1 -0
- package/lib/client/WorkflowLink.js +66 -0
- package/lib/client/WorkflowPage.d.ts +1 -0
- package/lib/client/WorkflowPage.js +92 -0
- package/lib/client/WorkflowProvider.d.ts +1 -0
- package/lib/client/WorkflowProvider.js +78 -0
- package/lib/client/WorkflowShortcut.d.ts +1 -0
- package/lib/client/WorkflowShortcut.js +123 -0
- package/lib/client/calculators.d.ts +101 -0
- package/lib/client/calculators.js +739 -0
- package/lib/client/components/Duration.d.ts +5 -0
- package/lib/client/components/Duration.js +96 -0
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.js +38 -0
- package/lib/client/nodes/calculation.d.ts +25 -0
- package/lib/client/nodes/calculation.js +85 -0
- package/lib/client/nodes/condition.d.ts +46 -0
- package/lib/client/nodes/condition.js +346 -0
- package/lib/client/nodes/create.d.ts +46 -0
- package/lib/client/nodes/create.js +133 -0
- package/lib/client/nodes/delay.d.ts +36 -0
- package/lib/client/nodes/delay.js +49 -0
- package/lib/client/nodes/destroy.d.ts +55 -0
- package/lib/client/nodes/destroy.js +46 -0
- package/lib/client/nodes/index.d.ts +33 -0
- package/lib/client/nodes/index.js +390 -0
- package/lib/client/nodes/parallel.d.ts +24 -0
- package/lib/client/nodes/parallel.js +216 -0
- package/lib/client/nodes/query.d.ts +70 -0
- package/lib/client/nodes/query.js +143 -0
- package/lib/client/nodes/update.d.ts +60 -0
- package/lib/client/nodes/update.js +48 -0
- package/lib/client/schemas/collection.d.ts +42 -0
- package/lib/client/schemas/collection.js +98 -0
- package/lib/client/schemas/executions.d.ts +209 -0
- package/lib/client/schemas/executions.js +164 -0
- package/lib/client/schemas/workflows.d.ts +2 -0
- package/lib/client/schemas/workflows.js +328 -0
- package/lib/client/style.d.ts +12 -0
- package/lib/client/style.js +216 -0
- package/lib/client/triggers/collection.d.ts +92 -0
- package/lib/client/triggers/collection.js +253 -0
- package/lib/client/triggers/index.d.ts +26 -0
- package/lib/client/triggers/index.js +238 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
- package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
- package/lib/client/triggers/schedule/EndsByField.js +102 -0
- package/lib/client/triggers/schedule/OnField.d.ts +5 -0
- package/lib/client/triggers/schedule/OnField.js +128 -0
- package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
- package/lib/client/triggers/schedule/RepeatField.js +191 -0
- package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
- package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
- package/lib/client/triggers/schedule/index.d.ts +25 -0
- package/lib/client/triggers/schedule/index.js +124 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
- package/lib/index.d.ts +1 -6
- package/lib/index.js +2 -73
- package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
- package/lib/{Plugin.js → server/Plugin.js} +0 -0
- package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
- package/lib/{Processor.js → server/Processor.js} +40 -24
- package/lib/{actions → server/actions}/index.d.ts +0 -0
- package/lib/{actions → server/actions}/index.js +0 -0
- package/lib/{actions → server/actions}/nodes.d.ts +0 -0
- package/lib/{actions → server/actions}/nodes.js +1 -0
- package/lib/{actions → server/actions}/workflows.d.ts +0 -0
- package/lib/{actions → server/actions}/workflows.js +0 -0
- package/lib/{calculators → server/calculators}/index.d.ts +0 -0
- package/lib/{calculators → server/calculators}/index.js +0 -0
- package/lib/{collections → server/collections}/executions.d.ts +0 -0
- package/lib/{collections → server/collections}/executions.js +0 -0
- package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
- package/lib/{collections → server/collections}/flow_nodes.js +0 -0
- package/lib/{collections → server/collections}/jobs.d.ts +0 -0
- package/lib/{collections → server/collections}/jobs.js +0 -0
- package/lib/{collections → server/collections}/workflows.d.ts +0 -0
- package/lib/{collections → server/collections}/workflows.js +0 -0
- package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
- package/lib/{constants.js → server/constants.js} +0 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +86 -0
- package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
- package/lib/{instructions → server/instructions}/calculation.js +0 -0
- package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
- package/lib/{instructions → server/instructions}/condition.js +0 -0
- package/lib/{instructions → server/instructions}/create.d.ts +0 -0
- package/lib/{instructions → server/instructions}/create.js +0 -0
- package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
- package/lib/{instructions → server/instructions}/delay.js +12 -5
- package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
- package/lib/{instructions → server/instructions}/destroy.js +0 -0
- package/lib/{instructions → server/instructions}/index.d.ts +0 -0
- package/lib/{instructions → server/instructions}/index.js +0 -0
- package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
- package/lib/{instructions → server/instructions}/parallel.js +62 -20
- package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
- package/lib/{instructions → server/instructions}/prompt.js +0 -0
- package/lib/{instructions → server/instructions}/query.d.ts +0 -0
- package/lib/{instructions → server/instructions}/query.js +0 -0
- package/lib/{instructions → server/instructions}/update.d.ts +0 -0
- package/lib/{instructions → server/instructions}/update.js +0 -0
- package/lib/{models → server/models}/Execution.d.ts +0 -0
- package/lib/{models → server/models}/Execution.js +0 -0
- package/lib/{models → server/models}/FlowNode.d.ts +0 -0
- package/lib/{models → server/models}/FlowNode.js +0 -0
- package/lib/{models → server/models}/Job.d.ts +0 -0
- package/lib/{models → server/models}/Job.js +0 -0
- package/lib/{models → server/models}/Workflow.d.ts +0 -0
- package/lib/{models → server/models}/Workflow.js +0 -0
- package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
- package/lib/{triggers → server/triggers}/collection.js +0 -0
- package/lib/{triggers → server/triggers}/index.d.ts +0 -0
- package/lib/{triggers → server/triggers}/index.js +0 -0
- package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
- package/lib/{triggers → server/triggers}/schedule.js +2 -2
- package/package.json +10 -8
- package/server.d.ts +4 -0
- package/server.js +30 -0
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
var _index = _interopRequireWildcard(require("./lib/client"));
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var _exportNames = {};
|
|
13
|
+
Object.defineProperty(exports, "default", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _index.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Object.keys(_index).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _index[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ExecutionResourceProvider = void 0;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _client() {
|
|
19
|
+
const data = require("@nocobase/client");
|
|
20
|
+
|
|
21
|
+
_client = function _client() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const _excluded = ["request"];
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
38
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
39
|
+
|
|
40
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
41
|
+
|
|
42
|
+
const ExecutionResourceProvider = _ref => {
|
|
43
|
+
var _request$params;
|
|
44
|
+
|
|
45
|
+
let request = _ref.request,
|
|
46
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
|
|
48
|
+
const workflow = (0, _client().useRecord)();
|
|
49
|
+
|
|
50
|
+
const props = _objectSpread(_objectSpread({}, others), {}, {
|
|
51
|
+
request: _objectSpread(_objectSpread({}, request), {}, {
|
|
52
|
+
params: _objectSpread(_objectSpread({}, request === null || request === void 0 ? void 0 : request.params), {}, {
|
|
53
|
+
filter: _objectSpread(_objectSpread({}, request === null || request === void 0 ? void 0 : (_request$params = request.params) === null || _request$params === void 0 ? void 0 : _request$params.filter), {}, {
|
|
54
|
+
key: workflow.key
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
workflow
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return _react().default.createElement(_client().ResourceActionProvider, _objectSpread({}, props));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.ExecutionResourceProvider = ExecutionResourceProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useFlowContext(): any;
|
|
3
|
+
export declare function WorkflowCanvas(): JSX.Element;
|
|
4
|
+
export declare function Branch({ from, entry, branchIndex, controller }: {
|
|
5
|
+
from?: any;
|
|
6
|
+
entry?: any;
|
|
7
|
+
branchIndex?: any;
|
|
8
|
+
controller?: any;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
interface AddButtonProps {
|
|
11
|
+
upstream: any;
|
|
12
|
+
branchIndex?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function AddButton({ upstream, branchIndex }: AddButtonProps): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AddButton = AddButton;
|
|
7
|
+
exports.Branch = Branch;
|
|
8
|
+
exports.WorkflowCanvas = WorkflowCanvas;
|
|
9
|
+
exports.useFlowContext = useFlowContext;
|
|
10
|
+
|
|
11
|
+
function _react() {
|
|
12
|
+
const data = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
_react = function _react() {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _reactRouterDom() {
|
|
22
|
+
const data = require("react-router-dom");
|
|
23
|
+
|
|
24
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _antd() {
|
|
32
|
+
const data = require("antd");
|
|
33
|
+
|
|
34
|
+
_antd = function _antd() {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _icons() {
|
|
42
|
+
const data = require("@ant-design/icons");
|
|
43
|
+
|
|
44
|
+
_icons = function _icons() {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function _css() {
|
|
52
|
+
const data = require("@emotion/css");
|
|
53
|
+
|
|
54
|
+
_css = function _css() {
|
|
55
|
+
return data;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function _reactI18next() {
|
|
62
|
+
const data = require("react-i18next");
|
|
63
|
+
|
|
64
|
+
_reactI18next = function _reactI18next() {
|
|
65
|
+
return data;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _client() {
|
|
72
|
+
const data = require("@nocobase/client");
|
|
73
|
+
|
|
74
|
+
_client = function _client() {
|
|
75
|
+
return data;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var _nodes = require("./nodes");
|
|
82
|
+
|
|
83
|
+
var _style = require("./style");
|
|
84
|
+
|
|
85
|
+
var _triggers = require("./triggers");
|
|
86
|
+
|
|
87
|
+
const _excluded = ["nodes", "revisions"];
|
|
88
|
+
|
|
89
|
+
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); }
|
|
90
|
+
|
|
91
|
+
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; }
|
|
92
|
+
|
|
93
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
94
|
+
|
|
95
|
+
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."); }
|
|
96
|
+
|
|
97
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
98
|
+
|
|
99
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
100
|
+
|
|
101
|
+
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); } }
|
|
102
|
+
|
|
103
|
+
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); }); }; }
|
|
104
|
+
|
|
105
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
106
|
+
|
|
107
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
108
|
+
|
|
109
|
+
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; } } }; }
|
|
110
|
+
|
|
111
|
+
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); }
|
|
112
|
+
|
|
113
|
+
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; }
|
|
114
|
+
|
|
115
|
+
function makeNodes(nodes) {
|
|
116
|
+
const nodesMap = new Map();
|
|
117
|
+
nodes.forEach(item => nodesMap.set(item.id, item));
|
|
118
|
+
|
|
119
|
+
var _iterator = _createForOfIteratorHelper(nodesMap.values()),
|
|
120
|
+
_step;
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
124
|
+
let node = _step.value;
|
|
125
|
+
|
|
126
|
+
if (node.upstreamId) {
|
|
127
|
+
node.upstream = nodesMap.get(node.upstreamId);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (node.downstreamId) {
|
|
131
|
+
node.downstream = nodesMap.get(node.downstreamId);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} catch (err) {
|
|
135
|
+
_iterator.e(err);
|
|
136
|
+
} finally {
|
|
137
|
+
_iterator.f();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const FlowContext = _react().default.createContext(null);
|
|
142
|
+
|
|
143
|
+
function useFlowContext() {
|
|
144
|
+
return (0, _react().useContext)(FlowContext);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function WorkflowCanvas() {
|
|
148
|
+
var _data$data2;
|
|
149
|
+
|
|
150
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
151
|
+
t = _useTranslation.t;
|
|
152
|
+
|
|
153
|
+
const history = (0, _reactRouterDom().useHistory)();
|
|
154
|
+
|
|
155
|
+
const _useResourceActionCon = (0, _client().useResourceActionContext)(),
|
|
156
|
+
data = _useResourceActionCon.data,
|
|
157
|
+
refresh = _useResourceActionCon.refresh,
|
|
158
|
+
loading = _useResourceActionCon.loading;
|
|
159
|
+
|
|
160
|
+
const _useResourceContext = (0, _client().useResourceContext)(),
|
|
161
|
+
resource = _useResourceContext.resource,
|
|
162
|
+
targetKey = _useResourceContext.targetKey;
|
|
163
|
+
|
|
164
|
+
const _useDocumentTitle = (0, _client().useDocumentTitle)(),
|
|
165
|
+
setTitle = _useDocumentTitle.setTitle;
|
|
166
|
+
|
|
167
|
+
(0, _react().useEffect)(() => {
|
|
168
|
+
var _data$data;
|
|
169
|
+
|
|
170
|
+
const _ref = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
|
|
171
|
+
title = _ref.title;
|
|
172
|
+
|
|
173
|
+
setTitle(`${title ? `${title} - ` : ''}${t('Workflow')}`);
|
|
174
|
+
}, [data === null || data === void 0 ? void 0 : data.data]);
|
|
175
|
+
|
|
176
|
+
if (!(data === null || data === void 0 ? void 0 : data.data) && !loading) {
|
|
177
|
+
return _react().default.createElement("div", null, t('Load failed'));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const _ref2 = (_data$data2 = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data2 !== void 0 ? _data$data2 : {},
|
|
181
|
+
_ref2$nodes = _ref2.nodes,
|
|
182
|
+
nodes = _ref2$nodes === void 0 ? [] : _ref2$nodes,
|
|
183
|
+
_ref2$revisions = _ref2.revisions,
|
|
184
|
+
revisions = _ref2$revisions === void 0 ? [] : _ref2$revisions,
|
|
185
|
+
workflow = _objectWithoutProperties(_ref2, _excluded);
|
|
186
|
+
|
|
187
|
+
makeNodes(nodes);
|
|
188
|
+
const entry = nodes.find(item => !item.upstream);
|
|
189
|
+
|
|
190
|
+
function onSwitchVersion({
|
|
191
|
+
key
|
|
192
|
+
}) {
|
|
193
|
+
if (key != workflow.id) {
|
|
194
|
+
history.push(key);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function onToggle(_x) {
|
|
199
|
+
return _onToggle.apply(this, arguments);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function _onToggle() {
|
|
203
|
+
_onToggle = _asyncToGenerator(function* (value) {
|
|
204
|
+
yield resource.update({
|
|
205
|
+
filterByTk: workflow[targetKey],
|
|
206
|
+
values: {
|
|
207
|
+
enabled: value,
|
|
208
|
+
// NOTE: keep `key` field to adapter for backend
|
|
209
|
+
key: workflow.key
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
refresh();
|
|
213
|
+
});
|
|
214
|
+
return _onToggle.apply(this, arguments);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function onRevision() {
|
|
218
|
+
return _onRevision.apply(this, arguments);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function _onRevision() {
|
|
222
|
+
_onRevision = _asyncToGenerator(function* () {
|
|
223
|
+
const _yield$resource$revis = yield resource.revision({
|
|
224
|
+
filterByTk: workflow[targetKey]
|
|
225
|
+
}),
|
|
226
|
+
revision = _yield$resource$revis.data.data;
|
|
227
|
+
|
|
228
|
+
_antd().message.success(t('Operation succeeded'));
|
|
229
|
+
|
|
230
|
+
history.push(`${revision.id}`);
|
|
231
|
+
});
|
|
232
|
+
return _onRevision.apply(this, arguments);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return _react().default.createElement(FlowContext.Provider, {
|
|
236
|
+
value: {
|
|
237
|
+
workflow,
|
|
238
|
+
nodes,
|
|
239
|
+
onNodeAdded: refresh,
|
|
240
|
+
onNodeRemoved: refresh
|
|
241
|
+
}
|
|
242
|
+
}, _react().default.createElement("div", {
|
|
243
|
+
className: "workflow-toolbar"
|
|
244
|
+
}, _react().default.createElement("header", null, _react().default.createElement("strong", null, workflow.title)), _react().default.createElement("aside", null, _react().default.createElement("div", {
|
|
245
|
+
className: "workflow-versions"
|
|
246
|
+
}, _react().default.createElement("label", null, t('Version')), _react().default.createElement(_antd().Dropdown, {
|
|
247
|
+
trigger: ['click'],
|
|
248
|
+
overlay: _react().default.createElement(_antd().Menu, {
|
|
249
|
+
onClick: onSwitchVersion,
|
|
250
|
+
defaultSelectedKeys: [workflow.id],
|
|
251
|
+
className: (0, _css().cx)(_style.workflowVersionDropdownClass)
|
|
252
|
+
}, revisions.sort((a, b) => b.id - a.id).map(item => _react().default.createElement(_antd().Menu.Item, {
|
|
253
|
+
key: item.id,
|
|
254
|
+
icon: item.current ? _react().default.createElement(_icons().RightOutlined, null) : null,
|
|
255
|
+
className: item.executed ? 'executed' : 'unexecuted'
|
|
256
|
+
}, _react().default.createElement("strong", null, `#${item.id}`), _react().default.createElement("time", null, new Date(item.createdAt).toLocaleString()))))
|
|
257
|
+
}, _react().default.createElement(_antd().Button, {
|
|
258
|
+
type: "link"
|
|
259
|
+
}, (workflow === null || workflow === void 0 ? void 0 : workflow.id) ? `#${workflow.id}` : null, _react().default.createElement(_icons().DownOutlined, null)))), _react().default.createElement(_antd().Switch, {
|
|
260
|
+
checked: workflow.enabled,
|
|
261
|
+
onChange: onToggle,
|
|
262
|
+
checkedChildren: t('On'),
|
|
263
|
+
unCheckedChildren: t('Off')
|
|
264
|
+
}), workflow.executed && !revisions.find(item => !item.executed && new Date(item.createdAt) > new Date(workflow.createdAt)) ? _react().default.createElement(_antd().Button, {
|
|
265
|
+
onClick: onRevision
|
|
266
|
+
}, t('Copy to new version')) : null)), _react().default.createElement("div", {
|
|
267
|
+
className: "workflow-canvas"
|
|
268
|
+
}, _react().default.createElement(_triggers.TriggerConfig, null), _react().default.createElement("div", {
|
|
269
|
+
className: _style.branchBlockClass
|
|
270
|
+
}, _react().default.createElement(Branch, {
|
|
271
|
+
entry: entry
|
|
272
|
+
})), _react().default.createElement("div", {
|
|
273
|
+
className: (0, _css().cx)(_style.nodeCardClass)
|
|
274
|
+
}, _react().default.createElement("div", {
|
|
275
|
+
className: (0, _css().cx)(_style.nodeMetaClass)
|
|
276
|
+
}, _react().default.createElement(_antd().Tag, {
|
|
277
|
+
color: "#333"
|
|
278
|
+
}, t('End'))))));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function Branch({
|
|
282
|
+
from = null,
|
|
283
|
+
entry = null,
|
|
284
|
+
branchIndex = null,
|
|
285
|
+
controller = null
|
|
286
|
+
}) {
|
|
287
|
+
const list = [];
|
|
288
|
+
|
|
289
|
+
for (let node = entry; node; node = node.downstream) {
|
|
290
|
+
list.push(node);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return _react().default.createElement("div", {
|
|
294
|
+
className: (0, _css().cx)(_style.branchClass)
|
|
295
|
+
}, _react().default.createElement("div", {
|
|
296
|
+
className: "workflow-branch-lines"
|
|
297
|
+
}), controller, _react().default.createElement(AddButton, {
|
|
298
|
+
upstream: from,
|
|
299
|
+
branchIndex: branchIndex
|
|
300
|
+
}), _react().default.createElement("div", {
|
|
301
|
+
className: "workflow-node-list"
|
|
302
|
+
}, list.map(item => _react().default.createElement(_nodes.Node, {
|
|
303
|
+
data: item,
|
|
304
|
+
key: item.id
|
|
305
|
+
}))));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
;
|
|
309
|
+
|
|
310
|
+
function AddButton({
|
|
311
|
+
upstream,
|
|
312
|
+
branchIndex = null
|
|
313
|
+
}) {
|
|
314
|
+
const compile = (0, _client().useCompile)();
|
|
315
|
+
const api = (0, _client().useAPIClient)();
|
|
316
|
+
|
|
317
|
+
const _useFlowContext = useFlowContext(),
|
|
318
|
+
workflow = _useFlowContext.workflow,
|
|
319
|
+
onNodeAdded = _useFlowContext.onNodeAdded;
|
|
320
|
+
|
|
321
|
+
const resource = api.resource('workflows.nodes', workflow.id);
|
|
322
|
+
|
|
323
|
+
function onCreate(_x2) {
|
|
324
|
+
return _onCreate.apply(this, arguments);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function _onCreate() {
|
|
328
|
+
_onCreate = _asyncToGenerator(function* ({
|
|
329
|
+
keyPath
|
|
330
|
+
}) {
|
|
331
|
+
var _upstream$id;
|
|
332
|
+
|
|
333
|
+
const type = keyPath.pop();
|
|
334
|
+
const config = {};
|
|
335
|
+
|
|
336
|
+
const _keyPath = _slicedToArray(keyPath, 1),
|
|
337
|
+
optionKey = _keyPath[0];
|
|
338
|
+
|
|
339
|
+
if (optionKey) {
|
|
340
|
+
const _instructions$get$opt = _nodes.instructions.get(type).options.find(item => item.key === optionKey),
|
|
341
|
+
value = _instructions$get$opt.value;
|
|
342
|
+
|
|
343
|
+
Object.assign(config, value);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const _yield$resource$creat = yield resource.create({
|
|
347
|
+
values: {
|
|
348
|
+
type,
|
|
349
|
+
upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
|
|
350
|
+
branchIndex,
|
|
351
|
+
config
|
|
352
|
+
}
|
|
353
|
+
}),
|
|
354
|
+
node = _yield$resource$creat.data.data;
|
|
355
|
+
|
|
356
|
+
onNodeAdded(node);
|
|
357
|
+
});
|
|
358
|
+
return _onCreate.apply(this, arguments);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const groups = [{
|
|
362
|
+
value: 'control',
|
|
363
|
+
name: '{{t("Control")}}'
|
|
364
|
+
}, {
|
|
365
|
+
value: 'collection',
|
|
366
|
+
name: '{{t("Collection operations")}}'
|
|
367
|
+
}];
|
|
368
|
+
const instructionList = Array.from(_nodes.instructions.getValues());
|
|
369
|
+
return _react().default.createElement("div", {
|
|
370
|
+
className: (0, _css().cx)(_style.addButtonClass)
|
|
371
|
+
}, _react().default.createElement(_antd().Dropdown, {
|
|
372
|
+
trigger: ['click'],
|
|
373
|
+
overlay: _react().default.createElement(_antd().Menu, {
|
|
374
|
+
onClick: ev => onCreate(ev)
|
|
375
|
+
}, groups.map(group => _react().default.createElement(_antd().Menu.ItemGroup, {
|
|
376
|
+
key: group.value,
|
|
377
|
+
title: compile(group.name)
|
|
378
|
+
}, instructionList.filter(item => item.group === group.value).map(item => item.options ? _react().default.createElement(_antd().Menu.SubMenu, {
|
|
379
|
+
key: item.type,
|
|
380
|
+
title: compile(item.title)
|
|
381
|
+
}, item.options.map(option => _react().default.createElement(_antd().Menu.Item, {
|
|
382
|
+
key: option.key
|
|
383
|
+
}, compile(option.label)))) : _react().default.createElement(_antd().Menu.Item, {
|
|
384
|
+
key: item.type
|
|
385
|
+
}, compile(item.title)))))),
|
|
386
|
+
disabled: workflow.executed
|
|
387
|
+
}, _react().default.createElement(_antd().Button, {
|
|
388
|
+
shape: "circle",
|
|
389
|
+
icon: _react().default.createElement(_icons().PlusOutlined, null)
|
|
390
|
+
})));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WorkflowLink: () => JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WorkflowLink = void 0;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _reactI18next() {
|
|
19
|
+
const data = require("react-i18next");
|
|
20
|
+
|
|
21
|
+
_reactI18next = function _reactI18next() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _reactRouterDom() {
|
|
29
|
+
const data = require("react-router-dom");
|
|
30
|
+
|
|
31
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _client() {
|
|
39
|
+
const data = require("@nocobase/client");
|
|
40
|
+
|
|
41
|
+
_client = function _client() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
|
+
|
|
50
|
+
const WorkflowLink = () => {
|
|
51
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
52
|
+
t = _useTranslation.t;
|
|
53
|
+
|
|
54
|
+
const _useRecord = (0, _client().useRecord)(),
|
|
55
|
+
id = _useRecord.id;
|
|
56
|
+
|
|
57
|
+
const _useActionContext = (0, _client().useActionContext)(),
|
|
58
|
+
setVisible = _useActionContext.setVisible;
|
|
59
|
+
|
|
60
|
+
return _react().default.createElement(_reactRouterDom().Link, {
|
|
61
|
+
to: `/admin/plugins/workflows/${id}`,
|
|
62
|
+
onClick: () => setVisible(false)
|
|
63
|
+
}, t('View'));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.WorkflowLink = WorkflowLink;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WorkflowPage: () => JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WorkflowPage = void 0;
|
|
7
|
+
|
|
8
|
+
function _css() {
|
|
9
|
+
const data = require("@emotion/css");
|
|
10
|
+
|
|
11
|
+
_css = function _css() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _react() {
|
|
19
|
+
const data = _interopRequireDefault(require("react"));
|
|
20
|
+
|
|
21
|
+
_react = function _react() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _reactRouterDom() {
|
|
29
|
+
const data = require("react-router-dom");
|
|
30
|
+
|
|
31
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _client() {
|
|
39
|
+
const data = require("@nocobase/client");
|
|
40
|
+
|
|
41
|
+
_client = function _client() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var _style = require("./style");
|
|
49
|
+
|
|
50
|
+
var _WorkflowCanvas = require("./WorkflowCanvas");
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
+
|
|
54
|
+
const WorkflowPage = () => {
|
|
55
|
+
const _useRouteMatch = (0, _reactRouterDom().useRouteMatch)(),
|
|
56
|
+
params = _useRouteMatch.params;
|
|
57
|
+
|
|
58
|
+
return _react().default.createElement("div", {
|
|
59
|
+
className: (0, _css().cx)(_style.workflowPageClass)
|
|
60
|
+
}, _react().default.createElement(_client().SchemaComponent, {
|
|
61
|
+
schema: {
|
|
62
|
+
type: 'void',
|
|
63
|
+
properties: {
|
|
64
|
+
[`provider_${params.id}`]: {
|
|
65
|
+
type: 'void',
|
|
66
|
+
'x-decorator': 'ResourceActionProvider',
|
|
67
|
+
'x-decorator-props': {
|
|
68
|
+
collection: {
|
|
69
|
+
name: 'workflows',
|
|
70
|
+
fields: []
|
|
71
|
+
},
|
|
72
|
+
resourceName: 'workflows',
|
|
73
|
+
request: {
|
|
74
|
+
resource: 'workflows',
|
|
75
|
+
action: 'get',
|
|
76
|
+
params: {
|
|
77
|
+
filter: params,
|
|
78
|
+
appends: ['nodes', 'revisions.id', 'revisions.createdAt', 'revisions.current', 'revisions.executed']
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
'x-component': 'WorkflowCanvas'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
components: {
|
|
87
|
+
WorkflowCanvas: _WorkflowCanvas.WorkflowCanvas
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.WorkflowPage = WorkflowPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WorkflowProvider: (props: any) => JSX.Element;
|