@nocobase/plugin-workflow 1.2.12-alpha → 1.3.0-alpha.20240710084543

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 (247) hide show
  1. package/package.json +3 -3
  2. package/dist/client/AddButton.d.ts +0 -16
  3. package/dist/client/Branch.d.ts +0 -17
  4. package/dist/client/CanvasContent.d.ts +0 -12
  5. package/dist/client/ExecutionCanvas.d.ts +0 -10
  6. package/dist/client/ExecutionContextProvider.d.ts +0 -15
  7. package/dist/client/ExecutionLink.d.ts +0 -10
  8. package/dist/client/ExecutionPage.d.ts +0 -10
  9. package/dist/client/ExecutionResourceProvider.d.ts +0 -14
  10. package/dist/client/FlowContext.d.ts +0 -11
  11. package/dist/client/WorkflowCanvas.d.ts +0 -10
  12. package/dist/client/WorkflowLink.d.ts +0 -10
  13. package/dist/client/WorkflowPage.d.ts +0 -10
  14. package/dist/client/WorkflowPane.d.ts +0 -10
  15. package/dist/client/components/AssignedFieldsFormSchemaConfig.d.ts +0 -10
  16. package/dist/client/components/CheckboxGroupWithTooltip.d.ts +0 -15
  17. package/dist/client/components/CollectionBlockInitializer.d.ts +0 -10
  18. package/dist/client/components/CollectionFieldset.d.ts +0 -14
  19. package/dist/client/components/DetailsBlockProvider.d.ts +0 -14
  20. package/dist/client/components/DrawerDescription.d.ts +0 -10
  21. package/dist/client/components/DrawerForm.d.ts +0 -13
  22. package/dist/client/components/ExecutionStatus.d.ts +0 -13
  23. package/dist/client/components/FieldsSelect.d.ts +0 -10
  24. package/dist/client/components/FilterDynamicComponent.d.ts +0 -14
  25. package/dist/client/components/OpenDrawer.d.ts +0 -14
  26. package/dist/client/components/RadioWithTooltip.d.ts +0 -15
  27. package/dist/client/components/SimpleDesigner.d.ts +0 -10
  28. package/dist/client/components/StatusButton.d.ts +0 -10
  29. package/dist/client/components/TriggerOptionRender.d.ts +0 -12
  30. package/dist/client/components/ValueBlock.d.ts +0 -14
  31. package/dist/client/components/index.d.ts +0 -16
  32. package/dist/client/components/renderEngineReference.d.ts +0 -10
  33. package/dist/client/constants.d.ts +0 -45
  34. package/dist/client/hooks/index.d.ts +0 -11
  35. package/dist/client/hooks/useGetAriaLabelOfAddButton.d.ts +0 -14
  36. package/dist/client/hooks/useRefreshActionProps.d.ts +0 -11
  37. package/dist/client/hooks/useTriggerWorkflowActionProps.d.ts +0 -20
  38. package/dist/client/hooks/useWorkflowExecuted.d.ts +0 -10
  39. package/dist/client/index.d.ts +0 -43
  40. package/dist/client/index.js +0 -569
  41. package/dist/client/locale/index.d.ts +0 -11
  42. package/dist/client/nodes/calculation.d.ts +0 -80
  43. package/dist/client/nodes/condition.d.ts +0 -108
  44. package/dist/client/nodes/create.d.ts +0 -110
  45. package/dist/client/nodes/destroy.d.ts +0 -54
  46. package/dist/client/nodes/end.d.ts +0 -30
  47. package/dist/client/nodes/index.d.ts +0 -76
  48. package/dist/client/nodes/query.d.ts +0 -236
  49. package/dist/client/nodes/update.d.ts +0 -114
  50. package/dist/client/schemas/collection.d.ts +0 -170
  51. package/dist/client/schemas/executions.d.ts +0 -282
  52. package/dist/client/schemas/workflows.d.ts +0 -10
  53. package/dist/client/settings/customizeSubmitToWorkflowActionSettings.d.ts +0 -10
  54. package/dist/client/style.d.ts +0 -30
  55. package/dist/client/triggers/collection.d.ts +0 -124
  56. package/dist/client/triggers/index.d.ts +0 -36
  57. package/dist/client/triggers/schedule/EndsByField.d.ts +0 -13
  58. package/dist/client/triggers/schedule/OnField.d.ts +0 -13
  59. package/dist/client/triggers/schedule/RepeatField.d.ts +0 -13
  60. package/dist/client/triggers/schedule/ScheduleConfig.d.ts +0 -10
  61. package/dist/client/triggers/schedule/constants.d.ts +0 -12
  62. package/dist/client/triggers/schedule/index.d.ts +0 -33
  63. package/dist/client/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -42
  64. package/dist/client/utils.d.ts +0 -12
  65. package/dist/client/variable.d.ts +0 -93
  66. package/dist/externalVersion.js +0 -34
  67. package/dist/index.d.ts +0 -10
  68. package/dist/index.js +0 -48
  69. package/dist/locale/en-US.json +0 -98
  70. package/dist/locale/es-ES.json +0 -98
  71. package/dist/locale/fr-FR.json +0 -98
  72. package/dist/locale/ja-JP.json +0 -82
  73. package/dist/locale/ko_KR.json +0 -168
  74. package/dist/locale/pt-BR.json +0 -98
  75. package/dist/locale/ru-RU.json +0 -82
  76. package/dist/locale/tr-TR.json +0 -82
  77. package/dist/locale/zh-CN.json +0 -205
  78. package/dist/node_modules/cron-parser/.eslintrc.json +0 -15
  79. package/dist/node_modules/cron-parser/.travis.yml +0 -7
  80. package/dist/node_modules/cron-parser/LICENSE +0 -21
  81. package/dist/node_modules/cron-parser/component.json +0 -11
  82. package/dist/node_modules/cron-parser/index.d.ts +0 -1
  83. package/dist/node_modules/cron-parser/lib/date.js +0 -252
  84. package/dist/node_modules/cron-parser/lib/expression.js +0 -983
  85. package/dist/node_modules/cron-parser/lib/field_compactor.js +0 -70
  86. package/dist/node_modules/cron-parser/lib/field_stringify.js +0 -38
  87. package/dist/node_modules/cron-parser/lib/parser.js +0 -1
  88. package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +0 -8489
  89. package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +0 -8487
  90. package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +0 -8490
  91. package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +0 -1
  92. package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +0 -7522
  93. package/dist/node_modules/cron-parser/node_modules/luxon/package.json +0 -96
  94. package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +0 -2169
  95. package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +0 -880
  96. package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +0 -61
  97. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +0 -157
  98. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +0 -80
  99. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +0 -76
  100. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +0 -233
  101. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +0 -191
  102. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +0 -386
  103. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +0 -14
  104. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +0 -482
  105. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +0 -335
  106. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +0 -424
  107. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +0 -292
  108. package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +0 -36
  109. package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +0 -193
  110. package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +0 -602
  111. package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +0 -26
  112. package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +0 -13
  113. package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +0 -137
  114. package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +0 -88
  115. package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +0 -191
  116. package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +0 -94
  117. package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +0 -53
  118. package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +0 -63
  119. package/dist/node_modules/cron-parser/package.json +0 -1
  120. package/dist/node_modules/cron-parser/test/31_of_month.js +0 -17
  121. package/dist/node_modules/cron-parser/test/bug.js +0 -29
  122. package/dist/node_modules/cron-parser/test/crondate.js +0 -16
  123. package/dist/node_modules/cron-parser/test/crontab.example +0 -7
  124. package/dist/node_modules/cron-parser/test/empty_around_comma.js +0 -22
  125. package/dist/node_modules/cron-parser/test/expression.js +0 -1489
  126. package/dist/node_modules/cron-parser/test/field_compactor.js +0 -250
  127. package/dist/node_modules/cron-parser/test/field_stringify.js +0 -84
  128. package/dist/node_modules/cron-parser/test/fields.js +0 -32
  129. package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +0 -22
  130. package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +0 -133
  131. package/dist/node_modules/cron-parser/test/index.test-d.ts +0 -138
  132. package/dist/node_modules/cron-parser/test/leap_year.js +0 -17
  133. package/dist/node_modules/cron-parser/test/parser.js +0 -46
  134. package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +0 -145
  135. package/dist/node_modules/cron-parser/test/parser_day_of_month.js +0 -169
  136. package/dist/node_modules/cron-parser/test/prev_date.js +0 -32
  137. package/dist/node_modules/cron-parser/test/stringify.js +0 -402
  138. package/dist/node_modules/cron-parser/test/timezone.js +0 -422
  139. package/dist/node_modules/cron-parser/types/common.d.ts +0 -131
  140. package/dist/node_modules/cron-parser/types/index.d.ts +0 -45
  141. package/dist/node_modules/cron-parser/types/ts3/index.d.ts +0 -28
  142. package/dist/node_modules/lru-cache/LICENSE +0 -15
  143. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
  144. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
  145. package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
  146. package/dist/node_modules/lru-cache/dist/cjs/index.js +0 -1334
  147. package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
  148. package/dist/node_modules/lru-cache/dist/cjs/package.json +0 -3
  149. package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
  150. package/dist/node_modules/lru-cache/dist/mjs/index.js +0 -1330
  151. package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
  152. package/dist/node_modules/lru-cache/dist/mjs/package.json +0 -3
  153. package/dist/node_modules/lru-cache/package.json +0 -1
  154. package/dist/server/Plugin.d.ts +0 -84
  155. package/dist/server/Plugin.js +0 -503
  156. package/dist/server/Processor.d.ts +0 -115
  157. package/dist/server/Processor.js +0 -363
  158. package/dist/server/actions/executions.d.ts +0 -11
  159. package/dist/server/actions/executions.js +0 -96
  160. package/dist/server/actions/index.d.ts +0 -11
  161. package/dist/server/actions/index.js +0 -66
  162. package/dist/server/actions/nodes.d.ts +0 -12
  163. package/dist/server/actions/nodes.js +0 -217
  164. package/dist/server/actions/workflows.d.ts +0 -14
  165. package/dist/server/actions/workflows.js +0 -184
  166. package/dist/server/collections/executions.d.ts +0 -11
  167. package/dist/server/collections/executions.js +0 -66
  168. package/dist/server/collections/flow_nodes.d.ts +0 -11
  169. package/dist/server/collections/flow_nodes.js +0 -87
  170. package/dist/server/collections/jobs.d.ts +0 -11
  171. package/dist/server/collections/jobs.js +0 -66
  172. package/dist/server/collections/workflows.d.ts +0 -10
  173. package/dist/server/collections/workflows.js +0 -126
  174. package/dist/server/constants.d.ts +0 -29
  175. package/dist/server/constants.js +0 -58
  176. package/dist/server/functions/index.d.ts +0 -17
  177. package/dist/server/functions/index.js +0 -40
  178. package/dist/server/index.d.ts +0 -15
  179. package/dist/server/index.js +0 -60
  180. package/dist/server/instructions/CalculationInstruction.d.ts +0 -25
  181. package/dist/server/instructions/CalculationInstruction.js +0 -59
  182. package/dist/server/instructions/ConditionInstruction.d.ts +0 -36
  183. package/dist/server/instructions/ConditionInstruction.js +0 -167
  184. package/dist/server/instructions/CreateInstruction.d.ts +0 -18
  185. package/dist/server/instructions/CreateInstruction.js +0 -75
  186. package/dist/server/instructions/DestroyInstruction.d.ts +0 -18
  187. package/dist/server/instructions/DestroyInstruction.js +0 -59
  188. package/dist/server/instructions/EndInstruction.d.ts +0 -14
  189. package/dist/server/instructions/EndInstruction.js +0 -55
  190. package/dist/server/instructions/QueryInstruction.d.ts +0 -21
  191. package/dist/server/instructions/QueryInstruction.js +0 -82
  192. package/dist/server/instructions/UpdateInstruction.d.ts +0 -18
  193. package/dist/server/instructions/UpdateInstruction.js +0 -59
  194. package/dist/server/instructions/index.d.ts +0 -31
  195. package/dist/server/instructions/index.js +0 -42
  196. package/dist/server/migrations/20221129153547-calculation-variables.d.ts +0 -14
  197. package/dist/server/migrations/20221129153547-calculation-variables.js +0 -92
  198. package/dist/server/migrations/20230221032941-change-request-body-type.d.ts +0 -14
  199. package/dist/server/migrations/20230221032941-change-request-body-type.js +0 -102
  200. package/dist/server/migrations/20230221071831-calculation-expression.d.ts +0 -13
  201. package/dist/server/migrations/20230221071831-calculation-expression.js +0 -121
  202. package/dist/server/migrations/20230221121203-condition-calculation.d.ts +0 -13
  203. package/dist/server/migrations/20230221121203-condition-calculation.js +0 -106
  204. package/dist/server/migrations/20230221162902-jsonb-to-json.d.ts +0 -13
  205. package/dist/server/migrations/20230221162902-jsonb-to-json.js +0 -63
  206. package/dist/server/migrations/20230411034722-manual-multi-form.d.ts +0 -13
  207. package/dist/server/migrations/20230411034722-manual-multi-form.js +0 -283
  208. package/dist/server/migrations/20230612021134-manual-collection-block.d.ts +0 -13
  209. package/dist/server/migrations/20230612021134-manual-collection-block.js +0 -152
  210. package/dist/server/migrations/20230710115902-manual-action-values.d.ts +0 -13
  211. package/dist/server/migrations/20230710115902-manual-action-values.js +0 -101
  212. package/dist/server/migrations/20230809113132-workflow-options.d.ts +0 -13
  213. package/dist/server/migrations/20230809113132-workflow-options.js +0 -64
  214. package/dist/server/migrations/20231024172342-add-node-key.d.ts +0 -13
  215. package/dist/server/migrations/20231024172342-add-node-key.js +0 -90
  216. package/dist/server/migrations/20231122143143-split-to-plugins.d.ts +0 -13
  217. package/dist/server/migrations/20231122143143-split-to-plugins.js +0 -67
  218. package/dist/server/migrations/20240115220721-add-node-key-to-job.d.ts +0 -14
  219. package/dist/server/migrations/20240115220721-add-node-key-to-job.js +0 -63
  220. package/dist/server/migrations/20240613222612-fix-assign-field-config.d.ts +0 -13
  221. package/dist/server/migrations/20240613222612-fix-assign-field-config.js +0 -62
  222. package/dist/server/triggers/CollectionTrigger.d.ts +0 -22
  223. package/dist/server/triggers/CollectionTrigger.js +0 -184
  224. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +0 -39
  225. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +0 -356
  226. package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.d.ts +0 -21
  227. package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.js +0 -152
  228. package/dist/server/triggers/ScheduleTrigger/index.d.ts +0 -18
  229. package/dist/server/triggers/ScheduleTrigger/index.js +0 -84
  230. package/dist/server/triggers/ScheduleTrigger/utils.d.ts +0 -13
  231. package/dist/server/triggers/ScheduleTrigger/utils.js +0 -44
  232. package/dist/server/triggers/index.d.ts +0 -21
  233. package/dist/server/triggers/index.js +0 -46
  234. package/dist/server/types/Execution.d.ts +0 -25
  235. package/dist/server/types/Execution.js +0 -34
  236. package/dist/server/types/FlowNode.d.ts +0 -24
  237. package/dist/server/types/FlowNode.js +0 -34
  238. package/dist/server/types/Job.d.ts +0 -22
  239. package/dist/server/types/Job.js +0 -34
  240. package/dist/server/types/Workflow.d.ts +0 -35
  241. package/dist/server/types/Workflow.js +0 -34
  242. package/dist/server/types/index.d.ts +0 -12
  243. package/dist/server/types/index.js +0 -24
  244. package/dist/server/utils.d.ts +0 -9
  245. package/dist/server/utils.js +0 -51
  246. package/dist/swagger/index.d.ts +0 -762
  247. package/dist/swagger/index.js +0 -807
@@ -1,217 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var nodes_exports = {};
28
- __export(nodes_exports, {
29
- create: () => create,
30
- destroy: () => destroy,
31
- update: () => update
32
- });
33
- module.exports = __toCommonJS(nodes_exports);
34
- var import_actions = require("@nocobase/actions");
35
- var import_database = require("@nocobase/database");
36
- async function create(context, next) {
37
- const { db } = context;
38
- const repository = import_actions.utils.getRepositoryFromParams(context);
39
- const { whitelist, blacklist, updateAssociationValues, values, associatedIndex: workflowId } = context.action.params;
40
- context.body = await db.sequelize.transaction(async (transaction) => {
41
- const workflow = await repository.getSourceModel(transaction);
42
- if (workflow.executed) {
43
- context.throw(400, "Node could not be created in executed workflow");
44
- }
45
- const instance = await repository.create({
46
- values,
47
- whitelist,
48
- blacklist,
49
- updateAssociationValues,
50
- context,
51
- transaction
52
- });
53
- if (!instance.upstreamId) {
54
- const previousHead = await repository.findOne({
55
- filter: {
56
- id: {
57
- $ne: instance.id
58
- },
59
- upstreamId: null
60
- },
61
- transaction
62
- });
63
- if (previousHead) {
64
- await previousHead.setUpstream(instance, { transaction });
65
- await instance.setDownstream(previousHead, { transaction });
66
- instance.set("downstream", previousHead);
67
- }
68
- return instance;
69
- }
70
- const upstream = await instance.getUpstream({ transaction });
71
- if (instance.branchIndex == null) {
72
- const downstream = await upstream.getDownstream({ transaction });
73
- if (downstream) {
74
- await downstream.setUpstream(instance, { transaction });
75
- await instance.setDownstream(downstream, { transaction });
76
- instance.set("downstream", downstream);
77
- }
78
- await upstream.update(
79
- {
80
- downstreamId: instance.id
81
- },
82
- { transaction }
83
- );
84
- upstream.set("downstream", instance);
85
- } else {
86
- const [downstream] = await upstream.getBranches({
87
- where: {
88
- id: {
89
- [import_database.Op.ne]: instance.id
90
- },
91
- branchIndex: instance.branchIndex
92
- },
93
- transaction
94
- });
95
- if (downstream) {
96
- await downstream.update(
97
- {
98
- upstreamId: instance.id,
99
- branchIndex: null
100
- },
101
- { transaction }
102
- );
103
- await instance.setDownstream(downstream, { transaction });
104
- instance.set("downstream", downstream);
105
- }
106
- }
107
- instance.set("upstream", upstream);
108
- return instance;
109
- });
110
- await next();
111
- }
112
- function searchBranchNodes(nodes, from) {
113
- const branchHeads = nodes.filter((item) => item.upstreamId === from.id && item.branchIndex != null);
114
- return branchHeads.reduce(
115
- (flatten, head) => flatten.concat(searchBranchDownstreams(nodes, head)),
116
- []
117
- );
118
- }
119
- function searchBranchDownstreams(nodes, from) {
120
- let result = [];
121
- for (let search = from; search; search = search.downstream) {
122
- result = [...result, search, ...searchBranchNodes(nodes, search)];
123
- }
124
- return result;
125
- }
126
- async function destroy(context, next) {
127
- const { db } = context;
128
- const repository = import_actions.utils.getRepositoryFromParams(context);
129
- const { filterByTk } = context.action.params;
130
- const fields = ["id", "upstreamId", "downstreamId", "branchIndex"];
131
- const instance = await repository.findOne({
132
- filterByTk,
133
- fields: [...fields, "workflowId"],
134
- appends: ["upstream", "downstream", "workflow"]
135
- });
136
- if (instance.workflow.executed) {
137
- context.throw(400, "Nodes in executed workflow could not be deleted");
138
- }
139
- await db.sequelize.transaction(async (transaction) => {
140
- const { upstream, downstream } = instance.get();
141
- if (upstream && upstream.downstreamId === instance.id) {
142
- await upstream.update(
143
- {
144
- downstreamId: instance.downstreamId
145
- },
146
- { transaction }
147
- );
148
- }
149
- if (downstream) {
150
- await downstream.update(
151
- {
152
- upstreamId: instance.upstreamId,
153
- branchIndex: instance.branchIndex
154
- },
155
- { transaction }
156
- );
157
- }
158
- const nodes = await repository.find({
159
- filter: {
160
- workflowId: instance.workflowId
161
- },
162
- fields,
163
- transaction
164
- });
165
- const nodesMap = /* @__PURE__ */ new Map();
166
- nodes.forEach((item) => {
167
- nodesMap.set(item.id, item);
168
- });
169
- nodes.forEach((item) => {
170
- if (item.upstreamId) {
171
- item.upstream = nodesMap.get(item.upstreamId);
172
- }
173
- if (item.downstreamId) {
174
- item.downstream = nodesMap.get(item.downstreamId);
175
- }
176
- });
177
- const branchNodes = searchBranchNodes(nodes, nodesMap.get(instance.id));
178
- await repository.destroy({
179
- filterByTk: [instance.id, ...branchNodes.map((item) => item.id)],
180
- transaction
181
- });
182
- });
183
- context.body = instance;
184
- await next();
185
- }
186
- async function update(context, next) {
187
- const { db } = context;
188
- const repository = import_actions.utils.getRepositoryFromParams(context);
189
- const { filterByTk, values, whitelist, blacklist, filter, updateAssociationValues } = context.action.params;
190
- context.body = await db.sequelize.transaction(async (transaction) => {
191
- const { workflow } = await repository.findOne({
192
- filterByTk,
193
- appends: ["workflow.executed"],
194
- transaction
195
- });
196
- if (workflow.executed) {
197
- context.throw(400, "Nodes in executed workflow could not be reconfigured");
198
- }
199
- return repository.update({
200
- filterByTk,
201
- values,
202
- whitelist,
203
- blacklist,
204
- filter,
205
- updateAssociationValues,
206
- context,
207
- transaction
208
- });
209
- });
210
- await next();
211
- }
212
- // Annotate the CommonJS export names for ESM import in node:
213
- 0 && (module.exports = {
214
- create,
215
- destroy,
216
- update
217
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Context } from '@nocobase/actions';
10
- export declare function update(context: Context, next: any): Promise<void>;
11
- export declare function destroy(context: Context, next: any): Promise<void>;
12
- export declare function revision(context: Context, next: any): Promise<void>;
13
- export declare function sync(context: Context, next: any): Promise<void>;
14
- export declare function trigger(context: Context, next: any): Promise<any>;
@@ -1,184 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var workflows_exports = {};
38
- __export(workflows_exports, {
39
- destroy: () => destroy,
40
- revision: () => revision,
41
- sync: () => sync,
42
- trigger: () => trigger,
43
- update: () => update
44
- });
45
- module.exports = __toCommonJS(workflows_exports);
46
- var import_actions = __toESM(require("@nocobase/actions"));
47
- var import_database = require("@nocobase/database");
48
- var import_Plugin = __toESM(require("../Plugin"));
49
- async function update(context, next) {
50
- const repository = import_actions.utils.getRepositoryFromParams(context);
51
- const { filterByTk, values } = context.action.params;
52
- context.action.mergeParams({
53
- whitelist: ["title", "description", "enabled", "triggerTitle", "config", "options"]
54
- });
55
- if (Object.keys(values).includes("config")) {
56
- const workflow = await repository.findById(filterByTk);
57
- if (workflow.get("executed")) {
58
- return context.throw(400, "config of executed workflow can not be updated");
59
- }
60
- }
61
- return import_actions.default.update(context, next);
62
- }
63
- async function destroy(context, next) {
64
- const repository = import_actions.utils.getRepositoryFromParams(context);
65
- const { filterByTk, filter } = context.action.params;
66
- await context.db.sequelize.transaction(async (transaction) => {
67
- const items = await repository.find({
68
- filterByTk,
69
- filter,
70
- fields: ["id", "key", "current"],
71
- transaction
72
- });
73
- const ids = new Set(items.map((item) => item.id));
74
- const keysSet = new Set(items.filter((item) => item.current).map((item) => item.key));
75
- const revisions = await repository.find({
76
- filter: {
77
- key: Array.from(keysSet),
78
- current: { [import_database.Op.not]: true }
79
- },
80
- fields: ["id"],
81
- transaction
82
- });
83
- revisions.forEach((item) => ids.add(item.id));
84
- context.body = await repository.destroy({
85
- filterByTk: Array.from(ids),
86
- individualHooks: true,
87
- transaction
88
- });
89
- });
90
- next();
91
- }
92
- async function revision(context, next) {
93
- const plugin = context.app.getPlugin(import_Plugin.default);
94
- const repository = import_actions.utils.getRepositoryFromParams(context);
95
- const { filterByTk, filter = {}, values = {} } = context.action.params;
96
- context.body = await context.db.sequelize.transaction(async (transaction) => {
97
- const origin = await repository.findOne({
98
- filterByTk,
99
- filter,
100
- appends: ["nodes"],
101
- context,
102
- transaction
103
- });
104
- const trigger2 = plugin.triggers.get(origin.type);
105
- const revisionData = filter.key ? {
106
- key: filter.key,
107
- title: origin.title,
108
- triggerTitle: origin.triggerTitle,
109
- allExecuted: origin.allExecuted
110
- } : values;
111
- const instance = await repository.create({
112
- values: {
113
- title: `${origin.title} copy`,
114
- description: origin.description,
115
- ...revisionData,
116
- sync: origin.sync,
117
- type: origin.type,
118
- config: typeof trigger2.duplicateConfig === "function" ? await trigger2.duplicateConfig(origin, { transaction }) : origin.config
119
- },
120
- transaction
121
- });
122
- const originalNodesMap = /* @__PURE__ */ new Map();
123
- origin.nodes.forEach((node) => {
124
- originalNodesMap.set(node.id, node);
125
- });
126
- const oldToNew = /* @__PURE__ */ new Map();
127
- const newToOld = /* @__PURE__ */ new Map();
128
- for await (const node of origin.nodes) {
129
- const instruction = plugin.instructions.get(node.type);
130
- const newNode = await instance.createNode(
131
- {
132
- type: node.type,
133
- key: node.key,
134
- config: typeof instruction.duplicateConfig === "function" ? await instruction.duplicateConfig(node, { transaction }) : node.config,
135
- title: node.title,
136
- branchIndex: node.branchIndex
137
- },
138
- { transaction }
139
- );
140
- oldToNew.set(node.id, newNode);
141
- newToOld.set(newNode.id, node);
142
- }
143
- for await (const [oldId, newNode] of oldToNew.entries()) {
144
- const oldNode = originalNodesMap.get(oldId);
145
- const newUpstream = oldNode.upstreamId ? oldToNew.get(oldNode.upstreamId) : null;
146
- const newDownstream = oldNode.downstreamId ? oldToNew.get(oldNode.downstreamId) : null;
147
- await newNode.update(
148
- {
149
- upstreamId: (newUpstream == null ? void 0 : newUpstream.id) ?? null,
150
- downstreamId: (newDownstream == null ? void 0 : newDownstream.id) ?? null
151
- },
152
- { transaction }
153
- );
154
- }
155
- return instance;
156
- });
157
- await next();
158
- }
159
- async function sync(context, next) {
160
- const plugin = context.app.getPlugin(import_Plugin.default);
161
- const repository = import_actions.utils.getRepositoryFromParams(context);
162
- const { filterByTk, filter = {} } = context.action.params;
163
- const workflows = await repository.find({
164
- filterByTk,
165
- filter
166
- });
167
- workflows.forEach((workflow) => {
168
- plugin.toggle(workflow, false);
169
- plugin.toggle(workflow);
170
- });
171
- context.status = 204;
172
- await next();
173
- }
174
- async function trigger(context, next) {
175
- return next();
176
- }
177
- // Annotate the CommonJS export names for ESM import in node:
178
- 0 && (module.exports = {
179
- destroy,
180
- revision,
181
- sync,
182
- trigger,
183
- update
184
- });
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,66 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var executions_exports = {};
28
- __export(executions_exports, {
29
- default: () => executions_default
30
- });
31
- module.exports = __toCommonJS(executions_exports);
32
- var executions_default = {
33
- dumpRules: {
34
- group: "log"
35
- },
36
- name: "executions",
37
- shared: true,
38
- fields: [
39
- {
40
- type: "belongsTo",
41
- name: "workflow"
42
- },
43
- {
44
- type: "string",
45
- name: "key"
46
- },
47
- {
48
- type: "string",
49
- name: "eventKey",
50
- unique: true
51
- },
52
- {
53
- type: "hasMany",
54
- name: "jobs",
55
- onDelete: "CASCADE"
56
- },
57
- {
58
- type: "json",
59
- name: "context"
60
- },
61
- {
62
- type: "integer",
63
- name: "status"
64
- }
65
- ]
66
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,87 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var flow_nodes_exports = {};
28
- __export(flow_nodes_exports, {
29
- default: () => flow_nodes_default
30
- });
31
- module.exports = __toCommonJS(flow_nodes_exports);
32
- var flow_nodes_default = {
33
- dumpRules: "required",
34
- name: "flow_nodes",
35
- shared: true,
36
- fields: [
37
- {
38
- type: "uid",
39
- name: "key"
40
- },
41
- {
42
- type: "string",
43
- name: "title"
44
- },
45
- // which workflow belongs to
46
- {
47
- name: "workflow",
48
- type: "belongsTo"
49
- },
50
- {
51
- name: "upstream",
52
- type: "belongsTo",
53
- target: "flow_nodes"
54
- },
55
- {
56
- name: "branches",
57
- type: "hasMany",
58
- target: "flow_nodes",
59
- sourceKey: "id",
60
- foreignKey: "upstreamId"
61
- },
62
- // only works when upstream node is branching type, such as condition and parallel.
63
- // put here because the design of flow-links model is not really necessary for now.
64
- // or it should be put into flow-links model.
65
- {
66
- name: "branchIndex",
67
- type: "integer"
68
- },
69
- // Note: for reasons:
70
- // 1. redirect type node to solve cycle flow.
71
- // 2. recognize as real next node after branches.
72
- {
73
- name: "downstream",
74
- type: "belongsTo",
75
- target: "flow_nodes"
76
- },
77
- {
78
- type: "string",
79
- name: "type"
80
- },
81
- {
82
- type: "json",
83
- name: "config",
84
- defaultValue: {}
85
- }
86
- ]
87
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,66 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var jobs_exports = {};
28
- __export(jobs_exports, {
29
- default: () => jobs_default
30
- });
31
- module.exports = __toCommonJS(jobs_exports);
32
- var jobs_default = {
33
- dumpRules: {
34
- group: "log"
35
- },
36
- name: "jobs",
37
- shared: true,
38
- fields: [
39
- {
40
- type: "belongsTo",
41
- name: "execution"
42
- },
43
- {
44
- type: "belongsTo",
45
- name: "node",
46
- target: "flow_nodes"
47
- },
48
- {
49
- type: "string",
50
- name: "nodeKey"
51
- },
52
- {
53
- type: "belongsTo",
54
- name: "upstream",
55
- target: "jobs"
56
- },
57
- {
58
- type: "integer",
59
- name: "status"
60
- },
61
- {
62
- type: "json",
63
- name: "result"
64
- }
65
- ]
66
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- export default function (): CollectionOptions;