@nocobase/plugin-workflow 0.9.1-alpha.1 → 0.9.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.
Files changed (132) hide show
  1. package/lib/client/AddButton.js +50 -86
  2. package/lib/client/Branch.js +0 -13
  3. package/lib/client/ExecutionCanvas.js +16 -63
  4. package/lib/client/ExecutionLink.js +3 -21
  5. package/lib/client/ExecutionPage.js +1 -19
  6. package/lib/client/ExecutionResourceProvider.js +6 -23
  7. package/lib/client/FlowContext.js +0 -8
  8. package/lib/client/WorkflowCanvas.js +57 -129
  9. package/lib/client/WorkflowLink.js +3 -21
  10. package/lib/client/WorkflowPage.js +1 -19
  11. package/lib/client/WorkflowProvider.js +24 -47
  12. package/lib/client/WorkflowShortcut.js +0 -16
  13. package/lib/client/components/CollectionBlockInitializer.js +12 -22
  14. package/lib/client/components/CollectionFieldInitializers.js +5 -24
  15. package/lib/client/components/CollectionFieldset.js +33 -85
  16. package/lib/client/components/Duration.js +0 -14
  17. package/lib/client/components/DynamicExpression.d.ts +4 -0
  18. package/lib/client/components/DynamicExpression.js +102 -0
  19. package/lib/client/components/FieldsSelect.d.ts +2 -0
  20. package/lib/client/components/FieldsSelect.js +66 -0
  21. package/lib/client/components/FilterDynamicComponent.js +1 -10
  22. package/lib/client/components/NullRender.js +0 -1
  23. package/lib/client/components/OpenDrawer.js +10 -35
  24. package/lib/client/components/RadioWithTooltip.js +5 -27
  25. package/lib/client/components/renderEngineReference.d.ts +1 -0
  26. package/lib/client/components/renderEngineReference.js +55 -0
  27. package/lib/client/constants.js +0 -9
  28. package/lib/client/index.js +0 -6
  29. package/lib/client/interfaces/expression.d.ts +3 -0
  30. package/lib/client/interfaces/expression.js +37 -0
  31. package/lib/client/locale/index.js +5 -15
  32. package/lib/client/locale/pt-BR.d.ts +130 -0
  33. package/lib/client/locale/pt-BR.js +136 -0
  34. package/lib/client/locale/zh-CN.d.ts +16 -1
  35. package/lib/client/locale/zh-CN.js +17 -2
  36. package/lib/client/nodes/calculation.d.ts +56 -7
  37. package/lib/client/nodes/calculation.js +141 -74
  38. package/lib/client/nodes/condition.d.ts +5 -9
  39. package/lib/client/nodes/condition.js +30 -93
  40. package/lib/client/nodes/create.d.ts +36 -12
  41. package/lib/client/nodes/create.js +14 -28
  42. package/lib/client/nodes/delay.d.ts +3 -7
  43. package/lib/client/nodes/delay.js +5 -14
  44. package/lib/client/nodes/destroy.d.ts +3 -11
  45. package/lib/client/nodes/destroy.js +14 -12
  46. package/lib/client/nodes/index.d.ts +2 -2
  47. package/lib/client/nodes/index.js +181 -222
  48. package/lib/client/nodes/manual/AssigneesSelect.js +8 -18
  49. package/lib/client/nodes/manual/ModeConfig.js +0 -27
  50. package/lib/client/nodes/manual/SchemaConfig.js +87 -449
  51. package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
  52. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
  53. package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
  54. package/lib/client/nodes/manual/forms/customForm.js +411 -0
  55. package/lib/client/nodes/manual/index.d.ts +15 -6
  56. package/lib/client/nodes/manual/index.js +58 -54
  57. package/lib/client/nodes/parallel.d.ts +1 -2
  58. package/lib/client/nodes/parallel.js +16 -45
  59. package/lib/client/nodes/query.d.ts +30 -12
  60. package/lib/client/nodes/query.js +17 -25
  61. package/lib/client/nodes/request.d.ts +9 -17
  62. package/lib/client/nodes/request.js +13 -37
  63. package/lib/client/nodes/update.d.ts +27 -28
  64. package/lib/client/nodes/update.js +17 -18
  65. package/lib/client/schemas/collection.d.ts +20 -7
  66. package/lib/client/schemas/collection.js +27 -28
  67. package/lib/client/schemas/executions.js +3 -18
  68. package/lib/client/schemas/workflows.js +10 -33
  69. package/lib/client/style.js +75 -26
  70. package/lib/client/triggers/collection.d.ts +47 -18
  71. package/lib/client/triggers/collection.js +65 -123
  72. package/lib/client/triggers/index.d.ts +3 -6
  73. package/lib/client/triggers/index.js +146 -146
  74. package/lib/client/triggers/schedule/DateFieldsSelect.js +7 -32
  75. package/lib/client/triggers/schedule/EndsByField.js +1 -18
  76. package/lib/client/triggers/schedule/OnField.js +10 -38
  77. package/lib/client/triggers/schedule/RepeatField.js +4 -32
  78. package/lib/client/triggers/schedule/ScheduleConfig.js +25 -68
  79. package/lib/client/triggers/schedule/index.d.ts +21 -1
  80. package/lib/client/triggers/schedule/index.js +22 -24
  81. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
  82. package/lib/client/utils.d.ts +1 -0
  83. package/lib/client/utils.js +31 -10
  84. package/lib/client/variable.d.ts +7 -6
  85. package/lib/client/variable.js +132 -71
  86. package/lib/index.js +0 -2
  87. package/lib/server/Plugin.d.ts +7 -7
  88. package/lib/server/Plugin.js +76 -111
  89. package/lib/server/Processor.d.ts +2 -0
  90. package/lib/server/Processor.js +62 -125
  91. package/lib/server/actions/index.js +3 -10
  92. package/lib/server/actions/nodes.js +34 -87
  93. package/lib/server/actions/workflows.js +46 -96
  94. package/lib/server/collections/executions.js +1 -1
  95. package/lib/server/collections/flow_nodes.js +7 -4
  96. package/lib/server/collections/jobs.js +1 -1
  97. package/lib/server/collections/workflows.js +3 -4
  98. package/lib/server/fields/expression-field.d.ts +8 -0
  99. package/lib/server/fields/expression-field.js +26 -0
  100. package/lib/server/fields/index.d.ts +1 -0
  101. package/lib/server/fields/index.js +12 -0
  102. package/lib/server/functions/index.js +3 -14
  103. package/lib/server/index.js +0 -6
  104. package/lib/server/instructions/calculation.js +22 -17
  105. package/lib/server/instructions/condition.js +8 -52
  106. package/lib/server/instructions/create.js +31 -15
  107. package/lib/server/instructions/delay.js +4 -32
  108. package/lib/server/instructions/destroy.js +6 -12
  109. package/lib/server/instructions/index.js +6 -23
  110. package/lib/server/instructions/manual/actions.js +22 -31
  111. package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
  112. package/lib/server/instructions/manual/index.d.ts +13 -12
  113. package/lib/server/instructions/manual/index.js +9 -47
  114. package/lib/server/instructions/parallel.js +9 -36
  115. package/lib/server/instructions/query.js +17 -15
  116. package/lib/server/instructions/request.js +7 -30
  117. package/lib/server/instructions/update.js +8 -14
  118. package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
  119. package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
  120. package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
  121. package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
  122. package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
  123. package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
  124. package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
  125. package/lib/server/models/Execution.js +0 -5
  126. package/lib/server/models/FlowNode.js +0 -5
  127. package/lib/server/models/Job.js +0 -5
  128. package/lib/server/models/Workflow.js +0 -5
  129. package/lib/server/triggers/collection.js +39 -61
  130. package/lib/server/triggers/index.js +3 -22
  131. package/lib/server/triggers/schedule.js +72 -194
  132. package/package.json +14 -11
@@ -4,183 +4,147 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AddButton = AddButton;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireDefault(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _css() {
19
15
  const data = require("@emotion/css");
20
-
21
16
  _css = function _css() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _antd() {
29
22
  const data = require("antd");
30
-
31
23
  _antd = function _antd() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _icons() {
39
29
  const data = require("@ant-design/icons");
40
-
41
30
  _icons = function _icons() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  function _client() {
49
36
  const data = require("@nocobase/client");
50
-
51
37
  _client = function _client() {
52
38
  return data;
53
39
  };
54
-
55
40
  return data;
56
41
  }
57
-
58
42
  var _FlowContext = require("./FlowContext");
59
-
60
43
  var _nodes = require("./nodes");
61
-
62
44
  var _style = require("./style");
63
-
64
45
  var _locale = require("./locale");
65
-
66
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
67
-
68
47
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
69
-
70
48
  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."); }
71
-
72
49
  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); }
73
-
74
50
  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; }
75
-
76
- 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; }
77
-
51
+ 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; } }
78
52
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
79
-
53
+ 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; }
54
+ 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; }
55
+ 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; }
56
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
57
+ 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); }
80
58
  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); } }
81
-
82
59
  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); }); }; }
83
-
84
60
  ;
85
-
86
61
  function AddButton({
87
62
  upstream,
88
63
  branchIndex = null
89
64
  }) {
90
65
  var _useFlowContext;
91
-
92
66
  const compile = (0, _client().useCompile)();
93
67
  const api = (0, _client().useAPIClient)();
94
-
95
68
  const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
96
- workflow = _ref.workflow,
97
- onNodeAdded = _ref.onNodeAdded;
98
-
69
+ workflow = _ref.workflow,
70
+ refresh = _ref.refresh;
99
71
  if (!workflow) {
100
72
  return null;
101
73
  }
102
-
103
74
  const resource = api.resource('workflows.nodes', workflow.id);
104
-
105
75
  function onCreate(_x) {
106
76
  return _onCreate.apply(this, arguments);
107
77
  }
108
-
109
78
  function _onCreate() {
110
79
  _onCreate = _asyncToGenerator(function* ({
111
80
  keyPath
112
81
  }) {
113
82
  var _upstream$id;
114
-
115
83
  const type = keyPath.pop();
116
84
  const config = {};
117
-
118
85
  const _keyPath = _slicedToArray(keyPath, 1),
119
- optionKey = _keyPath[0];
120
-
86
+ optionKey = _keyPath[0];
87
+ const instruction = _nodes.instructions.get(type);
121
88
  if (optionKey) {
122
- var _instructions$get$opt, _instructions$get, _instructions$get$opt2;
123
-
124
- const _ref2 = (_instructions$get$opt = (_instructions$get = _nodes.instructions.get(type)) === null || _instructions$get === void 0 ? void 0 : (_instructions$get$opt2 = _instructions$get.options) === null || _instructions$get$opt2 === void 0 ? void 0 : _instructions$get$opt2.find(item => item.key === optionKey)) !== null && _instructions$get$opt !== void 0 ? _instructions$get$opt : {},
125
- value = _ref2.value;
126
-
89
+ var _instruction$options$, _instruction$options;
90
+ const _ref2 = (_instruction$options$ = (_instruction$options = instruction.options) === null || _instruction$options === void 0 ? void 0 : _instruction$options.find(item => item.key === optionKey)) !== null && _instruction$options$ !== void 0 ? _instruction$options$ : {},
91
+ value = _ref2.value;
127
92
  Object.assign(config, value);
128
93
  }
129
-
130
94
  const _yield$resource$creat = yield resource.create({
131
- values: {
132
- type,
133
- upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
134
- branchIndex,
135
- config
136
- }
137
- }),
138
- node = _yield$resource$creat.data.data;
139
-
140
- onNodeAdded(node);
95
+ values: {
96
+ type,
97
+ upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
98
+ branchIndex,
99
+ title: compile(instruction.title),
100
+ config
101
+ }
102
+ }),
103
+ node = _yield$resource$creat.data.data;
104
+ refresh();
141
105
  });
142
106
  return _onCreate.apply(this, arguments);
143
107
  }
144
-
108
+ const instructionList = Array.from(_nodes.instructions.getValues());
145
109
  const groups = [{
146
- value: 'control',
147
- name: `{{t("Control", { ns: "${_locale.NAMESPACE}" })}}`
110
+ key: 'control',
111
+ label: `{{t("Control", { ns: "${_locale.NAMESPACE}" })}}`
148
112
  }, {
149
- value: 'collection',
150
- name: `{{t("Collection operations", { ns: "${_locale.NAMESPACE}" })}}`
113
+ key: 'collection',
114
+ label: `{{t("Collection operations", { ns: "${_locale.NAMESPACE}" })}}`
151
115
  }, {
152
- value: 'manual',
153
- name: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`
116
+ key: 'manual',
117
+ label: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`
154
118
  }, {
155
- value: 'extended',
156
- name: `{{t("Extended types", { ns: "${_locale.NAMESPACE}" })}}`
157
- }];
158
- const instructionList = Array.from(_nodes.instructions.getValues());
119
+ key: 'extended',
120
+ label: `{{t("Extended types", { ns: "${_locale.NAMESPACE}" })}}`
121
+ }].filter(group => instructionList.filter(item => item.group === group.key).length).map(group => {
122
+ const groupInstructions = instructionList.filter(item => item.group === group.key);
123
+ return _objectSpread(_objectSpread({}, group), {}, {
124
+ type: 'group',
125
+ children: groupInstructions.map(item => ({
126
+ key: item.type,
127
+ label: item.title,
128
+ type: item.options ? 'subMenu' : null,
129
+ children: item.options ? item.options.map(option => ({
130
+ key: option.key,
131
+ label: option.label
132
+ })) : null
133
+ }))
134
+ });
135
+ });
159
136
  return _react().default.createElement("div", {
160
137
  className: (0, _css().cx)(_style.addButtonClass)
161
138
  }, _react().default.createElement(_antd().Dropdown, {
162
139
  trigger: ['click'],
163
140
  overlay: _react().default.createElement(_antd().Menu, {
164
- onClick: ev => onCreate(ev)
165
- }, groups.map(group => {
166
- const groupInstructions = instructionList.filter(item => item.group === group.value);
167
- return groupInstructions.length ? _react().default.createElement(_antd().Menu.ItemGroup, {
168
- key: group.value,
169
- title: compile(group.name)
170
- }, groupInstructions.map(item => item.options ? _react().default.createElement(_antd().Menu.SubMenu, {
171
- key: item.type,
172
- title: compile(item.title)
173
- }, item.options.map(option => _react().default.createElement(_antd().Menu.Item, {
174
- key: option.key
175
- }, compile(option.label)))) : _react().default.createElement(_antd().Menu.Item, {
176
- key: item.type
177
- }, compile(item.title)))) : null;
178
- })),
141
+ onClick: ev => onCreate(ev),
142
+ items: compile(groups)
143
+ }),
179
144
  disabled: workflow.executed
180
145
  }, _react().default.createElement(_antd().Button, {
181
146
  shape: "circle",
182
147
  icon: _react().default.createElement(_icons().PlusOutlined, null)
183
148
  })));
184
149
  }
185
-
186
150
  ;
@@ -4,35 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Branch = Branch;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireDefault(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _css() {
19
15
  const data = require("@emotion/css");
20
-
21
16
  _css = function _css() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  var _style = require("./style");
29
-
30
22
  var _AddButton = require("./AddButton");
31
-
32
23
  var _nodes = require("./nodes");
33
-
34
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
25
  function Branch({
37
26
  from = null,
38
27
  entry = null,
@@ -40,11 +29,9 @@ function Branch({
40
29
  controller = null
41
30
  }) {
42
31
  const list = [];
43
-
44
32
  for (let node = entry; node; node = node.downstream) {
45
33
  list.push(node);
46
34
  }
47
-
48
35
  return _react().default.createElement("div", {
49
36
  className: (0, _css().cx)(_style.branchClass)
50
37
  }, _react().default.createElement("div", {
@@ -4,111 +4,74 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionCanvas = ExecutionCanvas;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireWildcard(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _antd() {
19
15
  const data = require("antd");
20
-
21
16
  _antd = function _antd() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _css() {
29
22
  const data = require("@emotion/css");
30
-
31
23
  _css = function _css() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _reactRouterDom() {
39
29
  const data = require("react-router-dom");
40
-
41
30
  _reactRouterDom = function _reactRouterDom() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  function _client() {
49
36
  const data = require("@nocobase/client");
50
-
51
37
  _client = function _client() {
52
38
  return data;
53
39
  };
54
-
55
40
  return data;
56
41
  }
57
-
58
42
  function _client2() {
59
43
  const data = require("@nocobase/utils/client");
60
-
61
44
  _client2 = function _client2() {
62
45
  return data;
63
46
  };
64
-
65
47
  return data;
66
48
  }
67
-
68
49
  var _FlowContext = require("./FlowContext");
69
-
70
50
  var _style = require("./style");
71
-
72
51
  var _triggers = require("./triggers");
73
-
74
52
  var _Branch = require("./Branch");
75
-
76
53
  var _constants = require("./constants");
77
-
78
54
  var _locale = require("./locale");
79
-
80
55
  var _utils = require("./utils");
81
-
82
56
  const _excluded = ["nodes", "revisions"],
83
- _excluded2 = ["jobs", "workflow"];
84
-
57
+ _excluded2 = ["jobs", "workflow"];
85
58
  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); }
86
-
87
59
  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; }
88
-
89
60
  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; }
90
-
91
61
  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; }
92
-
93
62
  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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
94
-
95
63
  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); }
96
-
97
64
  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; }
98
-
99
65
  function attachJobs(nodes, jobs = []) {
100
66
  const nodesMap = new Map();
101
67
  nodes.forEach(item => nodesMap.set(item.id, item));
102
68
  const jobsMap = new Map();
103
69
  jobs.forEach(item => jobsMap.set(item.nodeId, item));
104
-
105
70
  var _iterator = _createForOfIteratorHelper(nodesMap.values()),
106
- _step;
107
-
71
+ _step;
108
72
  try {
109
73
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
110
74
  let node = _step.value;
111
-
112
75
  if (jobsMap.has(node.id)) {
113
76
  node.job = jobsMap.get(node.id);
114
77
  }
@@ -119,28 +82,20 @@ function attachJobs(nodes, jobs = []) {
119
82
  _iterator.f();
120
83
  }
121
84
  }
122
-
123
85
  function ExecutionCanvas() {
124
86
  var _data$data2;
125
-
126
87
  const compile = (0, _client().useCompile)();
127
-
128
88
  const _useResourceActionCon = (0, _client().useResourceActionContext)(),
129
- data = _useResourceActionCon.data,
130
- loading = _useResourceActionCon.loading;
131
-
89
+ data = _useResourceActionCon.data,
90
+ loading = _useResourceActionCon.loading;
132
91
  const _useDocumentTitle = (0, _client().useDocumentTitle)(),
133
- setTitle = _useDocumentTitle.setTitle;
134
-
92
+ setTitle = _useDocumentTitle.setTitle;
135
93
  (0, _react().useEffect)(() => {
136
94
  var _data$data;
137
-
138
95
  const _ref = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
139
- workflow = _ref.workflow;
140
-
96
+ workflow = _ref.workflow;
141
97
  setTitle === null || setTitle === void 0 ? void 0 : setTitle(`${(workflow === null || workflow === void 0 ? void 0 : workflow.title) ? `${workflow.title} - ` : ''}${(0, _locale.lang)('Execution history')}`);
142
98
  }, [data === null || data === void 0 ? void 0 : data.data]);
143
-
144
99
  if (!(data === null || data === void 0 ? void 0 : data.data)) {
145
100
  if (loading) {
146
101
  return _react().default.createElement("div", null, (0, _locale.lang)('Loading'));
@@ -148,19 +103,17 @@ function ExecutionCanvas() {
148
103
  return _react().default.createElement("div", null, (0, _locale.lang)('Load failed'));
149
104
  }
150
105
  }
151
-
152
106
  const _ref2 = (_data$data2 = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data2 !== void 0 ? _data$data2 : {},
153
- _ref2$jobs = _ref2.jobs,
154
- jobs = _ref2$jobs === void 0 ? [] : _ref2$jobs,
155
- _ref2$workflow = _ref2.workflow,
156
- _ref2$workflow2 = _ref2$workflow === void 0 ? {} : _ref2$workflow,
157
- _ref2$workflow2$nodes = _ref2$workflow2.nodes,
158
- nodes = _ref2$workflow2$nodes === void 0 ? [] : _ref2$workflow2$nodes,
159
- _ref2$workflow2$revis = _ref2$workflow2.revisions,
160
- revisions = _ref2$workflow2$revis === void 0 ? [] : _ref2$workflow2$revis,
161
- workflow = _objectWithoutProperties(_ref2$workflow2, _excluded),
162
- execution = _objectWithoutProperties(_ref2, _excluded2);
163
-
107
+ _ref2$jobs = _ref2.jobs,
108
+ jobs = _ref2$jobs === void 0 ? [] : _ref2$jobs,
109
+ _ref2$workflow = _ref2.workflow,
110
+ _ref2$workflow2 = _ref2$workflow === void 0 ? {} : _ref2$workflow,
111
+ _ref2$workflow2$nodes = _ref2$workflow2.nodes,
112
+ nodes = _ref2$workflow2$nodes === void 0 ? [] : _ref2$workflow2$nodes,
113
+ _ref2$workflow2$revis = _ref2$workflow2.revisions,
114
+ revisions = _ref2$workflow2$revis === void 0 ? [] : _ref2$workflow2$revis,
115
+ workflow = _objectWithoutProperties(_ref2$workflow2, _excluded),
116
+ execution = _objectWithoutProperties(_ref2, _excluded2);
164
117
  (0, _utils.linkNodes)(nodes);
165
118
  attachJobs(nodes, jobs);
166
119
  const entry = nodes.find(item => !item.upstream);
@@ -4,63 +4,45 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionLink = void 0;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireDefault(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _reactI18next() {
19
15
  const data = require("react-i18next");
20
-
21
16
  _reactI18next = function _reactI18next() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _reactRouterDom() {
29
22
  const data = require("react-router-dom");
30
-
31
23
  _reactRouterDom = function _reactRouterDom() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _client() {
39
29
  const data = require("@nocobase/client");
40
-
41
30
  _client = function _client() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
-
50
36
  const ExecutionLink = () => {
51
37
  const _useTranslation = (0, _reactI18next().useTranslation)(),
52
- t = _useTranslation.t;
53
-
38
+ t = _useTranslation.t;
54
39
  const _useRecord = (0, _client().useRecord)(),
55
- id = _useRecord.id;
56
-
40
+ id = _useRecord.id;
57
41
  const _useActionContext = (0, _client().useActionContext)(),
58
- setVisible = _useActionContext.setVisible;
59
-
42
+ setVisible = _useActionContext.setVisible;
60
43
  return _react().default.createElement(_reactRouterDom().Link, {
61
44
  to: `/admin/settings/workflow/executions/${id}`,
62
45
  onClick: () => setVisible(false)
63
46
  }, t('View'));
64
47
  };
65
-
66
48
  exports.ExecutionLink = ExecutionLink;
@@ -4,57 +4,40 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionPage = void 0;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireDefault(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _css() {
19
15
  const data = require("@emotion/css");
20
-
21
16
  _css = function _css() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _reactRouterDom() {
29
22
  const data = require("react-router-dom");
30
-
31
23
  _reactRouterDom = function _reactRouterDom() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _client() {
39
29
  const data = require("@nocobase/client");
40
-
41
30
  _client = function _client() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  var _style = require("./style");
49
-
50
36
  var _ExecutionCanvas = require("./ExecutionCanvas");
51
-
52
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
-
54
38
  const ExecutionPage = () => {
55
39
  const _useRouteMatch = (0, _reactRouterDom().useRouteMatch)(),
56
- params = _useRouteMatch.params;
57
-
40
+ params = _useRouteMatch.params;
58
41
  return _react().default.createElement("div", {
59
42
  className: (0, _css().cx)(_style.workflowPageClass)
60
43
  }, _react().default.createElement(_client().SchemaComponent, {
@@ -88,5 +71,4 @@ const ExecutionPage = () => {
88
71
  }
89
72
  }));
90
73
  };
91
-
92
74
  exports.ExecutionPage = ExecutionPage;
@@ -4,51 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionResourceProvider = void 0;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireDefault(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _client() {
19
15
  const data = require("@nocobase/client");
20
-
21
16
  _client = function _client() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  const _excluded = ["request", "filter"];
29
-
30
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
23
  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
24
  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
-
25
+ 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; }
26
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
27
+ 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); }
38
28
  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
29
  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
30
  const ExecutionResourceProvider = _ref => {
43
31
  var _request$params;
44
-
45
32
  let request = _ref.request,
46
- _ref$filter = _ref.filter,
47
- filter = _ref$filter === void 0 ? {} : _ref$filter,
48
- others = _objectWithoutProperties(_ref, _excluded);
49
-
33
+ _ref$filter = _ref.filter,
34
+ filter = _ref$filter === void 0 ? {} : _ref$filter,
35
+ others = _objectWithoutProperties(_ref, _excluded);
50
36
  const workflow = (0, _client().useRecord)();
51
-
52
37
  const props = _objectSpread(_objectSpread({}, others), {}, {
53
38
  request: _objectSpread(_objectSpread({}, request), {}, {
54
39
  params: _objectSpread(_objectSpread({}, request === null || request === void 0 ? void 0 : request.params), {}, {
@@ -58,8 +43,6 @@ const ExecutionResourceProvider = _ref => {
58
43
  })
59
44
  })
60
45
  });
61
-
62
46
  return _react().default.createElement(_client().ResourceActionProvider, _objectSpread({}, props));
63
47
  };
64
-
65
48
  exports.ExecutionResourceProvider = ExecutionResourceProvider;