@nocobase/plugin-workflow 0.8.0-alpha.8 → 0.8.1-alpha.3

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 (95) hide show
  1. package/lib/client/AddButton.js +21 -13
  2. package/lib/client/ExecutionCanvas.js +10 -24
  3. package/lib/client/ExecutionResourceProvider.d.ts +2 -1
  4. package/lib/client/ExecutionResourceProvider.js +4 -3
  5. package/lib/client/FlowContext.js +1 -1
  6. package/lib/client/WorkflowCanvas.js +136 -39
  7. package/lib/client/WorkflowProvider.d.ts +3 -0
  8. package/lib/client/WorkflowProvider.js +71 -16
  9. package/lib/client/WorkflowShortcut.d.ts +0 -1
  10. package/lib/client/WorkflowShortcut.js +4 -47
  11. package/lib/client/calculators.d.ts +27 -37
  12. package/lib/client/calculators.js +168 -150
  13. package/lib/client/components/CollectionFieldset.js +10 -20
  14. package/lib/client/components/Duration.js +3 -14
  15. package/lib/client/components/EjsTextArea.d.ts +2 -0
  16. package/lib/client/components/EjsTextArea.js +232 -0
  17. package/lib/client/components/OpenDrawer.d.ts +6 -0
  18. package/lib/client/components/OpenDrawer.js +93 -0
  19. package/lib/client/constants.js +11 -9
  20. package/lib/client/index.d.ts +1 -0
  21. package/lib/client/index.js +14 -0
  22. package/lib/client/locale/en-US.d.ts +105 -0
  23. package/lib/client/locale/en-US.js +111 -0
  24. package/lib/client/locale/index.d.ts +3 -0
  25. package/lib/client/locale/index.js +69 -0
  26. package/lib/client/locale/ja-JP.d.ts +88 -0
  27. package/lib/client/locale/ja-JP.js +94 -0
  28. package/lib/client/locale/ru-RU.d.ts +88 -0
  29. package/lib/client/locale/ru-RU.js +94 -0
  30. package/lib/client/locale/tr-TR.d.ts +88 -0
  31. package/lib/client/locale/tr-TR.js +94 -0
  32. package/lib/client/locale/zh-CN.d.ts +130 -0
  33. package/lib/client/locale/zh-CN.js +136 -0
  34. package/lib/client/nodes/calculation.d.ts +0 -1
  35. package/lib/client/nodes/calculation.js +9 -17
  36. package/lib/client/nodes/condition.js +16 -22
  37. package/lib/client/nodes/create.d.ts +3 -1
  38. package/lib/client/nodes/create.js +11 -11
  39. package/lib/client/nodes/delay.js +8 -6
  40. package/lib/client/nodes/index.js +46 -14
  41. package/lib/client/nodes/parallel.d.ts +0 -1
  42. package/lib/client/nodes/parallel.js +11 -32
  43. package/lib/client/nodes/query.js +9 -17
  44. package/lib/client/nodes/request.d.ts +138 -0
  45. package/lib/client/nodes/request.js +167 -0
  46. package/lib/client/nodes/update.js +4 -2
  47. package/lib/client/schemas/collection.js +3 -1
  48. package/lib/client/schemas/executions.d.ts +211 -207
  49. package/lib/client/schemas/executions.js +102 -96
  50. package/lib/client/schemas/workflows.js +112 -22
  51. package/lib/client/style.js +7 -7
  52. package/lib/client/triggers/collection.d.ts +2 -1
  53. package/lib/client/triggers/collection.js +49 -34
  54. package/lib/client/triggers/index.d.ts +4 -6
  55. package/lib/client/triggers/index.js +57 -51
  56. package/lib/client/triggers/schedule/EndsByField.js +13 -39
  57. package/lib/client/triggers/schedule/OnField.js +10 -5
  58. package/lib/client/triggers/schedule/RepeatField.js +6 -14
  59. package/lib/client/triggers/schedule/ScheduleConfig.js +25 -20
  60. package/lib/client/triggers/schedule/constants.d.ts +4 -0
  61. package/lib/client/triggers/schedule/constants.js +11 -0
  62. package/lib/client/triggers/schedule/index.d.ts +2 -3
  63. package/lib/client/triggers/schedule/index.js +55 -40
  64. package/lib/server/Plugin.d.ts +15 -5
  65. package/lib/server/Plugin.js +176 -61
  66. package/lib/server/Processor.d.ts +1 -2
  67. package/lib/server/Processor.js +3 -19
  68. package/lib/server/actions/jobs.js +2 -3
  69. package/lib/server/actions/workflows.js +13 -5
  70. package/lib/server/calculators/index.d.ts +4 -2
  71. package/lib/server/calculators/index.js +6 -4
  72. package/lib/server/collections/executions.js +2 -1
  73. package/lib/server/constants.d.ts +1 -0
  74. package/lib/server/constants.js +1 -0
  75. package/lib/server/extensions/assignees/actions.js +2 -3
  76. package/lib/server/extensions/assignees/collections/users_jobs.js +9 -1
  77. package/lib/server/index.d.ts +3 -4
  78. package/lib/server/index.js +21 -44
  79. package/lib/server/instructions/condition.js +1 -1
  80. package/lib/server/instructions/create.js +3 -1
  81. package/lib/server/instructions/delay.js +2 -3
  82. package/lib/server/instructions/destroy.js +3 -1
  83. package/lib/server/instructions/index.d.ts +3 -2
  84. package/lib/server/instructions/index.js +1 -1
  85. package/lib/server/instructions/prompt.js +2 -1
  86. package/lib/server/instructions/query.js +3 -1
  87. package/lib/server/instructions/request.d.ts +14 -0
  88. package/lib/server/instructions/request.js +154 -0
  89. package/lib/server/instructions/update.d.ts +1 -1
  90. package/lib/server/instructions/update.js +3 -1
  91. package/lib/server/migrations/20221129153547-calculation-variables.d.ts +5 -0
  92. package/lib/server/migrations/20221129153547-calculation-variables.js +116 -0
  93. package/lib/server/triggers/collection.js +5 -7
  94. package/lib/server/triggers/schedule.js +17 -6
  95. package/package.json +13 -8
@@ -70,6 +70,16 @@ function _reactI18next() {
70
70
  return data;
71
71
  }
72
72
 
73
+ function _jsonTemplates() {
74
+ const data = _interopRequireDefault(require("json-templates"));
75
+
76
+ _jsonTemplates = function _jsonTemplates() {
77
+ return data;
78
+ };
79
+
80
+ return data;
81
+ }
82
+
73
83
  function _client() {
74
84
  const data = require("@nocobase/utils/client");
75
85
 
@@ -114,6 +124,10 @@ var _destroy = _interopRequireDefault(require("./destroy"));
114
124
 
115
125
  var _constants = require("../constants");
116
126
 
127
+ var _locale = require("../locale");
128
+
129
+ var _request = _interopRequireDefault(require("./request"));
130
+
117
131
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
118
132
 
119
133
  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); }
@@ -135,11 +149,9 @@ instructions.register('query', _query.default);
135
149
  instructions.register('create', _create.default);
136
150
  instructions.register('update', _update.default);
137
151
  instructions.register('destroy', _destroy.default);
152
+ instructions.register('request', _request.default);
138
153
 
139
154
  function useUpdateAction() {
140
- const _useTranslation = (0, _reactI18next().useTranslation)(),
141
- t = _useTranslation.t;
142
-
143
155
  const form = (0, _react2().useForm)();
144
156
  const api = (0, _client2().useAPIClient)();
145
157
  const ctx = (0, _client2().useActionContext)();
@@ -156,7 +168,7 @@ function useUpdateAction() {
156
168
  run() {
157
169
  return _asyncToGenerator(function* () {
158
170
  if (workflow.executed) {
159
- _antd().message.error(t('Node in executed workflow cannot be modified'));
171
+ _antd().message.error((0, _locale.lang)('Node in executed workflow cannot be modified'));
160
172
 
161
173
  return;
162
174
  } // TODO: how to do validation separately for each field? especially disabled for dynamic fields?
@@ -221,8 +233,8 @@ function Node({
221
233
  function RemoveButton() {
222
234
  var _useFlowContext2;
223
235
 
224
- const _useTranslation2 = (0, _reactI18next().useTranslation)(),
225
- t = _useTranslation2.t;
236
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
237
+ t = _useTranslation.t;
226
238
 
227
239
  const api = (0, _client2().useAPIClient)();
228
240
 
@@ -261,8 +273,31 @@ function RemoveButton() {
261
273
  return _onOk.apply(this, arguments);
262
274
  }
263
275
 
276
+ const usingNodes = nodes.filter(node => {
277
+ if (node === current) {
278
+ return false;
279
+ }
280
+
281
+ const template = (0, _jsonTemplates().default)(node.config);
282
+ const refs = template.parameters.filter(({
283
+ key
284
+ }) => key.startsWith(`$jobsMapByNodeId.${current.id}.`) || key === `$jobsMapByNodeId.${current.id}`);
285
+ return refs.length;
286
+ });
287
+
288
+ if (usingNodes.length) {
289
+ _antd().Modal.error({
290
+ title: (0, _locale.lang)('Can not delete'),
291
+ content: (0, _locale.lang)('The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.', {
292
+ nodes: usingNodes.map(item => `#${item.id}`).join(', ')
293
+ })
294
+ });
295
+
296
+ return;
297
+ }
298
+
264
299
  const hasBranches = !nodes.find(item => item.upstream === current && item.branchIndex != null);
265
- const message = hasBranches ? t('Are you sure you want to delete it?') : t('This node contains branches, deleting will also be preformed to them, are you sure?');
300
+ const message = hasBranches ? t('Are you sure you want to delete it?') : (0, _locale.lang)('This node contains branches, deleting will also be preformed to them, are you sure?');
266
301
 
267
302
  _antd().Modal.confirm({
268
303
  title: t('Delete'),
@@ -285,9 +320,6 @@ function RemoveButton() {
285
320
  function JobButton() {
286
321
  var _useNodeContext;
287
322
 
288
- const _useTranslation3 = (0, _reactI18next().useTranslation)(),
289
- t = _useTranslation3.t;
290
-
291
323
  const compile = (0, _client2().useCompile)();
292
324
 
293
325
  const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
@@ -321,7 +353,7 @@ function JobButton() {
321
353
  schema: {
322
354
  type: 'void',
323
355
  properties: {
324
- [job.id]: {
356
+ job: {
325
357
  type: 'void',
326
358
  'x-component': 'Action',
327
359
  'x-component-props': {
@@ -350,7 +382,7 @@ function JobButton() {
350
382
  properties: {
351
383
  status: {
352
384
  type: 'number',
353
- title: '{{t("Status")}}',
385
+ title: `{{t("Status", { ns: "${_locale.NAMESPACE}" })}}`,
354
386
  'x-decorator': 'FormItem',
355
387
  'x-component': 'Select',
356
388
  enum: _constants.JobStatusOptions,
@@ -358,7 +390,7 @@ function JobButton() {
358
390
  },
359
391
  updatedAt: {
360
392
  type: 'string',
361
- title: '{{t("Executed at")}}',
393
+ title: `{{t("Executed at", { ns: "${_locale.NAMESPACE}" })}}`,
362
394
  'x-decorator': 'FormItem',
363
395
  'x-component': 'DatePicker',
364
396
  'x-component-props': {
@@ -368,7 +400,7 @@ function JobButton() {
368
400
  },
369
401
  result: {
370
402
  type: 'object',
371
- title: '{{t("Node result")}}',
403
+ title: `{{t("Node result", { ns: "${_locale.NAMESPACE}" })}}`,
372
404
  'x-decorator': 'FormItem',
373
405
  'x-component': 'Input.JSON',
374
406
  'x-component-props': {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: {
3
2
  title: string;
4
3
  type: string;
@@ -45,26 +45,6 @@ function _antd() {
45
45
  return data;
46
46
  }
47
47
 
48
- function _reactI18next() {
49
- const data = require("react-i18next");
50
-
51
- _reactI18next = function _reactI18next() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- function _client() {
59
- const data = require("@nocobase/client");
60
-
61
- _client = function _client() {
62
- return data;
63
- };
64
-
65
- return data;
66
- }
67
-
68
48
  var _2 = require(".");
69
49
 
70
50
  var _Branch = require("../Branch");
@@ -73,6 +53,8 @@ var _FlowContext = require("../FlowContext");
73
53
 
74
54
  var _style = require("../style");
75
55
 
56
+ var _locale = require("../locale");
57
+
76
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); }
77
59
 
78
60
  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; }
@@ -90,23 +72,23 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
90
72
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
91
73
 
92
74
  var _default = {
93
- title: '{{t("Parallel branch")}}',
75
+ title: `{{t("Parallel branch", { ns: "${_locale.NAMESPACE}" })}}`,
94
76
  type: 'parallel',
95
77
  group: 'control',
96
78
  fieldset: {
97
79
  'config.mode': {
98
80
  type: 'string',
99
81
  name: 'config.mode',
100
- title: '{{t("Mode")}}',
82
+ title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
101
83
  'x-decorator': 'FormItem',
102
84
  'x-component': 'Radio.Group',
103
85
  'x-component-props': {},
104
86
  enum: [{
105
87
  value: 'all',
106
88
  label: _react().default.createElement(_antd().Tooltip, {
107
- title: _client().i18n.t('Continue after all branches succeeded'),
89
+ title: (0, _locale.lang)('Continue after all branches succeeded'),
108
90
  placement: "bottom"
109
- }, _client().i18n.t('All succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
91
+ }, (0, _locale.lang)('All succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
110
92
  style: {
111
93
  color: '#999'
112
94
  }
@@ -114,9 +96,9 @@ var _default = {
114
96
  }, {
115
97
  value: 'any',
116
98
  label: _react().default.createElement(_antd().Tooltip, {
117
- title: _client().i18n.t('Continue after any branch succeeded'),
99
+ title: (0, _locale.lang)('Continue after any branch succeeded'),
118
100
  placement: "bottom"
119
- }, _client().i18n.t('Any succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
101
+ }, (0, _locale.lang)('Any succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
120
102
  style: {
121
103
  color: '#999'
122
104
  }
@@ -124,9 +106,9 @@ var _default = {
124
106
  }, {
125
107
  value: 'race',
126
108
  label: _react().default.createElement(_antd().Tooltip, {
127
- title: _client().i18n.t('Continue after any branch succeeded, or exit after any branch failed'),
109
+ title: (0, _locale.lang)('Continue after any branch succeeded, or exit after any branch failed'),
128
110
  placement: "bottom"
129
- }, _client().i18n.t('Any succeeded or failed'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
111
+ }, (0, _locale.lang)('Any succeeded or failed'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
130
112
  style: {
131
113
  color: '#999'
132
114
  }
@@ -141,9 +123,6 @@ var _default = {
141
123
  const id = data.id,
142
124
  mode = data.config.mode;
143
125
 
144
- const _useTranslation = (0, _reactI18next().useTranslation)(),
145
- t = _useTranslation.t;
146
-
147
126
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
148
127
  nodes = _useFlowContext.nodes;
149
128
 
@@ -198,7 +177,7 @@ var _default = {
198
177
  height: 2em;
199
178
  `
200
179
  }, _react().default.createElement(_antd().Tooltip, {
201
- title: t('Add branch')
180
+ title: (0, _locale.lang)('Add branch')
202
181
  }, _react().default.createElement(_antd().Button, {
203
182
  icon: _react().default.createElement(_icons().PlusOutlined, null),
204
183
  className: (0, _css().css)`
@@ -33,23 +33,19 @@ var _collection = require("../schemas/collection");
33
33
 
34
34
  var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
35
35
 
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- 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; }
39
-
40
- 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; }
36
+ var _locale = require("../locale");
41
37
 
42
- 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; }
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
39
 
44
40
  var _default = {
45
- title: '{{t("Query record")}}',
41
+ title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
46
42
  type: 'query',
47
43
  group: 'collection',
48
44
  fieldset: {
49
45
  'config.collection': _collection.collection,
50
46
  'config.multiple': {
51
47
  type: 'boolean',
52
- title: '{{t("Multiple records")}}',
48
+ title: `{{t("Multiple records", { ns: "${_locale.NAMESPACE}" })}}`,
53
49
  name: 'config.multiple',
54
50
  'x-decorator': 'FormItem',
55
51
  'x-component': 'Checkbox',
@@ -76,13 +72,14 @@ var _default = {
76
72
  },
77
73
 
78
74
  getter(props) {
79
- const type = props.type,
80
- options = props.options,
81
- _onChange = props.onChange;
75
+ const _onChange = props.onChange;
82
76
 
83
77
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
84
78
  nodes = _useFlowContext.nodes;
85
79
 
80
+ const _useOperandContext = (0, _calculators.useOperandContext)(),
81
+ options = _useOperandContext.options;
82
+
86
83
  const _nodes$find = nodes.find(n => n.id == options.nodeId),
87
84
  config = _nodes$find.config;
88
85
 
@@ -91,12 +88,7 @@ var _default = {
91
88
  collection: config.collection,
92
89
  value: value,
93
90
  onChange: path => {
94
- _onChange({
95
- type,
96
- options: _objectSpread(_objectSpread({}, options), {}, {
97
- path
98
- })
99
- });
91
+ _onChange(`{{$jobsMapByNodeId.${options.nodeId}.${path}}}`);
100
92
  }
101
93
  });
102
94
  }
@@ -0,0 +1,138 @@
1
+ import React from 'react';
2
+ import EjsTextArea from '../components/EjsTextArea';
3
+ declare const _default: {
4
+ title: string;
5
+ type: string;
6
+ group: string;
7
+ fieldset: {
8
+ 'config.url': {
9
+ type: string;
10
+ name: string;
11
+ required: boolean;
12
+ title: string;
13
+ 'x-decorator': string;
14
+ 'x-decorator-props': {};
15
+ 'x-component': string;
16
+ 'x-component-props': {
17
+ autoSize: {
18
+ minRows: number;
19
+ };
20
+ placeholder: string;
21
+ description: string;
22
+ };
23
+ };
24
+ 'config.timeout': {
25
+ type: string;
26
+ name: string;
27
+ required: boolean;
28
+ title: string;
29
+ 'x-decorator': string;
30
+ 'x-decorator-props': {};
31
+ 'x-component': string;
32
+ 'x-component-props': {
33
+ addonAfter: string;
34
+ min: number;
35
+ step: number;
36
+ defaultValue: number;
37
+ };
38
+ };
39
+ 'config.headers': {
40
+ type: string;
41
+ name: string;
42
+ 'x-component': string;
43
+ 'x-decorator': string;
44
+ title: string;
45
+ description: string;
46
+ items: {
47
+ type: string;
48
+ properties: {
49
+ space: {
50
+ type: string;
51
+ 'x-component': string;
52
+ properties: {
53
+ name: {
54
+ type: string;
55
+ 'x-decorator': string;
56
+ 'x-component': string;
57
+ 'x-component-props': {
58
+ placeholder: string;
59
+ };
60
+ };
61
+ value: {
62
+ type: string;
63
+ 'x-decorator': string;
64
+ 'x-component': string;
65
+ 'x-component-props': {
66
+ placeholder: string;
67
+ };
68
+ };
69
+ remove: {
70
+ type: string;
71
+ 'x-decorator': string;
72
+ 'x-component': string;
73
+ };
74
+ };
75
+ };
76
+ };
77
+ };
78
+ properties: {
79
+ add: {
80
+ type: string;
81
+ title: string;
82
+ 'x-component': string;
83
+ };
84
+ };
85
+ };
86
+ 'config.method': {
87
+ type: string;
88
+ name: string;
89
+ required: boolean;
90
+ title: string;
91
+ 'x-decorator': string;
92
+ 'x-component': string;
93
+ 'x-component-props': {
94
+ defaultValue: string;
95
+ showSearch: boolean;
96
+ allowClear: boolean;
97
+ };
98
+ enum: {
99
+ label: string;
100
+ value: string;
101
+ }[];
102
+ };
103
+ 'config.data': {
104
+ type: string;
105
+ name: string;
106
+ 'x-hidden': boolean;
107
+ title: string;
108
+ 'x-decorator': string;
109
+ 'x-decorator-props': {};
110
+ 'x-component': string;
111
+ 'x-component-props': {
112
+ autoSize: {
113
+ minRows: number;
114
+ };
115
+ placeholder: string;
116
+ description: string;
117
+ };
118
+ };
119
+ 'config.ignoreFail': {
120
+ type: string;
121
+ name: string;
122
+ title: string;
123
+ 'x-decorator': string;
124
+ 'x-component': string;
125
+ };
126
+ };
127
+ view: {};
128
+ scope: {};
129
+ components: {
130
+ ArrayItems: React.FC<React.HTMLAttributes<HTMLDivElement>> & import("@formily/antd").ArrayBaseMixins & {
131
+ Item?: React.FC<React.HTMLAttributes<HTMLDivElement> & {
132
+ type?: "divide" | "card";
133
+ }>;
134
+ };
135
+ EjsTextArea: typeof EjsTextArea;
136
+ };
137
+ };
138
+ export default _default;
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _locale = require("../locale");
9
+
10
+ function _antd() {
11
+ const data = require("@formily/antd");
12
+
13
+ _antd = function _antd() {
14
+ return data;
15
+ };
16
+
17
+ return data;
18
+ }
19
+
20
+ var _EjsTextArea = _interopRequireDefault(require("../components/EjsTextArea"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ var _default = {
25
+ title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
26
+ type: 'request',
27
+ group: 'extended',
28
+ fieldset: {
29
+ 'config.url': {
30
+ type: 'string',
31
+ name: 'config.url',
32
+ required: true,
33
+ title: `{{t("URL", { ns: "${_locale.NAMESPACE}" })}}`,
34
+ 'x-decorator': 'FormItem',
35
+ 'x-decorator-props': {},
36
+ 'x-component': 'EjsTextArea',
37
+ 'x-component-props': {
38
+ autoSize: {
39
+ minRows: 1
40
+ },
41
+ placeholder: 'https://xxxxxx',
42
+ description: `{{t("You can use the above available variables in URL.", { ns: "${_locale.NAMESPACE}" })}}`
43
+ }
44
+ },
45
+ 'config.timeout': {
46
+ type: 'number',
47
+ name: 'config.timeout',
48
+ required: true,
49
+ title: `{{t("Timeout config", { ns: "${_locale.NAMESPACE}" })}}`,
50
+ 'x-decorator': 'FormItem',
51
+ 'x-decorator-props': {},
52
+ 'x-component': 'InputNumber',
53
+ 'x-component-props': {
54
+ addonAfter: `{{t("ms", { ns: "${_locale.NAMESPACE}" })}}`,
55
+ min: 1,
56
+ step: 1000,
57
+ defaultValue: 5000
58
+ }
59
+ },
60
+ 'config.headers': {
61
+ type: 'array',
62
+ name: 'config.headers',
63
+ 'x-component': 'ArrayItems',
64
+ 'x-decorator': 'FormItem',
65
+ title: `{{t("Request headers", { ns: "${_locale.NAMESPACE}" })}}`,
66
+ description: `{{t("Default headers is Content-Type: application/json", { ns: "${_locale.NAMESPACE}" })}}`,
67
+ items: {
68
+ type: 'object',
69
+ properties: {
70
+ space: {
71
+ type: 'void',
72
+ 'x-component': 'Space',
73
+ properties: {
74
+ name: {
75
+ type: 'string',
76
+ 'x-decorator': 'FormItem',
77
+ 'x-component': 'Input',
78
+ 'x-component-props': {
79
+ placeholder: `{{t("Name(e.g. Content-Type)", { ns: "${_locale.NAMESPACE}" })}}`
80
+ }
81
+ },
82
+ value: {
83
+ type: 'string',
84
+ 'x-decorator': 'FormItem',
85
+ 'x-component': 'Input',
86
+ 'x-component-props': {
87
+ placeholder: `{{t("Value(e.g. Application/json)", { ns: "${_locale.NAMESPACE}" })}}`
88
+ }
89
+ },
90
+ remove: {
91
+ type: 'void',
92
+ 'x-decorator': 'FormItem',
93
+ 'x-component': 'ArrayItems.Remove'
94
+ }
95
+ }
96
+ }
97
+ }
98
+ },
99
+ properties: {
100
+ add: {
101
+ type: 'void',
102
+ title: `{{t("Add request header", { ns: "${_locale.NAMESPACE}" })}}`,
103
+ 'x-component': 'ArrayItems.Addition'
104
+ }
105
+ }
106
+ },
107
+ 'config.method': {
108
+ type: 'string',
109
+ name: 'config.method',
110
+ required: true,
111
+ title: `{{t("HTTP method", { ns: "${_locale.NAMESPACE}" })}}`,
112
+ 'x-decorator': 'FormItem',
113
+ 'x-component': 'Select',
114
+ 'x-component-props': {
115
+ defaultValue: 'POST',
116
+ showSearch: false,
117
+ allowClear: false
118
+ },
119
+ enum: [{
120
+ label: 'GET',
121
+ value: 'GET'
122
+ }, {
123
+ label: 'POST',
124
+ value: 'POST'
125
+ }, {
126
+ label: 'PUT',
127
+ value: 'PUT'
128
+ }, {
129
+ label: 'PATCH',
130
+ value: 'PATCH'
131
+ }, {
132
+ label: 'DELETE',
133
+ value: 'DELETE'
134
+ }]
135
+ },
136
+ 'config.data': {
137
+ type: 'string',
138
+ name: 'config.data',
139
+ 'x-hidden': false,
140
+ title: `{{t("Request data", { ns: "${_locale.NAMESPACE}" })}}`,
141
+ 'x-decorator': 'FormItem',
142
+ 'x-decorator-props': {},
143
+ 'x-component': 'EjsTextArea',
144
+ 'x-component-props': {
145
+ autoSize: {
146
+ minRows: 5
147
+ },
148
+ placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
149
+ description: `{{t("You can use the above available variables in request data.", { ns: "${_locale.NAMESPACE}" })}}`
150
+ }
151
+ },
152
+ 'config.ignoreFail': {
153
+ type: 'boolean',
154
+ name: 'config.ignoreFail',
155
+ title: `{{t("Ignore fail request and continue workflow", { ns: "${_locale.NAMESPACE}" })}}`,
156
+ 'x-decorator': 'FormItem',
157
+ 'x-component': 'Checkbox'
158
+ }
159
+ },
160
+ view: {},
161
+ scope: {},
162
+ components: {
163
+ ArrayItems: _antd().ArrayItems,
164
+ EjsTextArea: _EjsTextArea.default
165
+ }
166
+ };
167
+ exports.default = _default;
@@ -19,6 +19,8 @@ var _calculators = require("../calculators");
19
19
 
20
20
  var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
21
21
 
22
+ var _locale = require("../locale");
23
+
22
24
  var _collection = require("../schemas/collection");
23
25
 
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -30,13 +32,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
30
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; }
31
33
 
32
34
  var _default = {
33
- title: '{{t("Update record")}}',
35
+ title: `{{t("Update record", { ns: "${_locale.NAMESPACE}" })}}`,
34
36
  type: 'update',
35
37
  group: 'collection',
36
38
  fieldset: {
37
39
  'config.collection': _collection.collection,
38
40
  'config.params.filter': _objectSpread(_objectSpread({}, _collection.filter), {}, {
39
- title: '{{t("Only update records matching conditions")}}'
41
+ title: `{{t("Only update records matching conditions", { ns: "${_locale.NAMESPACE}" })}}`
40
42
  }),
41
43
  'config.params.values': _collection.values
42
44
  },
@@ -35,6 +35,8 @@ function _client() {
35
35
  return data;
36
36
  }
37
37
 
38
+ var _locale = require("../locale");
39
+
38
40
  const collection = {
39
41
  type: 'string',
40
42
  title: '{{t("Collection")}}',
@@ -60,7 +62,7 @@ const values = {
60
62
  `
61
63
  },
62
64
  'x-component': 'CollectionFieldset',
63
- description: '{{t("Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.")}}'
65
+ description: `{{t("Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.", { ns: "${_locale.NAMESPACE}" })}}`
64
66
  };
65
67
  exports.values = values;
66
68
  const filter = {