@nocobase/plugin-workflow 1.6.10 → 1.7.0-alpha.10
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/dist/client/27734873a939f873.js +10 -0
- package/dist/client/42a0063e6e3f5ab2.js +10 -0
- package/dist/client/c8053d382167e05f.js +10 -0
- package/dist/client/f5735dd4ea5f2180.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client/locale/index.d.ts +2 -1
- package/dist/client/schemas/executions.d.ts +126 -125
- package/dist/common/collections/executions.d.ts +136 -0
- package/dist/common/collections/executions.js +125 -0
- package/dist/common/collections/flow_nodes.d.ts +44 -0
- package/dist/common/collections/flow_nodes.js +88 -0
- package/dist/common/collections/jobs.d.ts +26 -0
- package/dist/common/collections/jobs.js +67 -0
- package/dist/common/collections/workflowStats.d.ts +37 -0
- package/dist/common/collections/workflowStats.js +59 -0
- package/dist/common/collections/workflowTasks.d.ts +10 -0
- package/dist/common/collections/workflowTasks.js +64 -0
- package/dist/common/collections/workflowVersionStats.d.ts +37 -0
- package/dist/common/collections/workflowVersionStats.js +59 -0
- package/dist/common/collections/workflows.d.ts +250 -0
- package/dist/common/collections/workflows.js +225 -0
- package/dist/common/constants.d.ts +9 -0
- package/dist/common/constants.js +36 -0
- package/dist/externalVersion.js +13 -13
- package/dist/locale/nl-NL.json +100 -0
- package/dist/locale/zh-CN.json +4 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.js +29 -18
- package/dist/server/actions/nodes.js +7 -5
- package/dist/server/actions/workflows.js +5 -2
- package/dist/server/collections/executions.js +12 -44
- package/dist/server/collections/flow_nodes.js +12 -57
- package/dist/server/collections/jobs.js +12 -36
- package/dist/server/collections/workflowStats.d.ts +11 -0
- package/dist/server/collections/workflowStats.js +43 -0
- package/dist/server/collections/workflowTasks.d.ts +2 -1
- package/dist/server/collections/workflowTasks.js +12 -33
- package/dist/server/collections/workflowVersionStats.d.ts +11 -0
- package/dist/server/collections/workflowVersionStats.js +43 -0
- package/dist/server/collections/workflows.d.ts +2 -1
- package/dist/server/collections/workflows.js +12 -101
- package/dist/server/migrations/20250320223415-stats.d.ts +14 -0
- package/dist/server/migrations/20250320223415-stats.js +75 -0
- package/dist/server/repositories/WorkflowRepository.js +1 -2
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +1 -1
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +6 -6
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.d.ts +1 -1
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.js +3 -3
- package/dist/server/types/Workflow.d.ts +0 -2
- package/dist/swagger/index.d.ts +0 -14
- package/dist/swagger/index.js +0 -14
- package/package.json +3 -3
- package/dist/client/4d75ef32f02d7285.js +0 -10
- package/dist/client/56ce448358002e64.js +0 -10
- package/dist/client/58bb427e05b600de.js +0 -10
- package/dist/client/739d458621edf81f.js +0 -10
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,66 +25,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
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
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var flow_nodes_exports = {};
|
|
28
38
|
__export(flow_nodes_exports, {
|
|
29
39
|
default: () => flow_nodes_default
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(flow_nodes_exports);
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
migrationRules: ["overwrite", "schema-only"],
|
|
35
|
-
name: "flow_nodes",
|
|
36
|
-
shared: true,
|
|
37
|
-
fields: [
|
|
38
|
-
{
|
|
39
|
-
type: "uid",
|
|
40
|
-
name: "key"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "string",
|
|
44
|
-
name: "title"
|
|
45
|
-
},
|
|
46
|
-
// which workflow belongs to
|
|
47
|
-
{
|
|
48
|
-
name: "workflow",
|
|
49
|
-
type: "belongsTo"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "upstream",
|
|
53
|
-
type: "belongsTo",
|
|
54
|
-
target: "flow_nodes"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "branches",
|
|
58
|
-
type: "hasMany",
|
|
59
|
-
target: "flow_nodes",
|
|
60
|
-
sourceKey: "id",
|
|
61
|
-
foreignKey: "upstreamId"
|
|
62
|
-
},
|
|
63
|
-
// only works when upstream node is branching type, such as condition and parallel.
|
|
64
|
-
// put here because the design of flow-links model is not really necessary for now.
|
|
65
|
-
// or it should be put into flow-links model.
|
|
66
|
-
{
|
|
67
|
-
name: "branchIndex",
|
|
68
|
-
type: "integer"
|
|
69
|
-
},
|
|
70
|
-
// Note: for reasons:
|
|
71
|
-
// 1. redirect type node to solve cycle flow.
|
|
72
|
-
// 2. recognize as real next node after branches.
|
|
73
|
-
{
|
|
74
|
-
name: "downstream",
|
|
75
|
-
type: "belongsTo",
|
|
76
|
-
target: "flow_nodes"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
type: "string",
|
|
80
|
-
name: "type"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
type: "json",
|
|
84
|
-
name: "config",
|
|
85
|
-
defaultValue: {}
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
};
|
|
42
|
+
var import_flow_nodes = __toESM(require("../../common/collections/flow_nodes"));
|
|
43
|
+
var flow_nodes_default = import_flow_nodes.default;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,45 +25,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
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
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var jobs_exports = {};
|
|
28
38
|
__export(jobs_exports, {
|
|
29
39
|
default: () => jobs_default
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(jobs_exports);
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
group: "log"
|
|
35
|
-
},
|
|
36
|
-
migrationRules: ["schema-only"],
|
|
37
|
-
name: "jobs",
|
|
38
|
-
shared: true,
|
|
39
|
-
fields: [
|
|
40
|
-
{
|
|
41
|
-
type: "belongsTo",
|
|
42
|
-
name: "execution"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: "belongsTo",
|
|
46
|
-
name: "node",
|
|
47
|
-
target: "flow_nodes"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "string",
|
|
51
|
-
name: "nodeKey"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: "belongsTo",
|
|
55
|
-
name: "upstream",
|
|
56
|
-
target: "jobs"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: "integer",
|
|
60
|
-
name: "status"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: "json",
|
|
64
|
-
name: "result"
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
};
|
|
42
|
+
var import_jobs = __toESM(require("../../common/collections/jobs"));
|
|
43
|
+
var jobs_default = import_jobs.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 workflowStats_exports = {};
|
|
38
|
+
__export(workflowStats_exports, {
|
|
39
|
+
default: () => workflowStats_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(workflowStats_exports);
|
|
42
|
+
var import_workflowStats = __toESM(require("../../common/collections/workflowStats"));
|
|
43
|
+
var workflowStats_default = import_workflowStats.default;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,42 +25,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
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
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var workflowTasks_exports = {};
|
|
28
38
|
__export(workflowTasks_exports, {
|
|
29
39
|
default: () => workflowTasks_default
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(workflowTasks_exports);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
dumpRules: "required",
|
|
35
|
-
migrationRules: ["overwrite", "schema-only"],
|
|
36
|
-
name: "workflowTasks",
|
|
37
|
-
shared: true,
|
|
38
|
-
repository: "WorkflowTasksRepository",
|
|
39
|
-
fields: [
|
|
40
|
-
{
|
|
41
|
-
name: "user",
|
|
42
|
-
type: "belongsTo"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "workflow",
|
|
46
|
-
type: "belongsTo"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: "string",
|
|
50
|
-
name: "type"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: "string",
|
|
54
|
-
name: "key"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
indexes: [
|
|
58
|
-
{
|
|
59
|
-
unique: true,
|
|
60
|
-
fields: ["type", "key"]
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
};
|
|
64
|
-
}
|
|
42
|
+
var import_workflowTasks = __toESM(require("../../common/collections/workflowTasks"));
|
|
43
|
+
var workflowTasks_default = import_workflowTasks.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 workflowVersionStats_exports = {};
|
|
38
|
+
__export(workflowVersionStats_exports, {
|
|
39
|
+
default: () => workflowVersionStats_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(workflowVersionStats_exports);
|
|
42
|
+
var import_workflowVersionStats = __toESM(require("../../common/collections/workflowVersionStats"));
|
|
43
|
+
var workflowVersionStats_default = import_workflowVersionStats.default;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,110 +25,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
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
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var workflows_exports = {};
|
|
28
38
|
__export(workflows_exports, {
|
|
29
39
|
default: () => workflows_default
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(workflows_exports);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
dumpRules: "required",
|
|
35
|
-
migrationRules: ["overwrite", "schema-only"],
|
|
36
|
-
name: "workflows",
|
|
37
|
-
shared: true,
|
|
38
|
-
repository: "WorkflowRepository",
|
|
39
|
-
fields: [
|
|
40
|
-
{
|
|
41
|
-
name: "key",
|
|
42
|
-
type: "uid"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: "string",
|
|
46
|
-
name: "title",
|
|
47
|
-
interface: "input",
|
|
48
|
-
uiSchema: {
|
|
49
|
-
title: '{{t("Name")}}',
|
|
50
|
-
type: "string",
|
|
51
|
-
"x-component": "Input",
|
|
52
|
-
required: true
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: "boolean",
|
|
57
|
-
name: "enabled",
|
|
58
|
-
defaultValue: false
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: "text",
|
|
62
|
-
name: "description"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: "string",
|
|
66
|
-
name: "type",
|
|
67
|
-
required: true
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "string",
|
|
71
|
-
name: "triggerTitle"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: "jsonb",
|
|
75
|
-
name: "config",
|
|
76
|
-
required: true,
|
|
77
|
-
defaultValue: {}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: "hasMany",
|
|
81
|
-
name: "nodes",
|
|
82
|
-
target: "flow_nodes",
|
|
83
|
-
onDelete: "CASCADE"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: "hasMany",
|
|
87
|
-
name: "executions"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: "integer",
|
|
91
|
-
name: "executed",
|
|
92
|
-
defaultValue: 0
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "integer",
|
|
96
|
-
name: "allExecuted",
|
|
97
|
-
defaultValue: 0
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: "boolean",
|
|
101
|
-
name: "current"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: "boolean",
|
|
105
|
-
name: "sync",
|
|
106
|
-
defaultValue: false
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
type: "hasMany",
|
|
110
|
-
name: "revisions",
|
|
111
|
-
target: "workflows",
|
|
112
|
-
foreignKey: "key",
|
|
113
|
-
sourceKey: "key",
|
|
114
|
-
// NOTE: no constraints needed here because tricky self-referencing
|
|
115
|
-
constraints: false,
|
|
116
|
-
onDelete: "NO ACTION"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
type: "jsonb",
|
|
120
|
-
name: "options",
|
|
121
|
-
defaultValue: {}
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
// NOTE: use unique index for avoiding deadlock in mysql when setCurrent
|
|
125
|
-
indexes: [
|
|
126
|
-
{
|
|
127
|
-
unique: true,
|
|
128
|
-
fields: ["key", "current"]
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
};
|
|
132
|
-
}
|
|
42
|
+
var import_workflows = __toESM(require("../../common/collections/workflows"));
|
|
43
|
+
var workflows_default = import_workflows.default;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
appVersion: string;
|
|
12
|
+
on: string;
|
|
13
|
+
up(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 stats_exports = {};
|
|
28
|
+
__export(stats_exports, {
|
|
29
|
+
default: () => stats_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(stats_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
class stats_default extends import_server.Migration {
|
|
34
|
+
appVersion = "<1.7.0";
|
|
35
|
+
on = "afterLoad";
|
|
36
|
+
async up() {
|
|
37
|
+
const { db } = this.context;
|
|
38
|
+
const WorkflowRepo = db.getRepository("workflows");
|
|
39
|
+
const WorkflowStatsModel = db.getModel("workflowStats");
|
|
40
|
+
const WorkflowVersionStatsModel = db.getModel("workflowVersionStats");
|
|
41
|
+
await db.sequelize.transaction(async (transaction) => {
|
|
42
|
+
const workflows = await WorkflowRepo.find({
|
|
43
|
+
fields: ["id", "key", "executed", "allExecuted"],
|
|
44
|
+
transaction
|
|
45
|
+
});
|
|
46
|
+
const groupCounts = {};
|
|
47
|
+
for (const workflow of workflows) {
|
|
48
|
+
await WorkflowVersionStatsModel.findOrCreate({
|
|
49
|
+
where: {
|
|
50
|
+
id: workflow.id
|
|
51
|
+
},
|
|
52
|
+
defaults: {
|
|
53
|
+
id: workflow.id,
|
|
54
|
+
executed: workflow.get("executed")
|
|
55
|
+
},
|
|
56
|
+
transaction
|
|
57
|
+
});
|
|
58
|
+
const key = workflow.get("key");
|
|
59
|
+
groupCounts[key] = {
|
|
60
|
+
key,
|
|
61
|
+
executed: workflow.get("allExecuted") || 0
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
for (const values of Object.values(groupCounts)) {
|
|
65
|
+
await WorkflowStatsModel.findOrCreate({
|
|
66
|
+
where: {
|
|
67
|
+
key: values.key
|
|
68
|
+
},
|
|
69
|
+
defaults: values,
|
|
70
|
+
transaction
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -49,7 +49,7 @@ class WorkflowRepository extends import_database.Repository {
|
|
|
49
49
|
const origin = await this.findOne({
|
|
50
50
|
filterByTk,
|
|
51
51
|
filter,
|
|
52
|
-
appends: ["nodes"],
|
|
52
|
+
appends: ["nodes", "stats", "versionStats"],
|
|
53
53
|
context,
|
|
54
54
|
transaction
|
|
55
55
|
});
|
|
@@ -58,7 +58,6 @@ class WorkflowRepository extends import_database.Repository {
|
|
|
58
58
|
key: filter.key,
|
|
59
59
|
title: origin.title,
|
|
60
60
|
triggerTitle: origin.triggerTitle,
|
|
61
|
-
allExecuted: origin.allExecuted,
|
|
62
61
|
current: null,
|
|
63
62
|
...values
|
|
64
63
|
} : values;
|
|
@@ -30,7 +30,7 @@ export default class DateFieldScheduleTrigger {
|
|
|
30
30
|
constructor(workflow: Plugin);
|
|
31
31
|
reload(): Promise<void>;
|
|
32
32
|
inspect(workflows: WorkflowModel[]): void;
|
|
33
|
-
loadRecordsToSchedule({ id, config: { collection, limit, startsOn, repeat, endsOn },
|
|
33
|
+
loadRecordsToSchedule({ id, config: { collection, limit, startsOn, repeat, endsOn }, stats }: WorkflowModel, currentDate: Date): Promise<import("@nocobase/database").Model<any, any>[]>;
|
|
34
34
|
getRecordNextTime(workflow: WorkflowModel, record: any, nextSecond?: boolean): any;
|
|
35
35
|
schedule(workflow: WorkflowModel, record: any, nextTime: any, toggle?: boolean, options?: {}): Promise<void>;
|
|
36
36
|
trigger(workflow: WorkflowModel, record: any, nextTime: any, { transaction }?: Transactionable): Promise<void>;
|
|
@@ -146,10 +146,10 @@ class DateFieldScheduleTrigger {
|
|
|
146
146
|
// b. repeat in range (number or cron):
|
|
147
147
|
// i. endsOn after now -> yes
|
|
148
148
|
// ii. endsOn before now -> no
|
|
149
|
-
async loadRecordsToSchedule({ id, config: { collection, limit, startsOn, repeat, endsOn },
|
|
149
|
+
async loadRecordsToSchedule({ id, config: { collection, limit, startsOn, repeat, endsOn }, stats }, currentDate) {
|
|
150
150
|
const { dataSourceManager } = this.workflow.app;
|
|
151
|
-
if (limit &&
|
|
152
|
-
this.workflow.getLogger(id).warn(`[Schedule on date field] limit reached (all executed ${
|
|
151
|
+
if (limit && stats.executed >= limit) {
|
|
152
|
+
this.workflow.getLogger(id).warn(`[Schedule on date field] limit reached (all executed ${stats.executed})`);
|
|
153
153
|
return [];
|
|
154
154
|
}
|
|
155
155
|
if (!startsOn) {
|
|
@@ -232,9 +232,9 @@ class DateFieldScheduleTrigger {
|
|
|
232
232
|
getRecordNextTime(workflow, record, nextSecond = false) {
|
|
233
233
|
const {
|
|
234
234
|
config: { startsOn, endsOn, repeat, limit },
|
|
235
|
-
|
|
235
|
+
stats
|
|
236
236
|
} = workflow;
|
|
237
|
-
if (limit &&
|
|
237
|
+
if (limit && stats.executed >= limit) {
|
|
238
238
|
return null;
|
|
239
239
|
}
|
|
240
240
|
const range = this.cacheCycle;
|
|
@@ -324,7 +324,7 @@ class DateFieldScheduleTrigger {
|
|
|
324
324
|
eventKey
|
|
325
325
|
}
|
|
326
326
|
);
|
|
327
|
-
if (!workflow.config.repeat || workflow.config.limit && workflow.
|
|
327
|
+
if (!workflow.config.repeat || workflow.config.limit && workflow.stats.executed >= workflow.config.limit - 1) {
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
const n = this.getRecordNextTime(workflow, data, true);
|
|
@@ -13,7 +13,7 @@ export default class StaticScheduleTrigger {
|
|
|
13
13
|
private timers;
|
|
14
14
|
constructor(workflow: Plugin);
|
|
15
15
|
inspect(workflows: WorkflowModel[]): void;
|
|
16
|
-
getNextTime({ config,
|
|
16
|
+
getNextTime({ config, stats }: WorkflowModel, currentDate: Date, nextSecond?: boolean): number;
|
|
17
17
|
schedule(workflow: WorkflowModel, nextTime: number, toggle?: boolean): void;
|
|
18
18
|
trigger(workflow: WorkflowModel, time: number): Promise<void>;
|
|
19
19
|
on(workflow: any): void;
|
|
@@ -70,8 +70,8 @@ class StaticScheduleTrigger {
|
|
|
70
70
|
this.schedule(workflow, nextTime, nextTime >= now.getTime());
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
getNextTime({ config,
|
|
74
|
-
if (config.limit &&
|
|
73
|
+
getNextTime({ config, stats }, currentDate, nextSecond = false) {
|
|
74
|
+
if (config.limit && stats.executed >= config.limit) {
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
if (!config.startsOn) {
|
|
@@ -135,7 +135,7 @@ class StaticScheduleTrigger {
|
|
|
135
135
|
const eventKey = `${workflow.id}@${time}`;
|
|
136
136
|
this.timers.delete(eventKey);
|
|
137
137
|
this.workflow.trigger(workflow, { date: new Date(time) }, { eventKey });
|
|
138
|
-
if (!workflow.config.repeat || workflow.config.limit && workflow.
|
|
138
|
+
if (!workflow.config.repeat || workflow.config.limit && workflow.stats.executed >= workflow.config.limit - 1) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
const nextTime = this.getNextTime(workflow, /* @__PURE__ */ new Date(), true);
|