@nocobase/plugin-workflow 1.5.0-alpha.5 → 1.5.0-beta.2
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/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.5.0-
|
|
15
|
-
"@nocobase/utils": "1.5.0-
|
|
14
|
+
"@nocobase/client": "1.5.0-beta.2",
|
|
15
|
+
"@nocobase/utils": "1.5.0-beta.2",
|
|
16
16
|
"antd": "5.12.8",
|
|
17
17
|
"@ant-design/icons": "5.2.6",
|
|
18
18
|
"react-router-dom": "6.21.0",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
20
|
"@formily/shared": "2.3.2",
|
|
21
21
|
"lodash": "4.17.21",
|
|
22
|
-
"@nocobase/database": "1.5.0-
|
|
23
|
-
"@nocobase/server": "1.5.0-
|
|
24
|
-
"@nocobase/logger": "1.5.0-
|
|
25
|
-
"@nocobase/evaluators": "1.5.0-
|
|
22
|
+
"@nocobase/database": "1.5.0-beta.2",
|
|
23
|
+
"@nocobase/server": "1.5.0-beta.2",
|
|
24
|
+
"@nocobase/logger": "1.5.0-beta.2",
|
|
25
|
+
"@nocobase/evaluators": "1.5.0-beta.2",
|
|
26
26
|
"@formily/antd-v5": "1.1.9",
|
|
27
27
|
"@formily/reactive": "2.3.0",
|
|
28
|
-
"@nocobase/actions": "1.5.0-
|
|
28
|
+
"@nocobase/actions": "1.5.0-beta.2",
|
|
29
29
|
"dayjs": "1.11.10",
|
|
30
|
-
"@nocobase/data-source-manager": "1.5.0-
|
|
30
|
+
"@nocobase/data-source-manager": "1.5.0-beta.2",
|
|
31
31
|
"sequelize": "6.35.2",
|
|
32
|
-
"@nocobase/plugin-workflow-test": "1.5.0-
|
|
33
|
-
"@nocobase/test": "1.5.0-
|
|
32
|
+
"@nocobase/plugin-workflow-test": "1.5.0-beta.2",
|
|
33
|
+
"@nocobase/test": "1.5.0-beta.2"
|
|
34
34
|
};
|
|
@@ -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":"2024-
|
|
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":"2024-12-06T09:00:37.111Z"}
|
|
@@ -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":"2024-
|
|
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":"2024-12-06T09:00:36.725Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
package/dist/server/Plugin.js
CHANGED
|
@@ -71,7 +71,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
71
71
|
loggerCache;
|
|
72
72
|
meter = null;
|
|
73
73
|
checker = null;
|
|
74
|
-
onBeforeSave = async (instance,
|
|
74
|
+
onBeforeSave = async (instance, options) => {
|
|
75
75
|
const Model = instance.constructor;
|
|
76
76
|
if (instance.enabled) {
|
|
77
77
|
instance.set("current", true);
|
|
@@ -80,7 +80,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
80
80
|
where: {
|
|
81
81
|
key: instance.key
|
|
82
82
|
},
|
|
83
|
-
transaction
|
|
83
|
+
transaction: options.transaction
|
|
84
84
|
});
|
|
85
85
|
if (!count) {
|
|
86
86
|
instance.set("current", true);
|
|
@@ -97,37 +97,39 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
97
97
|
[import_database.Op.ne]: instance.id
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
transaction
|
|
100
|
+
transaction: options.transaction
|
|
101
101
|
});
|
|
102
102
|
if (previous) {
|
|
103
103
|
await previous.update(
|
|
104
104
|
{ enabled: false, current: null },
|
|
105
105
|
{
|
|
106
|
-
transaction,
|
|
106
|
+
transaction: options.transaction,
|
|
107
107
|
hooks: false
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
|
-
this.toggle(previous, false
|
|
110
|
+
this.toggle(previous, false);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
async
|
|
113
|
+
async onSync(message) {
|
|
114
114
|
if (message.type === "statusChange") {
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const workflowId = Number.parseInt(message.workflowId, 10);
|
|
116
|
+
const enabled = Number.parseInt(message.enabled, 10);
|
|
117
|
+
if (enabled) {
|
|
118
|
+
let workflow = this.enabledCache.get(workflowId);
|
|
117
119
|
if (workflow) {
|
|
118
120
|
await workflow.reload();
|
|
119
121
|
} else {
|
|
120
122
|
workflow = await this.db.getRepository("workflows").findOne({
|
|
121
|
-
filterByTk:
|
|
123
|
+
filterByTk: workflowId
|
|
122
124
|
});
|
|
123
125
|
}
|
|
124
126
|
if (workflow) {
|
|
125
|
-
this.toggle(workflow, true,
|
|
127
|
+
this.toggle(workflow, true, true);
|
|
126
128
|
}
|
|
127
129
|
} else {
|
|
128
|
-
const workflow = this.enabledCache.get(
|
|
130
|
+
const workflow = this.enabledCache.get(workflowId);
|
|
129
131
|
if (workflow) {
|
|
130
|
-
this.toggle(workflow, false,
|
|
132
|
+
this.toggle(workflow, false, true);
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
}
|
|
@@ -246,19 +248,13 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
246
248
|
}
|
|
247
249
|
});
|
|
248
250
|
db.on("workflows.beforeSave", this.onBeforeSave);
|
|
249
|
-
db.on("workflows.afterCreate", (model
|
|
251
|
+
db.on("workflows.afterCreate", (model) => {
|
|
250
252
|
if (model.enabled) {
|
|
251
|
-
this.toggle(model
|
|
253
|
+
this.toggle(model);
|
|
252
254
|
}
|
|
253
255
|
});
|
|
254
|
-
db.on(
|
|
255
|
-
|
|
256
|
-
(model, { transaction }) => this.toggle(model, model.enabled, { transaction })
|
|
257
|
-
);
|
|
258
|
-
db.on(
|
|
259
|
-
"workflows.afterDestroy",
|
|
260
|
-
(model, { transaction }) => this.toggle(model, false, { transaction })
|
|
261
|
-
);
|
|
256
|
+
db.on("workflows.afterUpdate", (model) => this.toggle(model));
|
|
257
|
+
db.on("workflows.beforeDestroy", (model) => this.toggle(model, false));
|
|
262
258
|
this.app.on("afterStart", async () => {
|
|
263
259
|
this.app.setMaintainingMessage("check for not started executions");
|
|
264
260
|
this.ready = true;
|
|
@@ -267,7 +263,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
267
263
|
filter: { enabled: true }
|
|
268
264
|
});
|
|
269
265
|
workflows.forEach((workflow) => {
|
|
270
|
-
this.toggle(workflow
|
|
266
|
+
this.toggle(workflow);
|
|
271
267
|
});
|
|
272
268
|
this.checker = setInterval(() => {
|
|
273
269
|
this.dispatch();
|
|
@@ -276,7 +272,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
276
272
|
});
|
|
277
273
|
this.app.on("beforeStop", async () => {
|
|
278
274
|
for (const workflow of this.enabledCache.values()) {
|
|
279
|
-
this.toggle(workflow, false
|
|
275
|
+
this.toggle(workflow, false);
|
|
280
276
|
}
|
|
281
277
|
this.ready = false;
|
|
282
278
|
if (this.events.length) {
|
|
@@ -290,7 +286,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
290
286
|
}
|
|
291
287
|
});
|
|
292
288
|
}
|
|
293
|
-
toggle(workflow, enable,
|
|
289
|
+
toggle(workflow, enable, silent = false) {
|
|
294
290
|
const type = workflow.get("type");
|
|
295
291
|
const trigger = this.triggers.get(type);
|
|
296
292
|
if (!trigger) {
|
|
@@ -310,22 +306,15 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
310
306
|
this.enabledCache.delete(workflow.id);
|
|
311
307
|
}
|
|
312
308
|
if (!silent) {
|
|
313
|
-
this.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
},
|
|
319
|
-
{ transaction }
|
|
320
|
-
);
|
|
309
|
+
this.sync({
|
|
310
|
+
type: "statusChange",
|
|
311
|
+
workflowId: `${workflow.id}`,
|
|
312
|
+
enabled: `${Number(next)}`
|
|
313
|
+
});
|
|
321
314
|
}
|
|
322
315
|
}
|
|
323
316
|
trigger(workflow, context, options = {}) {
|
|
324
317
|
const logger = this.getLogger(workflow.id);
|
|
325
|
-
if (!workflow.enabled) {
|
|
326
|
-
logger.warn(`workflow ${workflow.id} is not enabled, event will be ignored`);
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
318
|
if (!this.ready) {
|
|
330
319
|
logger.warn(`app is not ready, event of workflow ${workflow.id} will be ignored`);
|
|
331
320
|
logger.debug(`ignored event data:`, context);
|
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.5.0-
|
|
7
|
+
"version": "1.5.0-beta.2",
|
|
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.5.0-
|
|
13
|
+
"@nocobase/plugin-workflow-test": "1.5.0-beta.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@nocobase/test": "1.x",
|
|
45
45
|
"@nocobase/utils": "1.x"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "8a9c29fdac5c6295dcc7abf00c3fa81bd9e01a36",
|
|
48
48
|
"keywords": [
|
|
49
49
|
"Workflow"
|
|
50
50
|
]
|