@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,83 +4,55 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
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 _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 _icons() {
29
22
  const data = require("@ant-design/icons");
30
-
31
23
  _icons = function _icons() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _antd() {
39
29
  const data = require("antd");
40
-
41
30
  _antd = function _antd() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  var _2 = require(".");
49
-
50
36
  var _Branch = require("../Branch");
51
-
52
37
  var _FlowContext = require("../FlowContext");
53
-
54
38
  var _style = require("../style");
55
-
56
39
  var _locale = require("../locale");
57
-
58
40
  var _RadioWithTooltip = require("../components/RadioWithTooltip");
59
-
60
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); }
61
-
62
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; }
63
-
64
43
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
65
-
66
44
  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."); }
67
-
68
45
  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); }
69
-
70
46
  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; }
71
-
72
- 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; }
73
-
47
+ 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; } }
74
48
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
75
-
76
49
  var _default = {
77
50
  title: `{{t("Parallel branch", { ns: "${_locale.NAMESPACE}" })}}`,
78
51
  type: 'parallel',
79
52
  group: 'control',
80
53
  fieldset: {
81
- 'config.mode': {
54
+ mode: {
82
55
  type: 'string',
83
- name: 'config.mode',
84
56
  title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
85
57
  'x-decorator': 'FormItem',
86
58
  'x-component': 'RadioWithTooltip',
@@ -103,27 +75,22 @@ var _default = {
103
75
  }
104
76
  },
105
77
  view: {},
106
-
107
78
  render(data) {
108
79
  const id = data.id,
109
- mode = data.config.mode;
110
-
80
+ mode = data.config.mode;
111
81
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
112
- nodes = _useFlowContext.nodes;
113
-
82
+ workflow = _useFlowContext.workflow,
83
+ nodes = _useFlowContext.nodes;
114
84
  const branches = nodes.reduce((result, node) => {
115
85
  if (node.upstreamId === id && node.branchIndex != null) {
116
86
  return result.concat(node);
117
87
  }
118
-
119
88
  return result;
120
89
  }, []).sort((a, b) => a.branchIndex - b.branchIndex);
121
-
122
90
  const _useState = (0, _react().useState)(Math.max(2, branches.length)),
123
- _useState2 = _slicedToArray(_useState, 2),
124
- branchCount = _useState2[0],
125
- setBranchCount = _useState2[1];
126
-
91
+ _useState2 = _slicedToArray(_useState, 2),
92
+ branchCount = _useState2[0],
93
+ setBranchCount = _useState2[1];
127
94
  const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
128
95
  const lastBranchHead = branches[branches.length - 1];
129
96
  return _react().default.createElement(_2.NodeDefaultView, {
@@ -154,7 +121,8 @@ var _default = {
154
121
  }, _react().default.createElement(_antd().Button, {
155
122
  shape: "circle",
156
123
  icon: _react().default.createElement(_icons().PlusOutlined, null),
157
- onClick: () => setBranchCount(branchCount - 1)
124
+ onClick: () => setBranchCount(branchCount - 1),
125
+ disabled: workflow.executed
158
126
  })) : null
159
127
  }))), _react().default.createElement("div", {
160
128
  className: (0, _css().css)`
@@ -162,7 +130,10 @@ var _default = {
162
130
  height: 2em;
163
131
  `
164
132
  }, _react().default.createElement(_antd().Tooltip, {
165
- title: (0, _locale.lang)('Add branch')
133
+ title: (0, _locale.lang)('Add branch'),
134
+ className: (0, _css().css)`
135
+ visibility: ${workflow.executed ? 'hidden' : 'visible'}
136
+ `
166
137
  }, _react().default.createElement(_antd().Button, {
167
138
  icon: _react().default.createElement(_icons().PlusOutlined, null),
168
139
  className: (0, _css().css)`
@@ -174,10 +145,10 @@ var _default = {
174
145
  transform: rotate(-45deg);
175
146
  }
176
147
  `,
177
- onClick: () => setBranchCount(branchCount + 1)
148
+ onClick: () => setBranchCount(branchCount + 1),
149
+ disabled: workflow.executed
178
150
  })))));
179
151
  },
180
-
181
152
  components: {
182
153
  RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
183
154
  }
@@ -6,10 +6,9 @@ declare const _default: {
6
6
  type: string;
7
7
  group: string;
8
8
  fieldset: {
9
- 'config.collection': {
9
+ collection: {
10
10
  type: string;
11
11
  title: string;
12
- name: string;
13
12
  required: boolean;
14
13
  'x-reactions': string[];
15
14
  'x-decorator': string;
@@ -18,21 +17,13 @@ declare const _default: {
18
17
  placeholder: string;
19
18
  };
20
19
  };
21
- 'config.params': {
20
+ params: {
22
21
  type: string;
23
- name: string;
24
- title: string;
25
- 'x-decorator': string;
26
22
  properties: {
27
23
  filter: {
28
24
  type: string;
29
25
  title: string;
30
- name: string;
31
26
  'x-decorator': string;
32
- 'x-decorator-props': {
33
- labelAlign: string;
34
- className: string;
35
- };
36
27
  'x-component': string;
37
28
  'x-component-props': {
38
29
  useProps(): {
@@ -42,8 +33,34 @@ declare const _default: {
42
33
  dynamicComponent: string;
43
34
  };
44
35
  };
36
+ appends: {
37
+ type: string;
38
+ title: string;
39
+ description: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ 'x-component-props': {
43
+ mode: string;
44
+ placeholder: string;
45
+ filter(field: any): boolean;
46
+ };
47
+ 'x-reactions': {
48
+ dependencies: string[];
49
+ fulfill: {
50
+ state: {
51
+ visible: string;
52
+ };
53
+ };
54
+ }[];
55
+ };
45
56
  };
46
57
  };
58
+ failOnEmpty: {
59
+ type: string;
60
+ title: string;
61
+ 'x-decorator': string;
62
+ 'x-component': string;
63
+ };
47
64
  };
48
65
  view: {};
49
66
  scope: {
@@ -51,8 +68,9 @@ declare const _default: {
51
68
  };
52
69
  components: {
53
70
  FilterDynamicComponent: typeof FilterDynamicComponent;
71
+ FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
54
72
  };
55
- getOptions(config: any, types: any): any;
73
+ getOptions(config: any, types: any): import("../variable").VariableOption[];
56
74
  useInitializers(node: any): SchemaInitializerItemOptions | null;
57
75
  initializers: {
58
76
  CollectionFieldInitializers: typeof CollectionFieldInitializers;
@@ -4,53 +4,47 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _client() {
9
8
  const data = require("@nocobase/client");
10
-
11
9
  _client = function _client() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  var _collection = require("../schemas/collection");
19
-
20
15
  var _locale = require("../locale");
21
-
22
16
  var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
23
-
24
17
  var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
25
-
26
18
  var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
27
-
28
19
  var _variable = require("../variable");
29
-
20
+ var _FieldsSelect = require("../components/FieldsSelect");
30
21
  var _default = {
31
22
  title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
32
23
  type: 'query',
33
24
  group: 'collection',
34
25
  fieldset: {
35
- 'config.collection': _collection.collection,
36
- // 'config.multiple': {
26
+ collection: _collection.collection,
27
+ // multiple: {
37
28
  // type: 'boolean',
38
29
  // title: `{{t("Multiple records", { ns: "${NAMESPACE}" })}}`,
39
- // name: 'config.multiple',
40
30
  // 'x-decorator': 'FormItem',
41
31
  // 'x-component': 'Checkbox',
42
32
  // 'x-component-props': {
43
33
  // disabled: true
44
34
  // }
45
35
  // },
46
- 'config.params': {
36
+ params: {
47
37
  type: 'object',
48
- name: 'config.params',
49
- title: '',
50
- 'x-decorator': 'FormItem',
51
38
  properties: {
52
- filter: _collection.filter
39
+ filter: _collection.filter,
40
+ appends: _collection.appends
53
41
  }
42
+ },
43
+ failOnEmpty: {
44
+ type: 'boolean',
45
+ title: `{{t("Fail on no data", { ns: "${_locale.NAMESPACE}" })}}`,
46
+ 'x-decorator': 'FormItem',
47
+ 'x-component': 'Checkbox'
54
48
  }
55
49
  },
56
50
  view: {},
@@ -58,23 +52,22 @@ var _default = {
58
52
  useCollectionDataSource: _client().useCollectionDataSource
59
53
  },
60
54
  components: {
61
- FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
55
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
56
+ FieldsSelect: _FieldsSelect.FieldsSelect
62
57
  },
63
-
64
58
  getOptions(config, types) {
59
+ var _config$params, _config$params$append;
65
60
  return (0, _variable.useCollectionFieldOptions)({
66
61
  collection: config.collection,
67
- types
62
+ types,
63
+ depth: ((_config$params = config.params) === null || _config$params === void 0 ? void 0 : (_config$params$append = _config$params.appends) === null || _config$params$append === void 0 ? void 0 : _config$params$append.length) ? 1 : 0
68
64
  });
69
65
  },
70
-
71
66
  useInitializers(node) {
72
67
  var _node$title;
73
-
74
68
  if (!node.config.collection) {
75
69
  return null;
76
70
  }
77
-
78
71
  return {
79
72
  type: 'item',
80
73
  title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
@@ -83,7 +76,6 @@ var _default = {
83
76
  dataSource: `{{$jobsMapByNodeId.${node.id}}}`
84
77
  };
85
78
  },
86
-
87
79
  initializers: {
88
80
  CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
89
81
  }
@@ -4,9 +4,8 @@ declare const _default: {
4
4
  type: string;
5
5
  group: string;
6
6
  fieldset: {
7
- 'config.method': {
7
+ method: {
8
8
  type: string;
9
- name: string;
10
9
  required: boolean;
11
10
  title: string;
12
11
  'x-decorator': string;
@@ -21,23 +20,20 @@ declare const _default: {
21
20
  }[];
22
21
  default: string;
23
22
  };
24
- 'config.url': {
23
+ url: {
25
24
  type: string;
26
- name: string;
27
25
  required: boolean;
28
26
  title: string;
29
27
  'x-decorator': string;
30
- 'x-decorator-props': {
31
- className: string;
32
- };
28
+ 'x-decorator-props': {};
33
29
  'x-component': string;
34
30
  'x-component-props': {
35
31
  placeholder: string;
32
+ className: string;
36
33
  };
37
34
  };
38
- 'config.headers': {
35
+ headers: {
39
36
  type: string;
40
- name: string;
41
37
  'x-component': string;
42
38
  'x-decorator': string;
43
39
  title: string;
@@ -82,9 +78,8 @@ declare const _default: {
82
78
  };
83
79
  };
84
80
  };
85
- 'config.params': {
81
+ params: {
86
82
  type: string;
87
- name: string;
88
83
  'x-component': string;
89
84
  'x-decorator': string;
90
85
  title: string;
@@ -128,9 +123,8 @@ declare const _default: {
128
123
  };
129
124
  };
130
125
  };
131
- 'config.data': {
126
+ data: {
132
127
  type: string;
133
- name: string;
134
128
  title: string;
135
129
  'x-decorator': string;
136
130
  'x-decorator-props': {};
@@ -145,9 +139,8 @@ declare const _default: {
145
139
  };
146
140
  description: string;
147
141
  };
148
- 'config.timeout': {
142
+ timeout: {
149
143
  type: string;
150
- name: string;
151
144
  title: string;
152
145
  'x-decorator': string;
153
146
  'x-decorator-props': {};
@@ -159,9 +152,8 @@ declare const _default: {
159
152
  defaultValue: number;
160
153
  };
161
154
  };
162
- 'config.ignoreFail': {
155
+ ignoreFail: {
163
156
  type: string;
164
- name: string;
165
157
  title: string;
166
158
  'x-decorator': string;
167
159
  'x-component': string;
@@ -4,39 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _antd() {
9
8
  const data = require("@formily/antd");
10
-
11
9
  _antd = function _antd() {
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 _locale = require("../locale");
29
-
30
22
  var _variable = require("../variable");
31
-
32
23
  var _default = {
33
24
  title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
34
25
  type: 'request',
35
26
  group: 'extended',
36
27
  fieldset: {
37
- 'config.method': {
28
+ method: {
38
29
  type: 'string',
39
- name: 'config.method',
40
30
  required: true,
41
31
  title: `{{t("HTTP method", { ns: "${_locale.NAMESPACE}" })}}`,
42
32
  'x-decorator': 'FormItem',
@@ -63,30 +53,20 @@ var _default = {
63
53
  }],
64
54
  default: 'POST'
65
55
  },
66
- 'config.url': {
56
+ url: {
67
57
  type: 'string',
68
- name: 'config.url',
69
58
  required: true,
70
59
  title: `{{t("URL", { ns: "${_locale.NAMESPACE}" })}}`,
71
60
  'x-decorator': 'FormItem',
72
- 'x-decorator-props': {
73
- className: (0, _css().css)`
74
- .ant-formily-item-control-content-component{
75
- .ant-input-affix-wrapper,
76
- .ant-input{
77
- width: 100%;
78
- }
79
- }
80
- `
81
- },
61
+ 'x-decorator-props': {},
82
62
  'x-component': 'Input',
83
63
  'x-component-props': {
84
- placeholder: 'https://www.nocobase.com'
64
+ placeholder: 'https://www.nocobase.com',
65
+ className: 'full-width'
85
66
  }
86
67
  },
87
- 'config.headers': {
68
+ headers: {
88
69
  type: 'array',
89
- name: 'config.headers',
90
70
  'x-component': 'ArrayItems',
91
71
  'x-decorator': 'FormItem',
92
72
  title: `{{t("Headers", { ns: "${_locale.NAMESPACE}" })}}`,
@@ -131,9 +111,8 @@ var _default = {
131
111
  }
132
112
  }
133
113
  },
134
- 'config.params': {
114
+ params: {
135
115
  type: 'array',
136
- name: 'config.params',
137
116
  'x-component': 'ArrayItems',
138
117
  'x-decorator': 'FormItem',
139
118
  title: `{{t("Parameters", { ns: "${_locale.NAMESPACE}" })}}`,
@@ -177,9 +156,8 @@ var _default = {
177
156
  }
178
157
  }
179
158
  },
180
- 'config.data': {
159
+ data: {
181
160
  type: 'string',
182
- name: 'config.data',
183
161
  title: `{{t("Body", { ns: "${_locale.NAMESPACE}" })}}`,
184
162
  'x-decorator': 'FormItem',
185
163
  'x-decorator-props': {},
@@ -190,16 +168,15 @@ var _default = {
190
168
  minRows: 10
191
169
  },
192
170
  placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
193
- className: (0, _css().css)`
194
- font-size: 85%;
171
+ className: (0, _css().cx)('full-width', (0, _css().css)`
172
+ font-size: 90%;
195
173
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
196
- `
174
+ `)
197
175
  },
198
176
  description: `{{t("Only support standard JSON data", { ns: "${_locale.NAMESPACE}" })}}`
199
177
  },
200
- 'config.timeout': {
178
+ timeout: {
201
179
  type: 'number',
202
- name: 'config.timeout',
203
180
  title: `{{t("Timeout config", { ns: "${_locale.NAMESPACE}" })}}`,
204
181
  'x-decorator': 'FormItem',
205
182
  'x-decorator-props': {},
@@ -211,9 +188,8 @@ var _default = {
211
188
  defaultValue: 5000
212
189
  }
213
190
  },
214
- 'config.ignoreFail': {
191
+ ignoreFail: {
215
192
  type: 'boolean',
216
- name: 'config.ignoreFail',
217
193
  title: `{{t("Ignore fail request and continue workflow", { ns: "${_locale.NAMESPACE}" })}}`,
218
194
  'x-decorator': 'FormItem',
219
195
  'x-component': 'Checkbox'
@@ -5,10 +5,9 @@ declare const _default: {
5
5
  type: string;
6
6
  group: string;
7
7
  fieldset: {
8
- 'config.collection': {
8
+ collection: {
9
9
  type: string;
10
10
  title: string;
11
- name: string;
12
11
  required: boolean;
13
12
  'x-reactions': string[];
14
13
  'x-decorator': string;
@@ -17,35 +16,35 @@ declare const _default: {
17
16
  placeholder: string;
18
17
  };
19
18
  };
20
- 'config.params.filter': {
21
- title: string;
19
+ params: {
22
20
  type: string;
23
- name: string;
24
- 'x-decorator': string;
25
- 'x-decorator-props': {
26
- labelAlign: string;
27
- className: string;
28
- };
29
- 'x-component': string;
30
- 'x-component-props': {
31
- useProps(): {
32
- options: any[];
33
- className: string;
21
+ properties: {
22
+ filter: {
23
+ title: string;
24
+ "x-validator"(value: any): string;
25
+ type: string;
26
+ 'x-decorator': string;
27
+ 'x-component': string;
28
+ 'x-component-props': {
29
+ useProps(): {
30
+ options: any[];
31
+ className: string;
32
+ };
33
+ dynamicComponent: string;
34
+ };
35
+ };
36
+ values: {
37
+ type: string;
38
+ title: string;
39
+ 'x-decorator': string;
40
+ 'x-decorator-props': {
41
+ labelAlign: string;
42
+ className: string;
43
+ };
44
+ 'x-component': string;
45
+ description: string;
34
46
  };
35
- dynamicComponent: string;
36
- };
37
- };
38
- 'config.params.values': {
39
- type: string;
40
- title: string;
41
- name: string;
42
- 'x-decorator': string;
43
- 'x-decorator-props': {
44
- labelAlign: string;
45
- className: string;
46
47
  };
47
- 'x-component': string;
48
- description: string;
49
48
  };
50
49
  };
51
50
  view: {};
@@ -4,43 +4,42 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _client() {
9
8
  const data = require("@nocobase/client");
10
-
11
9
  _client = function _client() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
19
-
20
15
  var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
21
-
16
+ var _utils = require("../utils");
22
17
  var _locale = require("../locale");
23
-
24
18
  var _collection = require("../schemas/collection");
25
-
26
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
20
  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; }
29
-
30
21
  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; }
31
-
32
- 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; }
33
-
22
+ 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; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24
+ 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); }
34
25
  var _default = {
35
26
  title: `{{t("Update record", { ns: "${_locale.NAMESPACE}" })}}`,
36
27
  type: 'update',
37
28
  group: 'collection',
38
29
  fieldset: {
39
- 'config.collection': _collection.collection,
40
- 'config.params.filter': _objectSpread(_objectSpread({}, _collection.filter), {}, {
41
- title: `{{t("Only update records matching conditions", { ns: "${_locale.NAMESPACE}" })}}`
42
- }),
43
- 'config.params.values': _collection.values
30
+ collection: _collection.collection,
31
+ params: {
32
+ type: 'object',
33
+ properties: {
34
+ filter: _objectSpread(_objectSpread({}, _collection.filter), {}, {
35
+ title: `{{t("Only update records matching conditions", { ns: "${_locale.NAMESPACE}" })}}`,
36
+ ['x-validator'](value) {
37
+ return (0, _utils.isValidFilter)(value) ? '' : `{{t("Please add at least one condition", { ns: "${_locale.NAMESPACE}" })}}`;
38
+ }
39
+ }),
40
+ values: _collection.values
41
+ }
42
+ }
44
43
  },
45
44
  view: {},
46
45
  scope: {