@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.
@@ -0,0 +1,42 @@
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 server_exports = {};
38
+ __export(server_exports, {
39
+ default: () => import_plugin.default
40
+ });
41
+ module.exports = __toCommonJS(server_exports);
42
+ var import_plugin = __toESM(require("./plugin"));
@@ -0,0 +1,17 @@
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 { Plugin } from '@nocobase/server';
10
+ import { Model } from '@nocobase/database';
11
+ export declare class PluginWorkflowCCServer extends Plugin {
12
+ onRecordSave: (record: Model, { transaction }: {
13
+ transaction: any;
14
+ }) => Promise<void>;
15
+ load(): Promise<void>;
16
+ }
17
+ export default PluginWorkflowCCServer;
@@ -0,0 +1,86 @@
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 plugin_exports = {};
38
+ __export(plugin_exports, {
39
+ PluginWorkflowCCServer: () => PluginWorkflowCCServer,
40
+ default: () => plugin_default
41
+ });
42
+ module.exports = __toCommonJS(plugin_exports);
43
+ var import_server = require("@nocobase/server");
44
+ var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
45
+ var import_CCInstruction = __toESM(require("./CCInstruction"));
46
+ var import_constants = require("../common/constants");
47
+ var import_actions = require("./actions");
48
+ class PluginWorkflowCCServer extends import_server.Plugin {
49
+ onRecordSave = async (record, { transaction }) => {
50
+ if (!record.userId) {
51
+ return;
52
+ }
53
+ const CCModel = record.constructor;
54
+ const pending = await CCModel.count({
55
+ where: {
56
+ userId: record.userId,
57
+ status: import_constants.TASK_STATUS.UNREAD
58
+ },
59
+ transaction
60
+ });
61
+ const all = await CCModel.count({
62
+ where: {
63
+ userId: record.userId
64
+ },
65
+ transaction
66
+ });
67
+ await this.app.pm.get(import_plugin_workflow.default).updateTasksStats(
68
+ record.userId,
69
+ import_constants.TASK_TYPE_CC,
70
+ { pending, all },
71
+ { transaction }
72
+ );
73
+ };
74
+ async load() {
75
+ (0, import_actions.initActions)(this.app);
76
+ this.app.acl.allow("workflowCcTasks", ["list", "listMine", "get", "read", "unread", "readAll"], "loggedIn");
77
+ const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
78
+ workflowPlugin.registerInstruction("cc", import_CCInstruction.default);
79
+ this.app.db.on("workflowCcTasks.afterSave", this.onRecordSave);
80
+ }
81
+ }
82
+ var plugin_default = PluginWorkflowCCServer;
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ PluginWorkflowCCServer
86
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@nocobase/plugin-workflow-cc",
3
+ "displayName": "Workflow: CC",
4
+ "displayName.zh-CN": "工作流:抄送",
5
+ "description": "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.",
6
+ "description.zh-CN": "可将流程中的信息自由配置为查看界面,提供给特定的用户查看,将在待办中心为其生成抄送任务。",
7
+ "homepage": "https://docs.nocobase.com/handbook/workflow-cc",
8
+ "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow-cc",
9
+ "version": "1.8.4",
10
+ "main": "dist/server/index.js",
11
+ "peerDependencies": {
12
+ "@nocobase/actions": "1.x",
13
+ "@nocobase/client": "1.x",
14
+ "@nocobase/plugin-ui-schema-storage": "1.x",
15
+ "@nocobase/plugin-users": "1.x",
16
+ "@nocobase/plugin-workflow": "1.x",
17
+ "@nocobase/server": "1.x",
18
+ "@nocobase/test": "1.x",
19
+ "@nocobase/utils": "1.x"
20
+ },
21
+ "keywords": [
22
+ "Workflow"
23
+ ],
24
+ "gitHead": "0d2ed5a177def253431506fed6b47bac7f281d56"
25
+ }
package/server.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/server';
2
+ export { default } from './dist/server';
package/server.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/server/index.js');