@nocobase/plugin-workflow 2.1.0-alpha.2 → 2.1.0-alpha.20

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 (136) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/dist/client/214.88c6cd534bd4fc1c.js +10 -0
  4. package/dist/client/261.404a35cf5ae2ceba.js +10 -0
  5. package/dist/client/67.f904ef4520868b8a.js +10 -0
  6. package/dist/client/964.6251d37b35710747.js +10 -0
  7. package/dist/client/hooks/{useWorkflowFilterActionProps.d.ts → useResourceFilterActionProps.d.ts} +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/client/nodes/create.d.ts +10 -0
  10. package/dist/client/nodes/destroy.d.ts +10 -0
  11. package/dist/client/nodes/index.d.ts +3 -0
  12. package/dist/client/nodes/query.d.ts +18 -2
  13. package/dist/client/nodes/update.d.ts +10 -0
  14. package/dist/client/schemas/collection.d.ts +8 -2
  15. package/dist/client/schemas/executions.d.ts +41 -22
  16. package/dist/client/triggers/collection.d.ts +14 -1
  17. package/dist/client/triggers/index.d.ts +4 -0
  18. package/dist/client/triggers/schedule/constants.d.ts +4 -0
  19. package/dist/client/triggers/schedule/index.d.ts +15 -0
  20. package/dist/common/collections/executions.d.ts +22 -22
  21. package/dist/common/collections/executions.js +12 -0
  22. package/dist/common/collections/jobs.js +7 -0
  23. package/dist/common/collections/workflows.d.ts +22 -9
  24. package/dist/common/collections/workflows.js +9 -1
  25. package/dist/externalVersion.js +15 -13
  26. package/dist/locale/zh-CN.json +4 -1
  27. package/dist/node_modules/cron-parser/package.json +1 -1
  28. package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
  29. package/dist/node_modules/joi/lib/annotate.js +175 -0
  30. package/dist/node_modules/joi/lib/base.js +1069 -0
  31. package/dist/node_modules/joi/lib/cache.js +143 -0
  32. package/dist/node_modules/joi/lib/common.js +216 -0
  33. package/dist/node_modules/joi/lib/compile.js +283 -0
  34. package/dist/node_modules/joi/lib/errors.js +271 -0
  35. package/dist/node_modules/joi/lib/extend.js +312 -0
  36. package/dist/node_modules/joi/lib/index.d.ts +2365 -0
  37. package/dist/node_modules/joi/lib/index.js +1 -0
  38. package/dist/node_modules/joi/lib/manifest.js +476 -0
  39. package/dist/node_modules/joi/lib/messages.js +178 -0
  40. package/dist/node_modules/joi/lib/modify.js +267 -0
  41. package/dist/node_modules/joi/lib/ref.js +414 -0
  42. package/dist/node_modules/joi/lib/schemas.js +302 -0
  43. package/dist/node_modules/joi/lib/state.js +166 -0
  44. package/dist/node_modules/joi/lib/template.js +463 -0
  45. package/dist/node_modules/joi/lib/trace.js +346 -0
  46. package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
  47. package/dist/node_modules/joi/lib/types/any.js +174 -0
  48. package/dist/node_modules/joi/lib/types/array.js +809 -0
  49. package/dist/node_modules/joi/lib/types/binary.js +100 -0
  50. package/dist/node_modules/joi/lib/types/boolean.js +150 -0
  51. package/dist/node_modules/joi/lib/types/date.js +233 -0
  52. package/dist/node_modules/joi/lib/types/function.js +93 -0
  53. package/dist/node_modules/joi/lib/types/keys.js +1067 -0
  54. package/dist/node_modules/joi/lib/types/link.js +168 -0
  55. package/dist/node_modules/joi/lib/types/number.js +363 -0
  56. package/dist/node_modules/joi/lib/types/object.js +22 -0
  57. package/dist/node_modules/joi/lib/types/string.js +850 -0
  58. package/dist/node_modules/joi/lib/types/symbol.js +102 -0
  59. package/dist/node_modules/joi/lib/validator.js +750 -0
  60. package/dist/node_modules/joi/lib/values.js +263 -0
  61. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  62. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
  63. package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
  64. package/dist/node_modules/joi/package.json +1 -0
  65. package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
  66. package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
  67. package/dist/node_modules/lru-cache/dist/commonjs/index.d.ts +1381 -0
  68. package/dist/node_modules/lru-cache/dist/commonjs/index.js +1692 -0
  69. package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -0
  70. package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
  71. package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  72. package/dist/node_modules/lru-cache/dist/esm/browser/index.d.ts +1381 -0
  73. package/dist/node_modules/lru-cache/dist/{mjs → esm/browser}/index.js +537 -179
  74. package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  75. package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
  76. package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  77. package/dist/node_modules/lru-cache/dist/esm/index.d.ts +1381 -0
  78. package/dist/node_modules/lru-cache/dist/{cjs → esm}/index.js +538 -184
  79. package/dist/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  80. package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
  81. package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
  82. package/dist/node_modules/lru-cache/dist/esm/node/index.d.ts +1381 -0
  83. package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
  84. package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  85. package/dist/node_modules/lru-cache/package.json +1 -1
  86. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  87. package/dist/server/Dispatcher.d.ts +3 -2
  88. package/dist/server/Dispatcher.js +74 -61
  89. package/dist/server/Plugin.d.ts +1 -0
  90. package/dist/server/Plugin.js +28 -2
  91. package/dist/server/actions/nodes.d.ts +5 -0
  92. package/dist/server/actions/nodes.js +34 -2
  93. package/dist/server/actions/workflows.d.ts +6 -0
  94. package/dist/server/actions/workflows.js +38 -0
  95. package/dist/server/instructions/ConditionInstruction.d.ts +2 -0
  96. package/dist/server/instructions/ConditionInstruction.js +17 -0
  97. package/dist/server/instructions/CreateInstruction.d.ts +3 -0
  98. package/dist/server/instructions/CreateInstruction.js +25 -0
  99. package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
  100. package/dist/server/instructions/DestroyInstruction.js +25 -0
  101. package/dist/server/instructions/EndInstruction.d.ts +2 -0
  102. package/dist/server/instructions/EndInstruction.js +4 -0
  103. package/dist/server/instructions/MultiConditionsInstruction.d.ts +2 -0
  104. package/dist/server/instructions/MultiConditionsInstruction.js +23 -0
  105. package/dist/server/instructions/OutputInstruction.d.ts +2 -0
  106. package/dist/server/instructions/OutputInstruction.js +14 -0
  107. package/dist/server/instructions/QueryInstruction.d.ts +3 -0
  108. package/dist/server/instructions/QueryInstruction.js +32 -7
  109. package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
  110. package/dist/server/instructions/UpdateInstruction.js +27 -0
  111. package/dist/server/instructions/index.d.ts +4 -0
  112. package/dist/server/instructions/index.js +18 -0
  113. package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
  114. package/dist/server/triggers/CollectionTrigger.js +28 -0
  115. package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
  116. package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
  117. package/dist/server/triggers/index.d.ts +3 -0
  118. package/dist/server/triggers/index.js +18 -0
  119. package/dist/server/utils.d.ts +17 -0
  120. package/dist/server/utils.js +51 -2
  121. package/dist/swagger/index.d.ts +830 -109
  122. package/dist/swagger/index.js +947 -208
  123. package/package.json +6 -5
  124. package/dist/client/27bd65abee87cafa.js +0 -10
  125. package/dist/client/478692c1637f2742.js +0 -10
  126. package/dist/client/c1347b9d21f864d9.js +0 -10
  127. package/dist/client/f39e94207f92e352.js +0 -10
  128. package/dist/node_modules/lru-cache/LICENSE +0 -15
  129. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
  130. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
  131. package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
  132. package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
  133. package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
  134. package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
  135. /package/dist/node_modules/lru-cache/dist/{cjs → commonjs}/package.json +0 -0
  136. /package/dist/node_modules/lru-cache/dist/{mjs → esm}/package.json +0 -0
@@ -6,4 +6,21 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import type { DataSourceManager } from '@nocobase/data-source-manager';
10
+ import type { WorkflowModel } from './types';
11
+ import Processor from './Processor';
12
+ export declare function validateCollectionField(collection: string, dataSourceManager: DataSourceManager): Record<string, string> | null;
13
+ export declare function getExecutionStatusName(status: number | null | undefined): string;
14
+ export declare function getWorkflowExecutionLogMeta(workflow: WorkflowModel, processor?: Processor): {
15
+ workflowId: number;
16
+ workflowKey: string;
17
+ workflowTitle: string;
18
+ executionId: number;
19
+ executionStatus: number;
20
+ executionStatusName: string;
21
+ lastNodeId: number;
22
+ lastNodeType: string;
23
+ lastJobId: number;
24
+ lastJobStatus: number;
25
+ };
9
26
  export declare function toJSON(data: any): any;
@@ -26,10 +26,56 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
27
  var utils_exports = {};
28
28
  __export(utils_exports, {
29
- toJSON: () => toJSON
29
+ getExecutionStatusName: () => getExecutionStatusName,
30
+ getWorkflowExecutionLogMeta: () => getWorkflowExecutionLogMeta,
31
+ toJSON: () => toJSON,
32
+ validateCollectionField: () => validateCollectionField
30
33
  });
31
34
  module.exports = __toCommonJS(utils_exports);
32
35
  var import_database = require("@nocobase/database");
36
+ var import_data_source_manager = require("@nocobase/data-source-manager");
37
+ var import_constants = require("./constants");
38
+ function validateCollectionField(collection, dataSourceManager) {
39
+ const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
40
+ if (collection.includes(":")) {
41
+ const parts = collection.split(":");
42
+ if (parts.length !== 2 || !parts[0] || !parts[1]) {
43
+ return { collection: `"collection" must be in the format "dataSourceName:collectionName"` };
44
+ }
45
+ }
46
+ const dataSource = dataSourceManager.dataSources.get(dataSourceName);
47
+ if (!dataSource) {
48
+ return { collection: `Data source "${dataSourceName}" does not exist` };
49
+ }
50
+ if (!dataSource.collectionManager.getCollection(collectionName)) {
51
+ return { collection: `Collection "${collectionName}" does not exist in data source "${dataSourceName}"` };
52
+ }
53
+ return null;
54
+ }
55
+ const EXECUTION_STATUS_NAMES = new Map(Object.entries(import_constants.EXECUTION_STATUS).map(([name, value]) => [value, name]));
56
+ function getExecutionStatusName(status) {
57
+ if (typeof status === "undefined") {
58
+ return "UNKNOWN";
59
+ }
60
+ return EXECUTION_STATUS_NAMES.get(status) ?? `${status}`;
61
+ }
62
+ function getWorkflowExecutionLogMeta(workflow, processor) {
63
+ var _a, _b, _c, _d;
64
+ const lastSavedJob = processor == null ? void 0 : processor.lastSavedJob;
65
+ const lastNode = (_a = processor == null ? void 0 : processor.nodesMap) == null ? void 0 : _a.get(lastSavedJob == null ? void 0 : lastSavedJob.nodeId);
66
+ return {
67
+ workflowId: workflow.id,
68
+ workflowKey: workflow.key,
69
+ workflowTitle: workflow.title,
70
+ executionId: ((_b = processor == null ? void 0 : processor.execution) == null ? void 0 : _b.id) ?? null,
71
+ executionStatus: ((_c = processor == null ? void 0 : processor.execution) == null ? void 0 : _c.status) ?? null,
72
+ executionStatusName: getExecutionStatusName((_d = processor == null ? void 0 : processor.execution) == null ? void 0 : _d.status),
73
+ lastNodeId: (lastNode == null ? void 0 : lastNode.id) ?? (lastSavedJob == null ? void 0 : lastSavedJob.nodeId) ?? null,
74
+ lastNodeType: (lastNode == null ? void 0 : lastNode.type) ?? null,
75
+ lastJobId: (lastSavedJob == null ? void 0 : lastSavedJob.id) ?? null,
76
+ lastJobStatus: (lastSavedJob == null ? void 0 : lastSavedJob.status) ?? null
77
+ };
78
+ }
33
79
  function toJSON(data) {
34
80
  if (Array.isArray(data)) {
35
81
  return data.map(toJSON);
@@ -47,5 +93,8 @@ function toJSON(data) {
47
93
  }
48
94
  // Annotate the CommonJS export names for ESM import in node:
49
95
  0 && (module.exports = {
50
- toJSON
96
+ getExecutionStatusName,
97
+ getWorkflowExecutionLogMeta,
98
+ toJSON,
99
+ validateCollectionField
51
100
  });