@nocobase/plugin-workflow 0.7.1-alpha.7 → 0.7.2-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 (129) hide show
  1. package/client.d.ts +4 -0
  2. package/client.js +30 -0
  3. package/lib/client/ExecutionResourceProvider.d.ts +4 -0
  4. package/lib/client/ExecutionResourceProvider.js +64 -0
  5. package/lib/client/WorkflowCanvas.d.ts +15 -0
  6. package/lib/client/WorkflowCanvas.js +393 -0
  7. package/lib/client/WorkflowLink.d.ts +1 -0
  8. package/lib/client/WorkflowLink.js +66 -0
  9. package/lib/client/WorkflowPage.d.ts +1 -0
  10. package/lib/client/WorkflowPage.js +92 -0
  11. package/lib/client/WorkflowProvider.d.ts +1 -0
  12. package/lib/client/WorkflowProvider.js +78 -0
  13. package/lib/client/WorkflowShortcut.d.ts +1 -0
  14. package/lib/client/WorkflowShortcut.js +123 -0
  15. package/lib/client/calculators.d.ts +101 -0
  16. package/lib/client/calculators.js +739 -0
  17. package/lib/client/components/CollectionFieldSelect.d.ts +2 -0
  18. package/lib/client/components/CollectionFieldSelect.js +106 -0
  19. package/lib/client/components/Duration.d.ts +5 -0
  20. package/lib/client/components/Duration.js +96 -0
  21. package/lib/client/index.d.ts +3 -0
  22. package/lib/client/index.js +38 -0
  23. package/lib/client/nodes/calculation.d.ts +25 -0
  24. package/lib/client/nodes/calculation.js +85 -0
  25. package/lib/client/nodes/condition.d.ts +46 -0
  26. package/lib/client/nodes/condition.js +346 -0
  27. package/lib/client/nodes/create.d.ts +42 -0
  28. package/lib/client/nodes/create.js +99 -0
  29. package/lib/client/nodes/delay.d.ts +36 -0
  30. package/lib/client/nodes/delay.js +49 -0
  31. package/lib/client/nodes/destroy.d.ts +55 -0
  32. package/lib/client/nodes/destroy.js +46 -0
  33. package/lib/client/nodes/index.d.ts +33 -0
  34. package/lib/client/nodes/index.js +390 -0
  35. package/lib/client/nodes/parallel.d.ts +24 -0
  36. package/lib/client/nodes/parallel.js +216 -0
  37. package/lib/client/nodes/query.d.ts +66 -0
  38. package/lib/client/nodes/query.js +105 -0
  39. package/lib/client/nodes/update.d.ts +60 -0
  40. package/lib/client/nodes/update.js +48 -0
  41. package/lib/client/schemas/collection.d.ts +42 -0
  42. package/lib/client/schemas/collection.js +98 -0
  43. package/lib/client/schemas/executions.d.ts +209 -0
  44. package/lib/client/schemas/executions.js +164 -0
  45. package/lib/client/schemas/workflows.d.ts +2 -0
  46. package/lib/client/schemas/workflows.js +328 -0
  47. package/lib/client/style.d.ts +12 -0
  48. package/lib/client/style.js +216 -0
  49. package/lib/client/triggers/collection.d.ts +88 -0
  50. package/lib/client/triggers/collection.js +225 -0
  51. package/lib/client/triggers/index.d.ts +26 -0
  52. package/lib/client/triggers/index.js +238 -0
  53. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
  54. package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
  55. package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
  56. package/lib/client/triggers/schedule/EndsByField.js +102 -0
  57. package/lib/client/triggers/schedule/OnField.d.ts +5 -0
  58. package/lib/client/triggers/schedule/OnField.js +128 -0
  59. package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
  60. package/lib/client/triggers/schedule/RepeatField.js +191 -0
  61. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
  62. package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
  63. package/lib/client/triggers/schedule/index.d.ts +25 -0
  64. package/lib/client/triggers/schedule/index.js +124 -0
  65. package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
  66. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
  67. package/lib/index.d.ts +1 -6
  68. package/lib/index.js +2 -73
  69. package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
  70. package/lib/{Plugin.js → server/Plugin.js} +0 -0
  71. package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
  72. package/lib/{Processor.js → server/Processor.js} +40 -24
  73. package/lib/{actions → server/actions}/index.d.ts +0 -0
  74. package/lib/{actions → server/actions}/index.js +0 -0
  75. package/lib/{actions → server/actions}/nodes.d.ts +0 -0
  76. package/lib/{actions → server/actions}/nodes.js +1 -0
  77. package/lib/{actions → server/actions}/workflows.d.ts +0 -0
  78. package/lib/{actions → server/actions}/workflows.js +10 -0
  79. package/lib/{calculators → server/calculators}/index.d.ts +0 -0
  80. package/lib/{calculators → server/calculators}/index.js +0 -0
  81. package/lib/{collections → server/collections}/executions.d.ts +0 -0
  82. package/lib/{collections → server/collections}/executions.js +0 -0
  83. package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
  84. package/lib/{collections → server/collections}/flow_nodes.js +0 -0
  85. package/lib/{collections → server/collections}/jobs.d.ts +0 -0
  86. package/lib/{collections → server/collections}/jobs.js +0 -0
  87. package/lib/{collections → server/collections}/workflows.d.ts +0 -0
  88. package/lib/{collections → server/collections}/workflows.js +0 -0
  89. package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
  90. package/lib/{constants.js → server/constants.js} +0 -0
  91. package/lib/server/index.d.ts +6 -0
  92. package/lib/server/index.js +86 -0
  93. package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
  94. package/lib/{instructions → server/instructions}/calculation.js +0 -0
  95. package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
  96. package/lib/{instructions → server/instructions}/condition.js +0 -0
  97. package/lib/{instructions → server/instructions}/create.d.ts +0 -0
  98. package/lib/{instructions → server/instructions}/create.js +0 -0
  99. package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
  100. package/lib/{instructions → server/instructions}/delay.js +12 -5
  101. package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
  102. package/lib/{instructions → server/instructions}/destroy.js +0 -0
  103. package/lib/{instructions → server/instructions}/index.d.ts +0 -0
  104. package/lib/{instructions → server/instructions}/index.js +0 -0
  105. package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
  106. package/lib/{instructions → server/instructions}/parallel.js +62 -20
  107. package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
  108. package/lib/{instructions → server/instructions}/prompt.js +0 -0
  109. package/lib/{instructions → server/instructions}/query.d.ts +0 -0
  110. package/lib/{instructions → server/instructions}/query.js +0 -0
  111. package/lib/{instructions → server/instructions}/update.d.ts +0 -0
  112. package/lib/{instructions → server/instructions}/update.js +0 -0
  113. package/lib/{models → server/models}/Execution.d.ts +0 -0
  114. package/lib/{models → server/models}/Execution.js +0 -0
  115. package/lib/{models → server/models}/FlowNode.d.ts +0 -0
  116. package/lib/{models → server/models}/FlowNode.js +0 -0
  117. package/lib/{models → server/models}/Job.d.ts +0 -0
  118. package/lib/{models → server/models}/Job.js +0 -0
  119. package/lib/{models → server/models}/Workflow.d.ts +0 -0
  120. package/lib/{models → server/models}/Workflow.js +0 -0
  121. package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
  122. package/lib/{triggers → server/triggers}/collection.js +0 -0
  123. package/lib/{triggers → server/triggers}/index.d.ts +0 -0
  124. package/lib/{triggers → server/triggers}/index.js +0 -0
  125. package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
  126. package/lib/{triggers → server/triggers}/schedule.js +2 -2
  127. package/package.json +10 -8
  128. package/server.d.ts +4 -0
  129. package/server.js +30 -0
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.executionSchema = void 0;
7
+ const collection = {
8
+ name: 'executions',
9
+ fields: [{
10
+ interface: 'createdAt',
11
+ type: 'datetime',
12
+ // field: 'createdAt',
13
+ name: 'createdAt',
14
+ uiSchema: {
15
+ type: 'datetime',
16
+ title: '{{t("Created at")}}',
17
+ 'x-component': 'DatePicker',
18
+ 'x-component-props': {},
19
+ 'x-read-pretty': true
20
+ }
21
+ }, {
22
+ interface: 'number',
23
+ type: 'number',
24
+ name: 'workflowId',
25
+ uiSchema: {
26
+ type: 'number',
27
+ title: '{{t("Version")}}',
28
+ 'x-component': 'InputNumber',
29
+ 'x-read-pretty': true
30
+ }
31
+ }, {
32
+ type: 'number',
33
+ name: 'status',
34
+ interface: 'select',
35
+ uiSchema: {
36
+ title: '{{t("Status")}}',
37
+ type: 'string',
38
+ 'x-component': 'Select',
39
+ 'x-decorator': 'FormItem',
40
+ enum: [{
41
+ value: 0,
42
+ label: '{{t("On going")}}'
43
+ }, {
44
+ value: 1,
45
+ label: '{{t("Succeeded")}}'
46
+ }, {
47
+ value: -1,
48
+ label: '{{t("Failed")}}'
49
+ }, {
50
+ value: -2,
51
+ label: '{{t("Canceled")}}'
52
+ }]
53
+ }
54
+ }]
55
+ };
56
+ const executionSchema = {
57
+ provider: {
58
+ type: 'void',
59
+ 'x-decorator': 'ExecutionResourceProvider',
60
+ 'x-decorator-props': {
61
+ collection,
62
+ resourceName: 'executions',
63
+ request: {
64
+ resource: 'executions',
65
+ action: 'list',
66
+ params: {
67
+ pageSize: 50,
68
+ sort: ['-createdAt']
69
+ }
70
+ }
71
+ },
72
+ 'x-component': 'CollectionProvider',
73
+ 'x-component-props': {
74
+ collection
75
+ },
76
+ properties: {
77
+ actions: {
78
+ type: 'void',
79
+ 'x-component': 'ActionBar',
80
+ 'x-component-props': {
81
+ style: {
82
+ marginBottom: 16
83
+ }
84
+ },
85
+ properties: {// filter: {
86
+ // type: 'object',
87
+ // 'x-component': 'Filter',
88
+ // }
89
+ }
90
+ },
91
+ table: {
92
+ type: 'void',
93
+ 'x-component': 'Table.Void',
94
+ 'x-component-props': {
95
+ rowKey: 'id',
96
+ useDataSource: '{{ cm.useDataSourceFromRAC }}'
97
+ },
98
+ properties: {
99
+ createdAt: {
100
+ type: 'void',
101
+ 'x-decorator': 'Table.Column.Decorator',
102
+ 'x-component': 'Table.Column',
103
+ properties: {
104
+ createdAt: {
105
+ type: 'datetime',
106
+ 'x-component': 'CollectionField',
107
+ 'x-component-props': {
108
+ showTime: true
109
+ },
110
+ 'x-read-pretty': true
111
+ }
112
+ }
113
+ },
114
+ workflowId: {
115
+ type: 'void',
116
+ 'x-decorator': 'Table.Column.Decorator',
117
+ 'x-component': 'Table.Column',
118
+ properties: {
119
+ workflowId: {
120
+ type: 'number',
121
+ 'x-component': 'CollectionField',
122
+ 'x-read-pretty': true
123
+ }
124
+ }
125
+ },
126
+ status: {
127
+ type: 'void',
128
+ 'x-decorator': 'Table.Column.Decorator',
129
+ 'x-component': 'Table.Column',
130
+ properties: {
131
+ status: {
132
+ type: 'number',
133
+ 'x-component': 'CollectionField',
134
+ 'x-read-pretty': true
135
+ }
136
+ }
137
+ } // actions: {
138
+ // type: 'void',
139
+ // title: '{{ t("Actions") }}',
140
+ // 'x-component': 'Table.Column',
141
+ // properties: {
142
+ // actions: {
143
+ // type: 'void',
144
+ // 'x-component': 'Space',
145
+ // 'x-component-props': {
146
+ // split: '|',
147
+ // },
148
+ // properties: {
149
+ // config: {
150
+ // type: 'void',
151
+ // title: '查看',
152
+ // 'x-component': 'ExecutionLink'
153
+ // },
154
+ // }
155
+ // }
156
+ // }
157
+ // }
158
+
159
+ }
160
+ }
161
+ }
162
+ }
163
+ };
164
+ exports.executionSchema = executionSchema;
@@ -0,0 +1,2 @@
1
+ import { ISchema } from '@formily/react';
2
+ export declare const workflowSchema: ISchema;
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.workflowSchema = void 0;
7
+
8
+ var _triggers = require("../triggers");
9
+
10
+ var _executions = require("./executions");
11
+
12
+ const collection = {
13
+ name: 'workflows',
14
+ fields: [{
15
+ type: 'string',
16
+ name: 'title',
17
+ interface: 'input',
18
+ uiSchema: {
19
+ title: '{{t("Name")}}',
20
+ type: 'string',
21
+ 'x-component': 'Input',
22
+ required: true
23
+ }
24
+ }, {
25
+ type: 'string',
26
+ name: 'type',
27
+ interface: 'select',
28
+ uiSchema: {
29
+ title: '{{t("Trigger type")}}',
30
+ type: 'string',
31
+ 'x-component': 'Select',
32
+ 'x-decorator': 'FormItem',
33
+ enum: Array.from(_triggers.triggers.getEntities()).map(([value, {
34
+ title
35
+ }]) => ({
36
+ value,
37
+ label: title
38
+ })),
39
+ required: true
40
+ }
41
+ }, {
42
+ type: 'string',
43
+ name: 'description',
44
+ interface: 'textarea',
45
+ uiSchema: {
46
+ title: '{{t("Description")}}',
47
+ type: 'string',
48
+ 'x-component': 'Input.TextArea'
49
+ }
50
+ }, {
51
+ type: 'boolean',
52
+ name: 'enabled',
53
+ interface: 'radio',
54
+ uiSchema: {
55
+ title: '{{t("Status")}}',
56
+ type: 'string',
57
+ enum: [{
58
+ label: '{{t("On")}}',
59
+ value: true
60
+ }, {
61
+ label: '{{t("Off")}}',
62
+ value: false
63
+ }],
64
+ 'x-component': 'Radio.Group',
65
+ 'x-decorator': 'FormItem',
66
+ default: false
67
+ }
68
+ }]
69
+ };
70
+ const workflowSchema = {
71
+ type: 'object',
72
+ properties: {
73
+ provider: {
74
+ type: 'void',
75
+ 'x-decorator': 'ResourceActionProvider',
76
+ 'x-decorator-props': {
77
+ collection,
78
+ resourceName: 'workflows',
79
+ request: {
80
+ resource: 'workflows',
81
+ action: 'list',
82
+ params: {
83
+ pageSize: 50,
84
+ filter: {
85
+ current: true
86
+ },
87
+ sort: ['createdAt'],
88
+ except: ['config']
89
+ }
90
+ }
91
+ },
92
+ 'x-component': 'CollectionProvider',
93
+ 'x-component-props': {
94
+ collection
95
+ },
96
+ properties: {
97
+ actions: {
98
+ type: 'void',
99
+ 'x-component': 'ActionBar',
100
+ 'x-component-props': {
101
+ style: {
102
+ marginBottom: 16
103
+ }
104
+ },
105
+ properties: {
106
+ delete: {
107
+ type: 'void',
108
+ title: '{{t("Delete")}}',
109
+ 'x-component': 'Action',
110
+ 'x-component-props': {
111
+ useAction: '{{ cm.useBulkDestroyAction }}',
112
+ confirm: {
113
+ title: "{{t('Delete record')}}",
114
+ content: "{{t('Are you sure you want to delete it?')}}"
115
+ }
116
+ }
117
+ },
118
+ create: {
119
+ type: 'void',
120
+ title: '{{t("Add new")}}',
121
+ 'x-component': 'Action',
122
+ 'x-component-props': {
123
+ type: 'primary'
124
+ },
125
+ properties: {
126
+ drawer: {
127
+ type: 'void',
128
+ 'x-component': 'Action.Drawer',
129
+ 'x-decorator': 'Form',
130
+ 'x-decorator-props': {
131
+ initialValue: {
132
+ current: true
133
+ }
134
+ },
135
+ title: '{{t("Add new")}}',
136
+ properties: {
137
+ title: {
138
+ 'x-component': 'CollectionField',
139
+ 'x-decorator': 'FormItem'
140
+ },
141
+ type: {
142
+ 'x-component': 'CollectionField',
143
+ 'x-decorator': 'FormItem'
144
+ },
145
+ description: {
146
+ 'x-component': 'CollectionField',
147
+ 'x-decorator': 'FormItem'
148
+ },
149
+ footer: {
150
+ type: 'void',
151
+ 'x-component': 'Action.Drawer.Footer',
152
+ properties: {
153
+ cancel: {
154
+ title: '{{ t("Cancel") }}',
155
+ 'x-component': 'Action',
156
+ 'x-component-props': {
157
+ useAction: '{{ cm.useCancelAction }}'
158
+ }
159
+ },
160
+ submit: {
161
+ title: '{{ t("Submit") }}',
162
+ 'x-component': 'Action',
163
+ 'x-component-props': {
164
+ type: 'primary',
165
+ useAction: '{{ cm.useCreateAction }}'
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
175
+ },
176
+ table: {
177
+ type: 'void',
178
+ 'x-component': 'Table.Void',
179
+ 'x-component-props': {
180
+ rowKey: 'id',
181
+ rowSelection: {
182
+ type: 'checkbox'
183
+ },
184
+ useDataSource: '{{ cm.useDataSourceFromRAC }}'
185
+ },
186
+ properties: {
187
+ title: {
188
+ type: 'void',
189
+ 'x-decorator': 'Table.Column.Decorator',
190
+ 'x-component': 'Table.Column',
191
+ properties: {
192
+ title: {
193
+ type: 'string',
194
+ 'x-component': 'CollectionField',
195
+ 'x-read-pretty': true
196
+ }
197
+ }
198
+ },
199
+ type: {
200
+ type: 'void',
201
+ 'x-decorator': 'Table.Column.Decorator',
202
+ 'x-component': 'Table.Column',
203
+ properties: {
204
+ type: {
205
+ type: 'string',
206
+ 'x-component': 'CollectionField',
207
+ 'x-read-pretty': true
208
+ }
209
+ }
210
+ },
211
+ enabled: {
212
+ type: 'void',
213
+ 'x-decorator': 'Table.Column.Decorator',
214
+ 'x-component': 'Table.Column',
215
+ properties: {
216
+ enabled: {
217
+ type: 'boolean',
218
+ 'x-component': 'CollectionField',
219
+ 'x-read-pretty': true,
220
+ default: false
221
+ }
222
+ }
223
+ },
224
+ actions: {
225
+ type: 'void',
226
+ title: '{{ t("Actions") }}',
227
+ 'x-component': 'Table.Column',
228
+ properties: {
229
+ actions: {
230
+ type: 'void',
231
+ 'x-component': 'Space',
232
+ 'x-component-props': {
233
+ split: '|'
234
+ },
235
+ properties: {
236
+ config: {
237
+ type: 'void',
238
+ 'x-component': 'WorkflowLink'
239
+ },
240
+ executions: {
241
+ type: 'void',
242
+ title: '{{t("Execution History")}}',
243
+ 'x-component': 'Action.Link',
244
+ 'x-component-props': {
245
+ type: 'primary'
246
+ },
247
+ properties: {
248
+ drawer: {
249
+ type: 'void',
250
+ title: '{{t("Execution History")}}',
251
+ 'x-component': 'Action.Drawer',
252
+ properties: _executions.executionSchema
253
+ }
254
+ }
255
+ },
256
+ update: {
257
+ type: 'void',
258
+ title: '{{ t("Edit") }}',
259
+ 'x-component': 'Action.Link',
260
+ 'x-component-props': {
261
+ type: 'primary'
262
+ },
263
+ properties: {
264
+ modal: {
265
+ type: 'void',
266
+ 'x-component': 'Action.Modal',
267
+ 'x-decorator': 'Form',
268
+ 'x-decorator-props': {
269
+ useValues: '{{ cm.useValuesFromRecord }}'
270
+ },
271
+ title: '{{ t("Edit") }}',
272
+ properties: {
273
+ title: {
274
+ 'x-component': 'CollectionField',
275
+ 'x-decorator': 'FormItem'
276
+ },
277
+ enabled: {
278
+ 'x-component': 'CollectionField',
279
+ 'x-decorator': 'FormItem'
280
+ },
281
+ footer: {
282
+ type: 'void',
283
+ 'x-component': 'Action.Modal.Footer',
284
+ properties: {
285
+ cancel: {
286
+ title: '{{ t("Cancel") }}',
287
+ 'x-component': 'Action',
288
+ 'x-component-props': {
289
+ useAction: '{{ cm.useCancelAction }}'
290
+ }
291
+ },
292
+ submit: {
293
+ title: '{{ t("Submit") }}',
294
+ 'x-component': 'Action',
295
+ 'x-component-props': {
296
+ type: 'primary',
297
+ useAction: '{{ cm.useUpdateAction }}'
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ } // delete: {
306
+ // type: 'void',
307
+ // title: '{{ t("Delete") }}',
308
+ // 'x-component': 'Action.Link',
309
+ // 'x-component-props': {
310
+ // confirm: {
311
+ // title: "{{t('Delete record')}}",
312
+ // content: "{{t('Are you sure you want to delete it?')}}",
313
+ // },
314
+ // useAction: '{{ cm.useDestroyActionAndRefreshCM }}',
315
+ // },
316
+ // },
317
+
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ };
328
+ exports.workflowSchema = workflowSchema;
@@ -0,0 +1,12 @@
1
+ export declare const workflowPageClass: string;
2
+ export declare const workflowVersionDropdownClass: string;
3
+ export declare const branchBlockClass: string;
4
+ export declare const branchClass: string;
5
+ export declare const nodeBlockClass: string;
6
+ export declare const nodeClass: string;
7
+ export declare const nodeCardClass: string;
8
+ export declare const nodeHeaderClass: string;
9
+ export declare const nodeMetaClass: string;
10
+ export declare const nodeTitleClass: string;
11
+ export declare const nodeSubtreeClass: string;
12
+ export declare const addButtonClass: string;