@nocobase/plugin-workflow-cc 1.8.4
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.txt +161 -0
- package/README.md +16 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +13 -0
- package/dist/client/index.js +10 -0
- package/dist/client/instruction/SchemaConfig.d.ts +16 -0
- package/dist/client/instruction/index.d.ts +111 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/tasks.d.ts +27 -0
- package/dist/common/collections/workflowCcTasks.d.ts +145 -0
- package/dist/common/collections/workflowCcTasks.js +165 -0
- package/dist/common/constants.d.ts +14 -0
- package/dist/common/constants.js +45 -0
- package/dist/externalVersion.js +28 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +15 -0
- package/dist/locale/zh-CN.json +15 -0
- package/dist/server/CCInstruction.d.ts +16 -0
- package/dist/server/CCInstruction.js +96 -0
- package/dist/server/actions.d.ts +9 -0
- package/dist/server/actions.js +120 -0
- package/dist/server/collections/workflowCcTasks.d.ts +19 -0
- package/dist/server/collections/workflowCcTasks.js +43 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/plugin.d.ts +17 -0
- package/dist/server/plugin.js +86 -0
- package/package.json +25 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,165 @@
|
|
|
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 workflowCcTasks_exports = {};
|
|
28
|
+
__export(workflowCcTasks_exports, {
|
|
29
|
+
default: () => workflowCcTasks_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(workflowCcTasks_exports);
|
|
32
|
+
var import_constants = require("../constants");
|
|
33
|
+
var workflowCcTasks_default = {
|
|
34
|
+
name: "workflowCcTasks",
|
|
35
|
+
dumpRules: {
|
|
36
|
+
group: "log"
|
|
37
|
+
},
|
|
38
|
+
migrationRules: ["schema-only"],
|
|
39
|
+
shared: true,
|
|
40
|
+
createdAt: true,
|
|
41
|
+
updatedAt: true,
|
|
42
|
+
fields: [
|
|
43
|
+
{
|
|
44
|
+
type: "bigInt",
|
|
45
|
+
name: "id",
|
|
46
|
+
primaryKey: true,
|
|
47
|
+
autoIncrement: true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "belongsTo",
|
|
51
|
+
name: "job",
|
|
52
|
+
target: "jobs",
|
|
53
|
+
foreignKey: "jobId",
|
|
54
|
+
primaryKey: false
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "belongsTo",
|
|
58
|
+
name: "user",
|
|
59
|
+
target: "users",
|
|
60
|
+
foreignKey: "userId",
|
|
61
|
+
primaryKey: false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "string",
|
|
65
|
+
name: "title",
|
|
66
|
+
interface: "input",
|
|
67
|
+
uiSchema: {
|
|
68
|
+
type: "string",
|
|
69
|
+
title: `{{t("Task title", { ns: "${import_constants.NAMESPACE}" })}}`,
|
|
70
|
+
"x-component": "Input"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "belongsTo",
|
|
75
|
+
name: "execution",
|
|
76
|
+
onDelete: "CASCADE"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "belongsTo",
|
|
80
|
+
name: "node",
|
|
81
|
+
target: "flow_nodes"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "belongsTo",
|
|
85
|
+
name: "workflow",
|
|
86
|
+
target: "workflows",
|
|
87
|
+
foreignKey: "workflowId",
|
|
88
|
+
onDelete: "CASCADE",
|
|
89
|
+
interface: "m2o",
|
|
90
|
+
uiSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
title: `{{t("Workflow", { ns: "workflow" })}}`,
|
|
93
|
+
"x-component": "AssociationField",
|
|
94
|
+
"x-component-props": {
|
|
95
|
+
fieldNames: {
|
|
96
|
+
label: "title",
|
|
97
|
+
value: "id"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: "integer",
|
|
104
|
+
name: "status",
|
|
105
|
+
interface: "select",
|
|
106
|
+
uiSchema: {
|
|
107
|
+
type: "number",
|
|
108
|
+
title: `{{t("Status", { ns: "${import_constants.NAMESPACE}" })}}`,
|
|
109
|
+
"x-component": "Select",
|
|
110
|
+
enum: [
|
|
111
|
+
{
|
|
112
|
+
label: `{{t("Unread", { ns: "${import_constants.NAMESPACE}" })}}`,
|
|
113
|
+
value: 0,
|
|
114
|
+
color: "gold"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: `{{t("Read", { ns: "${import_constants.NAMESPACE}" })}}`,
|
|
118
|
+
value: 1,
|
|
119
|
+
color: "green"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
defaultValue: 0
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "date",
|
|
127
|
+
name: "readAt",
|
|
128
|
+
interface: "datetime",
|
|
129
|
+
uiSchema: {
|
|
130
|
+
type: "string",
|
|
131
|
+
title: `{{t("Read at", { ns: "${import_constants.NAMESPACE}" })}}`,
|
|
132
|
+
"x-component": "DatePicker",
|
|
133
|
+
"x-component-props": {
|
|
134
|
+
showTime: true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "date",
|
|
140
|
+
name: "createdAt",
|
|
141
|
+
interface: "createdAt",
|
|
142
|
+
uiSchema: {
|
|
143
|
+
type: "datetime",
|
|
144
|
+
title: '{{t("Created at")}}',
|
|
145
|
+
"x-component": "DatePicker",
|
|
146
|
+
"x-component-props": {
|
|
147
|
+
showTime: true
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: "date",
|
|
153
|
+
name: "updatedAt",
|
|
154
|
+
interface: "updatedAt",
|
|
155
|
+
uiSchema: {
|
|
156
|
+
type: "datetime",
|
|
157
|
+
title: '{{t("Updated at")}}',
|
|
158
|
+
"x-component": "DatePicker",
|
|
159
|
+
"x-component-props": {
|
|
160
|
+
showTime: true
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
@@ -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
|
+
export declare const NAMESPACE = "@nocobase/plugin-workflow-cc";
|
|
10
|
+
export declare const TASK_TYPE_CC = "cc";
|
|
11
|
+
export declare const TASK_STATUS: {
|
|
12
|
+
UNREAD: number;
|
|
13
|
+
READ: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 constants_exports = {};
|
|
28
|
+
__export(constants_exports, {
|
|
29
|
+
NAMESPACE: () => NAMESPACE,
|
|
30
|
+
TASK_STATUS: () => TASK_STATUS,
|
|
31
|
+
TASK_TYPE_CC: () => TASK_TYPE_CC
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(constants_exports);
|
|
34
|
+
const NAMESPACE = "@nocobase/plugin-workflow-cc";
|
|
35
|
+
const TASK_TYPE_CC = "cc";
|
|
36
|
+
const TASK_STATUS = {
|
|
37
|
+
UNREAD: 0,
|
|
38
|
+
READ: 1
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
NAMESPACE,
|
|
43
|
+
TASK_STATUS,
|
|
44
|
+
TASK_TYPE_CC
|
|
45
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
module.exports = {
|
|
11
|
+
"react": "18.2.0",
|
|
12
|
+
"@nocobase/client": "1.8.4",
|
|
13
|
+
"@nocobase/plugin-workflow": "1.8.4",
|
|
14
|
+
"react-i18next": "11.18.6",
|
|
15
|
+
"antd-style": "3.7.1",
|
|
16
|
+
"antd": "5.24.2",
|
|
17
|
+
"react-router-dom": "6.28.1",
|
|
18
|
+
"lodash": "4.17.21",
|
|
19
|
+
"@nocobase/utils": "1.8.4",
|
|
20
|
+
"@nocobase/plugin-ui-schema-storage": "1.8.4",
|
|
21
|
+
"@nocobase/actions": "1.8.4",
|
|
22
|
+
"@nocobase/server": "1.8.4",
|
|
23
|
+
"@nocobase/database": "1.8.4",
|
|
24
|
+
"@formily/shared": "2.3.2",
|
|
25
|
+
"@formily/react": "2.3.0",
|
|
26
|
+
"@formily/antd-v5": "1.2.3",
|
|
27
|
+
"@ant-design/icons": "5.6.1"
|
|
28
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './server';
|
|
10
|
+
export { default } from './server';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
default: () => import_server.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
43
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
+
var import_server = __toESM(require("./server"));
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
...require("./server")
|
|
48
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"CC": "CC",
|
|
3
|
+
"Information within the workflow can be freely configured into a view interface and made accessible to specific users. A CC task will be generated for them in the tasks center.": "Information within the workflow can be freely configured into a view interface and made accessible to specific users. A CC task will be generated for them in the tasks center.",
|
|
4
|
+
"Recipients": "Recipients",
|
|
5
|
+
"User interface": "User interface",
|
|
6
|
+
"View user interface": "View user interface",
|
|
7
|
+
"Configure user interface": "Configure user interface",
|
|
8
|
+
"Title of each CC item in tasks center. Could use variables in string template. Default to node title.": "Title of each CC item in tasks center. Could use variables in string template. Default to node title.",
|
|
9
|
+
"Read": "Read",
|
|
10
|
+
"Unread": "Unread",
|
|
11
|
+
"Mark as read": "Mark as read",
|
|
12
|
+
"Mark as unread": "Mark as unread",
|
|
13
|
+
"Mark all as read": "Mark all as read",
|
|
14
|
+
"CC to me": "CC to me"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"CC": "抄送",
|
|
3
|
+
"Information within the workflow can be freely configured into a view interface and made accessible to specific users. A CC task will be generated for them in the tasks center.": "可将流程中的信息自由配置为查看界面,提供给特定的用户查看,将在待办中心为其生成抄送任务。",
|
|
4
|
+
"Recipients": "接收人",
|
|
5
|
+
"User interface": "用户界面",
|
|
6
|
+
"View user interface": "查看用户界面",
|
|
7
|
+
"Configure user interface": "配置用户界面",
|
|
8
|
+
"Title of each CC item in tasks center. Could use variables in string template. Default to node title.": "待办中心每个抄送项的标题。可以在字符串模板中使用变量。默认为节点标题。",
|
|
9
|
+
"Read": "已读",
|
|
10
|
+
"Unread": "未读",
|
|
11
|
+
"Mark as read": "标为已读",
|
|
12
|
+
"Mark as unread": "标为未读",
|
|
13
|
+
"Mark all as read": "全部标为已读",
|
|
14
|
+
"CC to me": "抄送我的"
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { Instruction } from '@nocobase/plugin-workflow';
|
|
10
|
+
export default class CCInstruction extends Instruction {
|
|
11
|
+
static type: string;
|
|
12
|
+
run(node: any, prevJob: any, processor: any): Promise<any>;
|
|
13
|
+
duplicateConfig(node: any, { transaction }: {
|
|
14
|
+
transaction: any;
|
|
15
|
+
}): Promise<any>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 CCInstruction_exports = {};
|
|
28
|
+
__export(CCInstruction_exports, {
|
|
29
|
+
default: () => CCInstruction
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(CCInstruction_exports);
|
|
32
|
+
var import_utils = require("@nocobase/utils");
|
|
33
|
+
var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
34
|
+
var import_constants = require("../common/constants");
|
|
35
|
+
async function getUsers(config, { db, transaction }) {
|
|
36
|
+
const users = /* @__PURE__ */ new Set();
|
|
37
|
+
const UserRepo = db.getRepository("users");
|
|
38
|
+
for (const item of config) {
|
|
39
|
+
if (typeof item === "object") {
|
|
40
|
+
if (!(0, import_utils.isValidFilter)(item.filter)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const result = await UserRepo.find({
|
|
44
|
+
...item,
|
|
45
|
+
fields: ["id"],
|
|
46
|
+
transaction
|
|
47
|
+
});
|
|
48
|
+
result.forEach((item2) => users.add(item2.id));
|
|
49
|
+
} else {
|
|
50
|
+
users.add(item);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [...users];
|
|
54
|
+
}
|
|
55
|
+
class CCInstruction extends import_plugin_workflow.Instruction {
|
|
56
|
+
static type = "cc";
|
|
57
|
+
async run(node, prevJob, processor) {
|
|
58
|
+
const { db } = processor.options.plugin;
|
|
59
|
+
const job = processor.saveJob({
|
|
60
|
+
status: import_plugin_workflow.JOB_STATUS.RESOLVED,
|
|
61
|
+
nodeId: node.id,
|
|
62
|
+
nodeKey: node.key,
|
|
63
|
+
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
64
|
+
});
|
|
65
|
+
const usersConfig = processor.getParsedValue(node.config.users ?? [], node.id).flat().filter(Boolean);
|
|
66
|
+
const users = await getUsers(usersConfig, { db, transaction: processor.mainTransaction });
|
|
67
|
+
const RecordRepo = db.getRepository("workflowCcTasks");
|
|
68
|
+
const title = node.config.title ? processor.getParsedValue(node.config.title, node.id) : node.title;
|
|
69
|
+
const records = await RecordRepo.createMany({
|
|
70
|
+
records: users.map((userId, index) => ({
|
|
71
|
+
userId,
|
|
72
|
+
jobId: job.id,
|
|
73
|
+
nodeId: node.id,
|
|
74
|
+
executionId: job.executionId,
|
|
75
|
+
workflowId: node.workflowId,
|
|
76
|
+
status: import_constants.TASK_STATUS.UNREAD,
|
|
77
|
+
title
|
|
78
|
+
})),
|
|
79
|
+
transaction: processor.mainTransaction
|
|
80
|
+
});
|
|
81
|
+
return job;
|
|
82
|
+
}
|
|
83
|
+
async duplicateConfig(node, { transaction }) {
|
|
84
|
+
const uiSchemaRepo = this.workflow.app.db.getRepository("uiSchemas");
|
|
85
|
+
if (!node.config.ccDetail) {
|
|
86
|
+
return node.config;
|
|
87
|
+
}
|
|
88
|
+
const result = await uiSchemaRepo.duplicate(node.config.ccDetail, {
|
|
89
|
+
transaction
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
...node.config,
|
|
93
|
+
ccDetail: (result == null ? void 0 : result["x-uid"]) ?? (0, import_utils.uid)()
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare function initActions(app: any): void;
|
|
@@ -0,0 +1,120 @@
|
|
|
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 actions_exports = {};
|
|
38
|
+
__export(actions_exports, {
|
|
39
|
+
initActions: () => initActions
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(actions_exports);
|
|
42
|
+
var import_actions = __toESM(require("@nocobase/actions"));
|
|
43
|
+
const workflowCcTasks = {
|
|
44
|
+
async get(context, next) {
|
|
45
|
+
context.action.mergeParams({
|
|
46
|
+
filter: {
|
|
47
|
+
userId: context.state.currentUser.id
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return import_actions.default.get(context, next);
|
|
51
|
+
},
|
|
52
|
+
async listMine(context, next) {
|
|
53
|
+
context.action.mergeParams({
|
|
54
|
+
filter: {
|
|
55
|
+
userId: context.state.currentUser.id
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return import_actions.default.list(context, next);
|
|
59
|
+
},
|
|
60
|
+
async read(context, next) {
|
|
61
|
+
const { filterByTk } = context.action.params;
|
|
62
|
+
if (filterByTk) {
|
|
63
|
+
const repository = context.app.db.getRepository("workflowCcTasks");
|
|
64
|
+
const item = await repository.findOne({ where: { id: filterByTk } });
|
|
65
|
+
if (!item) {
|
|
66
|
+
return context.throw(404, "Task not found");
|
|
67
|
+
}
|
|
68
|
+
if (item.userId !== context.state.currentUser.id) {
|
|
69
|
+
return context.throw(403, "You do not have permission to access this task");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
context.action.mergeParams({
|
|
73
|
+
filterByTk,
|
|
74
|
+
filter: {
|
|
75
|
+
userId: context.state.currentUser.id,
|
|
76
|
+
status: 0
|
|
77
|
+
},
|
|
78
|
+
values: {
|
|
79
|
+
status: 1,
|
|
80
|
+
readAt: /* @__PURE__ */ new Date()
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return import_actions.default.update(context, next);
|
|
84
|
+
},
|
|
85
|
+
async unread(context, next) {
|
|
86
|
+
const { filterByTk } = context.action.params;
|
|
87
|
+
if (!filterByTk) {
|
|
88
|
+
return context.throw(400, "filterByTk is required for unread action");
|
|
89
|
+
}
|
|
90
|
+
context.action.mergeParams({
|
|
91
|
+
filterByTk,
|
|
92
|
+
filter: {
|
|
93
|
+
userId: context.state.currentUser.id
|
|
94
|
+
},
|
|
95
|
+
values: {
|
|
96
|
+
status: 0,
|
|
97
|
+
readAt: null
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return import_actions.default.update(context, next);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
function make(name, mod) {
|
|
104
|
+
return Object.keys(mod).reduce(
|
|
105
|
+
(result, key) => ({
|
|
106
|
+
...result,
|
|
107
|
+
[`${name}:${key}`]: mod[key]
|
|
108
|
+
}),
|
|
109
|
+
{}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function initActions(app) {
|
|
113
|
+
app.resourceManager.registerActionHandlers({
|
|
114
|
+
...make("workflowCcTasks", workflowCcTasks)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
initActions
|
|
120
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
* This file is part of the NocoBase (R) project.
|
|
11
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
12
|
+
* Authors: NocoBase Team.
|
|
13
|
+
*
|
|
14
|
+
* This program is offered under a commercial license.
|
|
15
|
+
* For more information, see <https://www.nocobase.com/agreement>
|
|
16
|
+
*/
|
|
17
|
+
import { CollectionOptions } from '@nocobase/database';
|
|
18
|
+
declare const _default: CollectionOptions;
|
|
19
|
+
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 workflowCcTasks_exports = {};
|
|
38
|
+
__export(workflowCcTasks_exports, {
|
|
39
|
+
default: () => workflowCcTasks_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(workflowCcTasks_exports);
|
|
42
|
+
var import_workflowCcTasks = __toESM(require("../../common/collections/workflowCcTasks"));
|
|
43
|
+
var workflowCcTasks_default = import_workflowCcTasks.default;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export { default } from './plugin';
|