@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.
- package/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/214.88c6cd534bd4fc1c.js +10 -0
- package/dist/client/261.404a35cf5ae2ceba.js +10 -0
- package/dist/client/67.f904ef4520868b8a.js +10 -0
- package/dist/client/964.6251d37b35710747.js +10 -0
- package/dist/client/hooks/{useWorkflowFilterActionProps.d.ts → useResourceFilterActionProps.d.ts} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/nodes/create.d.ts +10 -0
- package/dist/client/nodes/destroy.d.ts +10 -0
- package/dist/client/nodes/index.d.ts +3 -0
- package/dist/client/nodes/query.d.ts +18 -2
- package/dist/client/nodes/update.d.ts +10 -0
- package/dist/client/schemas/collection.d.ts +8 -2
- package/dist/client/schemas/executions.d.ts +41 -22
- package/dist/client/triggers/collection.d.ts +14 -1
- package/dist/client/triggers/index.d.ts +4 -0
- package/dist/client/triggers/schedule/constants.d.ts +4 -0
- package/dist/client/triggers/schedule/index.d.ts +15 -0
- package/dist/common/collections/executions.d.ts +22 -22
- package/dist/common/collections/executions.js +12 -0
- package/dist/common/collections/jobs.js +7 -0
- package/dist/common/collections/workflows.d.ts +22 -9
- package/dist/common/collections/workflows.js +9 -1
- package/dist/externalVersion.js +15 -13
- package/dist/locale/zh-CN.json +4 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +178 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1067 -0
- package/dist/node_modules/joi/lib/types/link.js +168 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +1692 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{mjs → esm/browser}/index.js +537 -179
- package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/dist/node_modules/lru-cache/dist/esm/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{cjs → esm}/index.js +538 -184
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Dispatcher.d.ts +3 -2
- package/dist/server/Dispatcher.js +74 -61
- package/dist/server/Plugin.d.ts +1 -0
- package/dist/server/Plugin.js +28 -2
- package/dist/server/actions/nodes.d.ts +5 -0
- package/dist/server/actions/nodes.js +34 -2
- package/dist/server/actions/workflows.d.ts +6 -0
- package/dist/server/actions/workflows.js +38 -0
- package/dist/server/instructions/ConditionInstruction.d.ts +2 -0
- package/dist/server/instructions/ConditionInstruction.js +17 -0
- package/dist/server/instructions/CreateInstruction.d.ts +3 -0
- package/dist/server/instructions/CreateInstruction.js +25 -0
- package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
- package/dist/server/instructions/DestroyInstruction.js +25 -0
- package/dist/server/instructions/EndInstruction.d.ts +2 -0
- package/dist/server/instructions/EndInstruction.js +4 -0
- package/dist/server/instructions/MultiConditionsInstruction.d.ts +2 -0
- package/dist/server/instructions/MultiConditionsInstruction.js +23 -0
- package/dist/server/instructions/OutputInstruction.d.ts +2 -0
- package/dist/server/instructions/OutputInstruction.js +14 -0
- package/dist/server/instructions/QueryInstruction.d.ts +3 -0
- package/dist/server/instructions/QueryInstruction.js +32 -7
- package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
- package/dist/server/instructions/UpdateInstruction.js +27 -0
- package/dist/server/instructions/index.d.ts +4 -0
- package/dist/server/instructions/index.js +18 -0
- package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
- package/dist/server/triggers/CollectionTrigger.js +28 -0
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
- package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
- package/dist/server/triggers/index.d.ts +3 -0
- package/dist/server/triggers/index.js +18 -0
- package/dist/server/utils.d.ts +17 -0
- package/dist/server/utils.js +51 -2
- package/dist/swagger/index.d.ts +830 -109
- package/dist/swagger/index.js +947 -208
- package/package.json +6 -5
- package/dist/client/27bd65abee87cafa.js +0 -10
- package/dist/client/478692c1637f2742.js +0 -10
- package/dist/client/c1347b9d21f864d9.js +0 -10
- package/dist/client/f39e94207f92e352.js +0 -10
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
- package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
- /package/dist/node_modules/lru-cache/dist/{cjs → commonjs}/package.json +0 -0
- /package/dist/node_modules/lru-cache/dist/{mjs → esm}/package.json +0 -0
package/dist/server/utils.d.ts
CHANGED
|
@@ -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;
|
package/dist/server/utils.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
96
|
+
getExecutionStatusName,
|
|
97
|
+
getWorkflowExecutionLogMeta,
|
|
98
|
+
toJSON,
|
|
99
|
+
validateCollectionField
|
|
51
100
|
});
|