@nocobase/plugin-workflow 0.18.0-alpha.8 → 0.18.0-alpha.9
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
|
@@ -2,21 +2,21 @@ module.exports = {
|
|
|
2
2
|
"react": "18.2.0",
|
|
3
3
|
"antd": "5.12.2",
|
|
4
4
|
"@ant-design/icons": "5.2.6",
|
|
5
|
-
"@nocobase/client": "0.18.0-alpha.
|
|
5
|
+
"@nocobase/client": "0.18.0-alpha.9",
|
|
6
6
|
"react-router-dom": "6.21.0",
|
|
7
|
-
"@nocobase/utils": "0.18.0-alpha.
|
|
7
|
+
"@nocobase/utils": "0.18.0-alpha.9",
|
|
8
8
|
"react-i18next": "11.18.6",
|
|
9
|
-
"@nocobase/database": "0.18.0-alpha.
|
|
10
|
-
"@nocobase/server": "0.18.0-alpha.
|
|
11
|
-
"@nocobase/logger": "0.18.0-alpha.
|
|
12
|
-
"@nocobase/evaluators": "0.18.0-alpha.
|
|
9
|
+
"@nocobase/database": "0.18.0-alpha.9",
|
|
10
|
+
"@nocobase/server": "0.18.0-alpha.9",
|
|
11
|
+
"@nocobase/logger": "0.18.0-alpha.9",
|
|
12
|
+
"@nocobase/evaluators": "0.18.0-alpha.9",
|
|
13
13
|
"@formily/react": "2.3.0",
|
|
14
14
|
"@formily/core": "2.3.0",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
16
|
"@formily/antd-v5": "1.1.9",
|
|
17
|
-
"@nocobase/actions": "0.18.0-alpha.
|
|
17
|
+
"@nocobase/actions": "0.18.0-alpha.9",
|
|
18
18
|
"sequelize": "6.35.2",
|
|
19
|
-
"@nocobase/plugin-workflow-test": "0.18.0-alpha.
|
|
20
|
-
"@nocobase/test": "0.18.0-alpha.
|
|
19
|
+
"@nocobase/plugin-workflow-test": "0.18.0-alpha.9",
|
|
20
|
+
"@nocobase/test": "0.18.0-alpha.9",
|
|
21
21
|
"dayjs": "1.11.10"
|
|
22
22
|
};
|
|
@@ -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":"
|
|
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-01-03T02:11:26.806Z"}
|
|
@@ -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":"
|
|
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-01-03T02:11:26.452Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export default class WorkflowPlugin extends Plugin {
|
|
|
15
15
|
private executing;
|
|
16
16
|
private pending;
|
|
17
17
|
private events;
|
|
18
|
+
private eventsCount;
|
|
18
19
|
private loggerCache;
|
|
20
|
+
private meter;
|
|
19
21
|
getLogger(workflowId: ID): Logger;
|
|
20
22
|
onBeforeSave: (instance: WorkflowModel, options: any) => Promise<void>;
|
|
21
23
|
registerTrigger<T extends Trigger>(type: string, trigger: T | {
|
package/dist/server/Plugin.js
CHANGED
|
@@ -55,7 +55,9 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
55
55
|
executing = null;
|
|
56
56
|
pending = [];
|
|
57
57
|
events = [];
|
|
58
|
+
eventsCount = 0;
|
|
58
59
|
loggerCache;
|
|
60
|
+
meter = null;
|
|
59
61
|
getLogger(workflowId) {
|
|
60
62
|
const now = /* @__PURE__ */ new Date();
|
|
61
63
|
const date = `${now.getFullYear()}-${`0${now.getMonth() + 1}`.slice(-2)}-${`0${now.getDate()}`.slice(-2)}`;
|
|
@@ -159,6 +161,11 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
159
161
|
logger.end();
|
|
160
162
|
}
|
|
161
163
|
});
|
|
164
|
+
this.meter = this.app.telemetry.metric.getMeter();
|
|
165
|
+
const counter = this.meter.createObservableGauge("workflow.events.counter");
|
|
166
|
+
counter.addCallback((result) => {
|
|
167
|
+
result.observe(this.eventsCount);
|
|
168
|
+
});
|
|
162
169
|
this.app.acl.registerSnippet({
|
|
163
170
|
name: `pm.${this.name}.workflows`,
|
|
164
171
|
actions: [
|
|
@@ -248,6 +255,7 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
248
255
|
return;
|
|
249
256
|
}
|
|
250
257
|
this.events.push([workflow, context, options]);
|
|
258
|
+
this.eventsCount = this.events.length;
|
|
251
259
|
logger.info(`new event triggered, now events: ${this.events.length}`);
|
|
252
260
|
logger.debug(`event data:`, {
|
|
253
261
|
data: context
|
|
@@ -286,8 +294,8 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
286
294
|
return null;
|
|
287
295
|
}
|
|
288
296
|
}
|
|
289
|
-
|
|
290
|
-
const
|
|
297
|
+
return this.db.sequelize.transaction(async (transaction) => {
|
|
298
|
+
const execution = await workflow.createExecution(
|
|
291
299
|
{
|
|
292
300
|
context,
|
|
293
301
|
key: workflow.key,
|
|
@@ -295,6 +303,7 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
295
303
|
},
|
|
296
304
|
{ transaction }
|
|
297
305
|
);
|
|
306
|
+
this.getLogger(workflow.id).info(`execution of workflow ${workflow.id} created as ${execution.id}`);
|
|
298
307
|
await workflow.increment(["executed", "allExecuted"], { transaction });
|
|
299
308
|
if (this.db.options.dialect !== "postgres") {
|
|
300
309
|
await workflow.reload({ transaction });
|
|
@@ -310,17 +319,13 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
310
319
|
transaction
|
|
311
320
|
}
|
|
312
321
|
);
|
|
313
|
-
|
|
314
|
-
return
|
|
322
|
+
execution.workflow = workflow;
|
|
323
|
+
return execution;
|
|
315
324
|
});
|
|
316
|
-
this.getLogger(workflow.id).info(`execution of workflow ${workflow.id} created as ${execution.id}`);
|
|
317
|
-
if (!this.executing && !this.pending.length) {
|
|
318
|
-
this.pending.push([execution]);
|
|
319
|
-
}
|
|
320
|
-
return execution;
|
|
321
325
|
}
|
|
322
326
|
prepare = async () => {
|
|
323
327
|
const event = this.events.shift();
|
|
328
|
+
this.eventsCount = this.events.length;
|
|
324
329
|
if (!event) {
|
|
325
330
|
this.getLogger("dispatcher").warn(`events queue is empty, no need to prepare`);
|
|
326
331
|
return;
|
|
@@ -328,7 +333,10 @@ class WorkflowPlugin extends import_server.Plugin {
|
|
|
328
333
|
const logger = this.getLogger(event[0].id);
|
|
329
334
|
logger.info(`preparing execution for event`);
|
|
330
335
|
try {
|
|
331
|
-
await this.createExecution(event);
|
|
336
|
+
const execution = await this.createExecution(event);
|
|
337
|
+
if (!this.executing && !this.pending.length) {
|
|
338
|
+
this.pending.push([execution]);
|
|
339
|
+
}
|
|
332
340
|
} catch (err) {
|
|
333
341
|
logger.error(`failed to create execution: ${err.message}`, err);
|
|
334
342
|
}
|
package/package.json
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful workflow plugin designed to support business process management and automation.",
|
|
6
6
|
"description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
|
|
7
|
-
"version": "0.18.0-alpha.
|
|
7
|
+
"version": "0.18.0-alpha.9",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@nocobase/plugin-workflow-test": "0.18.0-alpha.
|
|
11
|
+
"@nocobase/plugin-workflow-test": "0.18.0-alpha.9"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@ant-design/icons": "5.x",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@nocobase/test": "0.x",
|
|
44
44
|
"@nocobase/utils": "0.x"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "34ca0df4eede2e83fc86297b0fe19eba970e2b1b"
|
|
47
47
|
}
|