@nocobase/plugin-workflow 1.7.0-beta.30 → 1.7.0-beta.31
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/{3d24e559cfbba5d8.js → 0aa108b462117c9a.js} +1 -1
- package/dist/client/{f4370978c40502d7.js → 37f781064021321f.js} +1 -1
- package/dist/client/WorkflowTasks.d.ts +2 -1
- package/dist/client/index.js +1 -1
- package/dist/common/collections/userWorkflowTasks.d.ts +37 -0
- package/dist/{server/actions/workflowTasks.js → common/collections/userWorkflowTasks.js} +37 -19
- package/dist/externalVersion.js +10 -10
- package/dist/locale/zh-CN.json +2 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Plugin.d.ts +5 -2
- package/dist/server/Plugin.js +33 -37
- package/dist/server/Processor.js +2 -0
- package/dist/server/actions/index.js +2 -2
- package/dist/server/actions/{workflowTasks.d.ts → userWorkflowTasks.d.ts} +1 -1
- package/dist/server/actions/userWorkflowTasks.js +54 -0
- package/dist/server/collections/userWorkflowTasks.d.ts +11 -0
- package/dist/server/collections/userWorkflowTasks.js +43 -0
- package/package.json +3 -3
- package/dist/client/nodes/output.d.ts +0 -31
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
declare const _default: {
|
|
10
|
+
dumpRules: {
|
|
11
|
+
group: string;
|
|
12
|
+
};
|
|
13
|
+
migrationRules: string[];
|
|
14
|
+
name: string;
|
|
15
|
+
shared: boolean;
|
|
16
|
+
fields: ({
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
foreignKey?: undefined;
|
|
20
|
+
defaultValue?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
foreignKey: string;
|
|
25
|
+
defaultValue?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
type: string;
|
|
28
|
+
name: string;
|
|
29
|
+
defaultValue: {};
|
|
30
|
+
foreignKey?: undefined;
|
|
31
|
+
})[];
|
|
32
|
+
indexes: {
|
|
33
|
+
unique: boolean;
|
|
34
|
+
fields: string[];
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
export default _default;
|
|
@@ -24,24 +24,42 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var
|
|
28
|
-
__export(
|
|
29
|
-
|
|
27
|
+
var userWorkflowTasks_exports = {};
|
|
28
|
+
__export(userWorkflowTasks_exports, {
|
|
29
|
+
default: () => userWorkflowTasks_default
|
|
30
30
|
});
|
|
31
|
-
module.exports = __toCommonJS(
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
module.exports = __toCommonJS(userWorkflowTasks_exports);
|
|
32
|
+
var userWorkflowTasks_default = {
|
|
33
|
+
dumpRules: {
|
|
34
|
+
group: "log"
|
|
35
|
+
},
|
|
36
|
+
migrationRules: ["schema-only"],
|
|
37
|
+
name: "userWorkflowTasks",
|
|
38
|
+
shared: true,
|
|
39
|
+
fields: [
|
|
40
|
+
{
|
|
41
|
+
name: "userId",
|
|
42
|
+
type: "bigInt"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "user",
|
|
46
|
+
type: "belongsTo",
|
|
47
|
+
foreignKey: "userId"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "type",
|
|
51
|
+
type: "string"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "json",
|
|
55
|
+
name: "stats",
|
|
56
|
+
defaultValue: {}
|
|
40
57
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
],
|
|
59
|
+
indexes: [
|
|
60
|
+
{
|
|
61
|
+
unique: true,
|
|
62
|
+
fields: ["userId", "type"]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
};
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,24 +11,24 @@ module.exports = {
|
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"@formily/core": "2.3.0",
|
|
13
13
|
"@formily/react": "2.3.0",
|
|
14
|
-
"@nocobase/client": "1.7.0-beta.
|
|
15
|
-
"@nocobase/utils": "1.7.0-beta.
|
|
14
|
+
"@nocobase/client": "1.7.0-beta.31",
|
|
15
|
+
"@nocobase/utils": "1.7.0-beta.31",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
18
|
"react-router-dom": "6.28.1",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
21
|
"sequelize": "6.35.2",
|
|
22
|
-
"@nocobase/database": "1.7.0-beta.
|
|
23
|
-
"@nocobase/server": "1.7.0-beta.
|
|
24
|
-
"@nocobase/data-source-manager": "1.7.0-beta.
|
|
25
|
-
"@nocobase/logger": "1.7.0-beta.
|
|
26
|
-
"@nocobase/evaluators": "1.7.0-beta.
|
|
22
|
+
"@nocobase/database": "1.7.0-beta.31",
|
|
23
|
+
"@nocobase/server": "1.7.0-beta.31",
|
|
24
|
+
"@nocobase/data-source-manager": "1.7.0-beta.31",
|
|
25
|
+
"@nocobase/logger": "1.7.0-beta.31",
|
|
26
|
+
"@nocobase/evaluators": "1.7.0-beta.31",
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"@formily/reactive": "2.3.0",
|
|
29
29
|
"@formily/shared": "2.3.2",
|
|
30
|
-
"@nocobase/actions": "1.7.0-beta.
|
|
30
|
+
"@nocobase/actions": "1.7.0-beta.31",
|
|
31
31
|
"dayjs": "1.11.13",
|
|
32
|
-
"@nocobase/plugin-workflow-test": "1.7.0-beta.
|
|
33
|
-
"@nocobase/test": "1.7.0-beta.
|
|
32
|
+
"@nocobase/plugin-workflow-test": "1.7.0-beta.31",
|
|
33
|
+
"@nocobase/test": "1.7.0-beta.31"
|
|
34
34
|
};
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"Copy to new version": "复制到新版本",
|
|
16
16
|
"Duplicate": "复制",
|
|
17
17
|
"Duplicate to new workflow": "复制为新工作流",
|
|
18
|
-
"
|
|
18
|
+
"This is a main version, delete it will cause the whole workflow to be deleted (including all other revisions).": "当前是主版本,删除将导致整个流程被删除(包括所有其他版本)。",
|
|
19
|
+
"Current version will be deleted (without affecting other versions).": "当前版本将被删除(不影响其他版本)。",
|
|
19
20
|
"Execute manually": "手动执行",
|
|
20
21
|
"The trigger is not configured correctly, please check the trigger configuration.": "触发器配置不正确,请检查触发器配置。",
|
|
21
22
|
"This type of trigger has not been supported to be executed manually.": "该类型的触发器暂未支持手动执行。",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-05-
|
|
1
|
+
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-05-15T09:27:50.529Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-05-
|
|
1
|
+
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-05-15T09:27:50.183Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2025-05-
|
|
1
|
+
{"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2025-05-15T09:27:50.000Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import Processor from './Processor';
|
|
|
15
15
|
import { CustomFunction } from './functions';
|
|
16
16
|
import Trigger from './triggers';
|
|
17
17
|
import { InstructionInterface } from './instructions';
|
|
18
|
-
import type { ExecutionModel, WorkflowModel
|
|
18
|
+
import type { ExecutionModel, WorkflowModel } from './types';
|
|
19
19
|
type ID = number | string;
|
|
20
20
|
export type EventOptions = {
|
|
21
21
|
eventKey?: string;
|
|
@@ -98,6 +98,9 @@ export default class PluginWorkflowServer extends Plugin {
|
|
|
98
98
|
/**
|
|
99
99
|
* @experimental
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
updateTasksStats(userId: number, type: string, stats: {
|
|
102
|
+
pending: number;
|
|
103
|
+
all: number;
|
|
104
|
+
}, { transaction }: Transactionable): Promise<void>;
|
|
102
105
|
}
|
|
103
106
|
export {};
|
package/dist/server/Plugin.js
CHANGED
|
@@ -61,7 +61,6 @@ var import_DestroyInstruction = __toESM(require("./instructions/DestroyInstructi
|
|
|
61
61
|
var import_QueryInstruction = __toESM(require("./instructions/QueryInstruction"));
|
|
62
62
|
var import_UpdateInstruction = __toESM(require("./instructions/UpdateInstruction"));
|
|
63
63
|
var import_WorkflowRepository = __toESM(require("./repositories/WorkflowRepository"));
|
|
64
|
-
var import_WorkflowTasksRepository = __toESM(require("./repositories/WorkflowTasksRepository"));
|
|
65
64
|
class PluginWorkflowServer extends import_server.Plugin {
|
|
66
65
|
instructions = new import_utils.Registry();
|
|
67
66
|
triggers = new import_utils.Registry();
|
|
@@ -76,7 +75,10 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
76
75
|
loggerCache;
|
|
77
76
|
meter = null;
|
|
78
77
|
checker = null;
|
|
79
|
-
onBeforeSave = async (instance, { transaction }) => {
|
|
78
|
+
onBeforeSave = async (instance, { transaction, cycling }) => {
|
|
79
|
+
if (cycling) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
80
82
|
const Model = instance.constructor;
|
|
81
83
|
if (!instance.key) {
|
|
82
84
|
instance.set("key", (0, import_utils.uid)());
|
|
@@ -96,13 +98,12 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
96
98
|
});
|
|
97
99
|
if (!previous) {
|
|
98
100
|
instance.set("current", true);
|
|
99
|
-
}
|
|
100
|
-
if (instance.current && previous) {
|
|
101
|
+
} else if (instance.current) {
|
|
101
102
|
await previous.update(
|
|
102
103
|
{ enabled: false, current: null },
|
|
103
104
|
{
|
|
104
105
|
transaction,
|
|
105
|
-
|
|
106
|
+
cycling: true
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
109
|
this.toggle(previous, false, { transaction });
|
|
@@ -168,6 +169,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
168
169
|
});
|
|
169
170
|
this.getLogger("dispatcher").info("(starting) check for queueing executions");
|
|
170
171
|
this.dispatch();
|
|
172
|
+
this.ready = true;
|
|
171
173
|
};
|
|
172
174
|
onBeforeStop = async () => {
|
|
173
175
|
for (const workflow of this.enabledCache.values()) {
|
|
@@ -274,8 +276,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
274
276
|
}
|
|
275
277
|
async beforeLoad() {
|
|
276
278
|
this.db.registerRepositories({
|
|
277
|
-
WorkflowRepository: import_WorkflowRepository.default
|
|
278
|
-
WorkflowTasksRepository: import_WorkflowTasksRepository.default
|
|
279
|
+
WorkflowRepository: import_WorkflowRepository.default
|
|
279
280
|
});
|
|
280
281
|
const PluginRepo = this.db.getRepository("applicationPlugins");
|
|
281
282
|
const pluginRecord = await PluginRepo.findOne({
|
|
@@ -325,15 +326,8 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
325
326
|
name: "ui.workflows",
|
|
326
327
|
actions: ["workflows:list"]
|
|
327
328
|
});
|
|
328
|
-
this.app.acl.allow("
|
|
329
|
+
this.app.acl.allow("userWorkflowTasks", "listMine", "loggedIn");
|
|
329
330
|
this.app.acl.allow("*", ["trigger"], "loggedIn");
|
|
330
|
-
this.db.addMigrations({
|
|
331
|
-
namespace: this.name,
|
|
332
|
-
directory: import_path.default.resolve(__dirname, "migrations"),
|
|
333
|
-
context: {
|
|
334
|
-
plugin: this
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
331
|
db.on("workflows.beforeSave", this.onBeforeSave);
|
|
338
332
|
db.on("workflows.afterCreate", this.onAfterCreate);
|
|
339
333
|
db.on("workflows.afterUpdate", this.onAfterUpdate);
|
|
@@ -679,36 +673,38 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
679
673
|
/**
|
|
680
674
|
* @experimental
|
|
681
675
|
*/
|
|
682
|
-
async
|
|
676
|
+
async updateTasksStats(userId, type, stats = { pending: 0, all: 0 }, { transaction }) {
|
|
683
677
|
const { db } = this.app;
|
|
684
|
-
const repository = db.getRepository("
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
678
|
+
const repository = db.getRepository("userWorkflowTasks");
|
|
679
|
+
let record = await repository.findOne({
|
|
680
|
+
filter: {
|
|
681
|
+
userId,
|
|
682
|
+
type
|
|
683
|
+
},
|
|
684
|
+
transaction
|
|
685
|
+
});
|
|
686
|
+
if (record) {
|
|
687
|
+
await record.update(
|
|
688
|
+
{
|
|
689
|
+
stats
|
|
690
|
+
},
|
|
691
|
+
{ transaction }
|
|
692
|
+
);
|
|
691
693
|
} else {
|
|
692
|
-
await repository.
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
record = await repository.create({
|
|
695
|
+
values: {
|
|
696
|
+
userId,
|
|
697
|
+
type,
|
|
698
|
+
stats
|
|
696
699
|
},
|
|
697
700
|
transaction
|
|
698
701
|
});
|
|
699
702
|
}
|
|
700
|
-
if (
|
|
701
|
-
const counts = await repository.countAll({
|
|
702
|
-
where: {
|
|
703
|
-
userId: task.userId,
|
|
704
|
-
workflowId: { [import_database.Op.ne]: null }
|
|
705
|
-
},
|
|
706
|
-
transaction
|
|
707
|
-
}) || [];
|
|
703
|
+
if (userId) {
|
|
708
704
|
this.app.emit("ws:sendToTag", {
|
|
709
705
|
tagKey: "userId",
|
|
710
|
-
tagValue: `${
|
|
711
|
-
message: { type: "workflow:tasks:updated", payload:
|
|
706
|
+
tagValue: `${userId}`,
|
|
707
|
+
message: { type: "workflow:tasks:updated", payload: record.get() }
|
|
712
708
|
});
|
|
713
709
|
}
|
|
714
710
|
}
|
package/dist/server/Processor.js
CHANGED
|
@@ -118,11 +118,13 @@ class Processor {
|
|
|
118
118
|
execution.workflow = plugin.enabledCache.get(execution.workflowId) || await execution.getWorkflow({ transaction });
|
|
119
119
|
}
|
|
120
120
|
const nodes = await execution.workflow.getNodes({ transaction });
|
|
121
|
+
execution.workflow.nodes = nodes;
|
|
121
122
|
this.makeNodes(nodes);
|
|
122
123
|
const jobs = await execution.getJobs({
|
|
123
124
|
order: [["id", "ASC"]],
|
|
124
125
|
transaction
|
|
125
126
|
});
|
|
127
|
+
execution.jobs = jobs;
|
|
126
128
|
this.makeJobs(jobs);
|
|
127
129
|
}
|
|
128
130
|
async start() {
|
|
@@ -42,7 +42,7 @@ module.exports = __toCommonJS(actions_exports);
|
|
|
42
42
|
var workflows = __toESM(require("./workflows"));
|
|
43
43
|
var nodes = __toESM(require("./nodes"));
|
|
44
44
|
var executions = __toESM(require("./executions"));
|
|
45
|
-
var
|
|
45
|
+
var userWorkflowTasks = __toESM(require("./userWorkflowTasks"));
|
|
46
46
|
function make(name, mod) {
|
|
47
47
|
return Object.keys(mod).reduce(
|
|
48
48
|
(result, key) => ({
|
|
@@ -64,6 +64,6 @@ function actions_default({ app }) {
|
|
|
64
64
|
test: nodes.test
|
|
65
65
|
}),
|
|
66
66
|
...make("executions", executions),
|
|
67
|
-
...make("
|
|
67
|
+
...make("userWorkflowTasks", userWorkflowTasks)
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Context } from '@nocobase/actions';
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function listMine(context: Context, next: any): Promise<void>;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 userWorkflowTasks_exports = {};
|
|
38
|
+
__export(userWorkflowTasks_exports, {
|
|
39
|
+
listMine: () => listMine
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(userWorkflowTasks_exports);
|
|
42
|
+
var import_actions = __toESM(require("@nocobase/actions"));
|
|
43
|
+
async function listMine(context, next) {
|
|
44
|
+
context.action.mergeParams({
|
|
45
|
+
filter: {
|
|
46
|
+
userId: context.state.currentUser.id
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return import_actions.default.list(context, next);
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
listMine
|
|
54
|
+
});
|
|
@@ -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 userWorkflowTasks_exports = {};
|
|
38
|
+
__export(userWorkflowTasks_exports, {
|
|
39
|
+
default: () => userWorkflowTasks_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(userWorkflowTasks_exports);
|
|
42
|
+
var import_userWorkflowTasks = __toESM(require("../../common/collections/userWorkflowTasks"));
|
|
43
|
+
var userWorkflowTasks_default = import_userWorkflowTasks.default;
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
6
6
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
7
|
-
"version": "1.7.0-beta.
|
|
7
|
+
"version": "1.7.0-beta.31",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
11
11
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/plugin-workflow-test": "1.7.0-beta.
|
|
13
|
+
"@nocobase/plugin-workflow-test": "1.7.0-beta.31"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@nocobase/test": "1.x",
|
|
47
47
|
"@nocobase/utils": "1.x"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "84bf8bcfeeaf3a05086e24cef00507ca209ac3c5",
|
|
50
50
|
"keywords": [
|
|
51
51
|
"Workflow"
|
|
52
52
|
]
|
|
@@ -1,31 +0,0 @@
|
|
|
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 '.';
|
|
10
|
-
import { WorkflowVariableInput } from '../variable';
|
|
11
|
-
export default class extends Instruction {
|
|
12
|
-
title: string;
|
|
13
|
-
type: string;
|
|
14
|
-
group: string;
|
|
15
|
-
description: string;
|
|
16
|
-
fieldset: {
|
|
17
|
-
result: {
|
|
18
|
-
type: string;
|
|
19
|
-
title: string;
|
|
20
|
-
'x-decorator': string;
|
|
21
|
-
'x-component': string;
|
|
22
|
-
'x-component-props': {
|
|
23
|
-
useTypedConstant: boolean;
|
|
24
|
-
};
|
|
25
|
-
required: boolean;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
components: {
|
|
29
|
-
WorkflowVariableInput: typeof WorkflowVariableInput;
|
|
30
|
-
};
|
|
31
|
-
}
|