@nocobase/plugin-workflow 0.12.0-alpha.4 → 0.13.0-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.
@@ -0,0 +1,725 @@
1
+ 'use strict';
2
+
3
+ var swagger_default = {
4
+ openapi: "3.0.2",
5
+ info: {
6
+ title: "NocoBase API - Workflow plugin"
7
+ },
8
+ tags: [],
9
+ paths: {
10
+ "/workflows:list": {
11
+ get: {
12
+ tags: ["workflows"],
13
+ description: "",
14
+ parameters: [],
15
+ responses: {
16
+ 200: {
17
+ description: "OK",
18
+ content: {
19
+ "application/json": {
20
+ schema: {
21
+ allOf: [
22
+ {
23
+ $ref: "#/components/schemas/workflow"
24
+ }
25
+ ]
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ },
33
+ "/workflows:get": {
34
+ get: {
35
+ tags: ["workflows"],
36
+ description: "Get single workflow",
37
+ parameters: [],
38
+ responses: {
39
+ 200: {
40
+ description: "OK",
41
+ content: {
42
+ "application/json": {
43
+ schema: {
44
+ allOf: [
45
+ {
46
+ $ref: "#/components/schemas/workflow"
47
+ },
48
+ {
49
+ type: "object",
50
+ properties: {
51
+ nodes: {
52
+ type: "array",
53
+ items: {
54
+ $ref: "#/components/schemas/node"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "/workflows:create": {
68
+ post: {
69
+ tags: ["workflows"],
70
+ description: "Create new workflow",
71
+ parameters: [],
72
+ requestBody: {
73
+ content: {
74
+ "application/json": {
75
+ schema: {
76
+ type: "object",
77
+ properties: {
78
+ title: {
79
+ $ref: "#/components/schemas/workflow/properties/title"
80
+ },
81
+ type: {
82
+ $ref: "#/components/schemas/workflow/properties/type"
83
+ },
84
+ description: {
85
+ $ref: "#/components/schemas/workflow/properties/description"
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ },
92
+ responses: {
93
+ 200: {
94
+ description: "OK",
95
+ content: {
96
+ "application/json": {
97
+ schema: {
98
+ allOf: [
99
+ {
100
+ $ref: "#/components/schemas/workflow"
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "/workflows:update": {
111
+ post: {
112
+ tags: ["workflows"],
113
+ description: "Update a workflow",
114
+ parameters: [],
115
+ requestBody: {
116
+ content: {
117
+ "application/json": {
118
+ schema: {
119
+ type: "object",
120
+ properties: {
121
+ title: {
122
+ $ref: "#/components/schemas/workflow/properties/title"
123
+ },
124
+ enabled: {
125
+ $ref: "#/components/schemas/workflow/properties/enabled"
126
+ },
127
+ description: {
128
+ $ref: "#/components/schemas/workflow/properties/description"
129
+ },
130
+ config: {
131
+ $ref: "#/components/schemas/workflow/properties/config"
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ },
138
+ responses: {
139
+ 200: {
140
+ description: "OK"
141
+ }
142
+ }
143
+ }
144
+ },
145
+ "/workflows:destroy": {
146
+ post: {
147
+ tags: ["workflows"],
148
+ description: "Delete workflows. Also will delete all nodes and executions of the workflow.",
149
+ parameters: [
150
+ {
151
+ name: "filterByTk",
152
+ in: "query",
153
+ description: "Primary key of a record",
154
+ schema: {
155
+ type: "integer",
156
+ description: "ID. The only workflow with ID will be deleted."
157
+ }
158
+ },
159
+ {
160
+ name: "filter",
161
+ in: "query",
162
+ description: "Filter",
163
+ schema: {
164
+ type: "object",
165
+ properties: {
166
+ key: {
167
+ type: "string",
168
+ description: "Key. If provided, all workflow with same key will be deleted."
169
+ }
170
+ }
171
+ }
172
+ }
173
+ ],
174
+ responses: {
175
+ 200: {
176
+ description: "OK"
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "/workflows:revision": {
182
+ post: {
183
+ tags: ["workflows"],
184
+ description: "Duplicate a workflow to a new version or a new workflow. All nodes will be duplicated too.",
185
+ parameters: [
186
+ {
187
+ name: "filterByTk",
188
+ in: "query",
189
+ description: "Primary key of a record",
190
+ schema: {
191
+ type: "integer",
192
+ description: "ID. The workflow to duplicate."
193
+ }
194
+ },
195
+ {
196
+ name: "filter",
197
+ in: "query",
198
+ description: "Filter",
199
+ schema: {
200
+ type: "object",
201
+ properties: {
202
+ key: {
203
+ type: "string",
204
+ description: "Key. If provided, only duplicate to a new version. Or will be duplicated to a new workflow."
205
+ }
206
+ }
207
+ }
208
+ }
209
+ ],
210
+ responses: {
211
+ 200: {
212
+ description: "OK"
213
+ }
214
+ }
215
+ }
216
+ },
217
+ "/workflows:trigger": {
218
+ post: {
219
+ tags: ["workflows"],
220
+ description: "",
221
+ parameters: [
222
+ {
223
+ name: "triggerWorkflows",
224
+ in: "query",
225
+ description: "A combined string to describe workflows to trigger and context data to use. e.g. `?triggerWorkflows=1,2!category`",
226
+ schema: {
227
+ type: "string"
228
+ }
229
+ }
230
+ ],
231
+ responses: {
232
+ 202: {
233
+ description: "Accepted"
234
+ },
235
+ 400: {
236
+ description: "Bad Request"
237
+ }
238
+ }
239
+ }
240
+ },
241
+ "/workflows/{workflowId}/nodes:create": {
242
+ post: {
243
+ tags: ["workflows.nodes"],
244
+ description: "Create a new node in workflow",
245
+ parameters: [],
246
+ requestBody: {
247
+ content: {
248
+ "application/json": {
249
+ schema: {
250
+ type: "object",
251
+ properties: {
252
+ title: {
253
+ $ref: "#/components/schemas/node/properties/title"
254
+ },
255
+ type: {
256
+ $ref: "#/components/schemas/node/properties/type"
257
+ },
258
+ upstreamId: {
259
+ $ref: "#/components/schemas/node/properties/upstreamId"
260
+ },
261
+ branchIndex: {
262
+ $ref: "#/components/schemas/node/properties/branchIndex"
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ },
269
+ responses: {
270
+ 200: {
271
+ description: "OK",
272
+ content: {
273
+ "application/json": {
274
+ schema: {
275
+ allOf: [
276
+ {
277
+ $ref: "#/components/schemas/node"
278
+ }
279
+ ]
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ },
287
+ "/flow_nodes:update": {
288
+ post: {
289
+ tags: ["flow_nodes"],
290
+ description: "Update node properties.",
291
+ parameters: [
292
+ {
293
+ name: "filterByTk",
294
+ in: "query",
295
+ description: "Primary key of a record",
296
+ schema: {
297
+ type: "integer",
298
+ description: "ID"
299
+ }
300
+ }
301
+ ],
302
+ requestBody: {
303
+ content: {
304
+ "application/json": {
305
+ schema: {
306
+ type: "object",
307
+ properties: {
308
+ title: {
309
+ $ref: "#/components/schemas/node/properties/title"
310
+ },
311
+ config: {
312
+ $ref: "#/components/schemas/node/properties/config"
313
+ }
314
+ }
315
+ }
316
+ }
317
+ }
318
+ },
319
+ responses: {
320
+ 200: {
321
+ description: "OK"
322
+ },
323
+ 400: {
324
+ description: "Bad Request. Node in exected workflow cannot be updated."
325
+ }
326
+ }
327
+ }
328
+ },
329
+ "/flow_nodes:destroy": {
330
+ post: {
331
+ tags: ["flow_nodes"],
332
+ description: "Delete a node. All nodes in sub-branches will also be deleted.",
333
+ parameters: [
334
+ {
335
+ name: "filterByTk",
336
+ in: "query",
337
+ description: "Primary key of a record",
338
+ schema: {
339
+ type: "integer",
340
+ description: "ID"
341
+ }
342
+ }
343
+ ],
344
+ responses: {
345
+ 200: {
346
+ description: "OK"
347
+ },
348
+ 400: {
349
+ description: "Bad Request. Node in exected workflow cannot be deleted."
350
+ }
351
+ }
352
+ }
353
+ },
354
+ "/executions:list": {
355
+ get: {
356
+ tags: ["executions"],
357
+ description: "Get list of executions",
358
+ parameters: [],
359
+ responses: {
360
+ 200: {
361
+ description: "OK",
362
+ content: {
363
+ "application/json": {
364
+ schema: {
365
+ type: "array",
366
+ description: "List of executions",
367
+ items: {
368
+ $ref: "#/components/schemas/execution",
369
+ type: "object",
370
+ not: {
371
+ $ref: "#/components/schemas/execution/properties/jobs"
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }
379
+ }
380
+ },
381
+ "/executions:get": {
382
+ get: {
383
+ tags: ["executions"],
384
+ description: "Get single execution",
385
+ parameters: [
386
+ {
387
+ name: "filterByTk",
388
+ in: "query",
389
+ description: "Primary key of a record",
390
+ schema: {
391
+ type: "integer",
392
+ description: "ID"
393
+ }
394
+ }
395
+ ],
396
+ responses: {
397
+ 200: {
398
+ description: "OK",
399
+ content: {
400
+ "application/json": {
401
+ schema: {
402
+ $ref: "#/components/schemas/execution"
403
+ }
404
+ }
405
+ }
406
+ }
407
+ }
408
+ }
409
+ },
410
+ "/users_jobs:list": {
411
+ get: {
412
+ tags: ["users_jobs"],
413
+ description: "List manual jobs",
414
+ parameters: [],
415
+ responses: {
416
+ 200: {
417
+ description: "OK",
418
+ content: {
419
+ "application/json": {
420
+ schema: {
421
+ type: "array",
422
+ description: "List of manual jobs",
423
+ items: {
424
+ $ref: "#/components/schemas/user_job"
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ },
433
+ "/users_jobs:get": {
434
+ get: {
435
+ tags: ["users_jobs"],
436
+ description: "Single user job",
437
+ parameters: [],
438
+ responses: {
439
+ 200: {
440
+ description: "OK",
441
+ content: {
442
+ "application/json": {
443
+ schema: {
444
+ allOf: [
445
+ {
446
+ $ref: "#/components/schemas/user_job"
447
+ },
448
+ {
449
+ type: "object",
450
+ properties: {
451
+ execution: {
452
+ $ref: "#/components/schemas/execution"
453
+ }
454
+ }
455
+ }
456
+ ]
457
+ }
458
+ }
459
+ }
460
+ }
461
+ }
462
+ }
463
+ },
464
+ "/users_jobs:submit": {
465
+ post: {
466
+ tags: ["users_jobs"],
467
+ description: "",
468
+ parameters: [
469
+ {
470
+ name: "filterByTk",
471
+ in: "query",
472
+ description: "Primary key of a record",
473
+ schema: {
474
+ type: "integer",
475
+ description: "ID"
476
+ }
477
+ }
478
+ ],
479
+ requestBody: {
480
+ content: {
481
+ "application/json": {
482
+ schema: {
483
+ type: "object",
484
+ properties: {
485
+ result: {
486
+ type: "object",
487
+ properties: {
488
+ $formKey: {
489
+ type: "object"
490
+ },
491
+ _: {
492
+ type: "string"
493
+ }
494
+ }
495
+ }
496
+ }
497
+ }
498
+ }
499
+ }
500
+ },
501
+ responses: {
502
+ 202: {
503
+ description: "Accepted"
504
+ },
505
+ 400: {
506
+ description: "Bad Request. Status of the job is not 0."
507
+ }
508
+ }
509
+ }
510
+ }
511
+ },
512
+ components: {
513
+ schemas: {
514
+ workflow: {
515
+ type: "object",
516
+ description: "Workflow",
517
+ properties: {
518
+ id: {
519
+ type: "integer",
520
+ description: "ID"
521
+ },
522
+ key: {
523
+ type: "string",
524
+ description: "Key. Variant versions of the same workflow share the same key."
525
+ },
526
+ title: {
527
+ type: "string",
528
+ description: "Title"
529
+ },
530
+ description: {
531
+ type: "string",
532
+ description: "Description"
533
+ },
534
+ current: {
535
+ type: "boolean",
536
+ description: "Current version"
537
+ },
538
+ enabled: {
539
+ type: "boolean",
540
+ description: "Enabled"
541
+ },
542
+ type: {
543
+ type: "string",
544
+ description: "Event type"
545
+ },
546
+ config: {
547
+ type: "object",
548
+ description: "Configuration JSON object"
549
+ },
550
+ nodes: {
551
+ type: "array",
552
+ description: "Workflow nodes"
553
+ },
554
+ executions: {
555
+ type: "array",
556
+ description: "Executions"
557
+ },
558
+ revisions: {
559
+ type: "array",
560
+ description: "Revisions"
561
+ },
562
+ executed: {
563
+ type: "integer",
564
+ description: "Executed count for a single version"
565
+ },
566
+ allExecuted: {
567
+ type: "integer",
568
+ description: "Executed count for all versions of the same workflow"
569
+ }
570
+ }
571
+ },
572
+ node: {
573
+ type: "object",
574
+ description: "Workflow node",
575
+ properties: {
576
+ id: {
577
+ type: "integer",
578
+ description: "ID"
579
+ },
580
+ title: {
581
+ type: "string",
582
+ description: "Title"
583
+ },
584
+ workflowId: {
585
+ type: "integer",
586
+ description: "Workflow ID"
587
+ },
588
+ upstreamId: {
589
+ type: "integer",
590
+ description: "Upstream node ID"
591
+ },
592
+ upstream: {
593
+ type: "object",
594
+ description: "Upstream node",
595
+ $ref: "#/components/schemas/node"
596
+ },
597
+ downstreamId: {
598
+ type: "integer",
599
+ description: "Downstream node ID in flow, not in sub-branches",
600
+ $ref: "#/components/schemas/node"
601
+ },
602
+ downstream: {
603
+ type: "object",
604
+ description: "Downstream node",
605
+ $ref: "#/components/schemas/node"
606
+ },
607
+ type: {
608
+ type: "string",
609
+ description: "Node type"
610
+ },
611
+ config: {
612
+ type: "object",
613
+ description: "Configuration JSON object"
614
+ },
615
+ branchIndex: {
616
+ type: "integer",
617
+ description: "Non-null if the node is a branch node of upstream"
618
+ },
619
+ branches: {
620
+ type: "array",
621
+ description: "Branch nodes under the node",
622
+ items: {
623
+ $ref: "#/components/schemas/node"
624
+ }
625
+ }
626
+ }
627
+ },
628
+ execution: {
629
+ type: "object",
630
+ description: "Execution record of workflow",
631
+ properties: {
632
+ id: {
633
+ type: "integer",
634
+ description: "ID"
635
+ },
636
+ key: {
637
+ type: "string",
638
+ description: "Workflow key"
639
+ },
640
+ workflowId: {
641
+ type: "integer",
642
+ description: "Workflow ID"
643
+ },
644
+ context: {
645
+ type: "object",
646
+ description: "Context data"
647
+ },
648
+ status: {
649
+ type: "integer",
650
+ description: "Status of execution"
651
+ },
652
+ jobs: {
653
+ type: "array",
654
+ description: "Results of executed nodes",
655
+ items: {
656
+ $ref: "#/components/schemas/job"
657
+ }
658
+ }
659
+ }
660
+ },
661
+ job: {
662
+ type: "object",
663
+ description: "Job record of exected node",
664
+ properties: {
665
+ id: {
666
+ type: "integer",
667
+ description: "ID"
668
+ },
669
+ executionId: {
670
+ type: "integer",
671
+ description: "Execution ID"
672
+ },
673
+ nodeId: {
674
+ type: "integer",
675
+ description: "Node ID"
676
+ },
677
+ status: {
678
+ type: "integer",
679
+ description: "Status of job"
680
+ },
681
+ result: {
682
+ type: "object",
683
+ description: "Result data of job"
684
+ }
685
+ }
686
+ },
687
+ user_job: {
688
+ type: "object",
689
+ description: "User job",
690
+ properties: {
691
+ id: {
692
+ type: "integer",
693
+ description: "ID"
694
+ },
695
+ executionId: {
696
+ type: "integer",
697
+ description: "Execution ID"
698
+ },
699
+ nodeId: {
700
+ type: "integer",
701
+ description: "Node ID"
702
+ },
703
+ workflowId: {
704
+ type: "integer",
705
+ description: "Workflow ID"
706
+ },
707
+ userId: {
708
+ type: "integer",
709
+ description: "User ID"
710
+ },
711
+ status: {
712
+ type: "integer",
713
+ description: "Status of job"
714
+ },
715
+ result: {
716
+ type: "object",
717
+ description: "Result data of job"
718
+ }
719
+ }
720
+ }
721
+ }
722
+ }
723
+ };
724
+
725
+ module.exports = swagger_default;