@nocobase/plugin-workflow 2.2.0-beta.16 → 2.2.0-beta.17
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/index.js +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/common/collections/jobs.js +2 -2
- package/dist/externalVersion.js +13 -13
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/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 +1 -1
- package/dist/server/Plugin.js +1 -1
- package/dist/server/Processor.d.ts +1 -0
- package/dist/server/Processor.js +26 -11
- package/dist/server/RunningExecutionRegistry.d.ts +2 -2
- package/dist/server/RunningExecutionRegistry.js +21 -6
- package/dist/server/actions/workflows.js +1 -1
- package/dist/server/types/Job.d.ts +1 -0
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -11,33 +11,33 @@ module.exports = {
|
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"@formily/core": "2.3.7",
|
|
13
13
|
"@formily/react": "2.3.7",
|
|
14
|
-
"@nocobase/client": "2.2.0-beta.
|
|
15
|
-
"@nocobase/utils": "2.2.0-beta.
|
|
14
|
+
"@nocobase/client": "2.2.0-beta.17",
|
|
15
|
+
"@nocobase/utils": "2.2.0-beta.17",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
|
-
"@nocobase/flow-engine": "2.2.0-beta.
|
|
18
|
+
"@nocobase/flow-engine": "2.2.0-beta.17",
|
|
19
19
|
"ahooks": "3.7.8",
|
|
20
20
|
"react-router-dom": "6.30.1",
|
|
21
21
|
"react-i18next": "11.18.6",
|
|
22
22
|
"lodash": "4.18.1",
|
|
23
23
|
"@dnd-kit/core": "6.1.0",
|
|
24
24
|
"@formily/shared": "2.3.7",
|
|
25
|
-
"@nocobase/plugin-mobile": "2.2.0-beta.
|
|
26
|
-
"@nocobase/client-v2": "2.2.0-beta.
|
|
25
|
+
"@nocobase/plugin-mobile": "2.2.0-beta.17",
|
|
26
|
+
"@nocobase/client-v2": "2.2.0-beta.17",
|
|
27
27
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/server": "2.2.0-beta.
|
|
29
|
-
"@nocobase/database": "2.2.0-beta.
|
|
30
|
-
"@nocobase/data-source-manager": "2.2.0-beta.
|
|
31
|
-
"@nocobase/logger": "2.2.0-beta.
|
|
32
|
-
"@nocobase/evaluators": "2.2.0-beta.
|
|
28
|
+
"@nocobase/server": "2.2.0-beta.17",
|
|
29
|
+
"@nocobase/database": "2.2.0-beta.17",
|
|
30
|
+
"@nocobase/data-source-manager": "2.2.0-beta.17",
|
|
31
|
+
"@nocobase/logger": "2.2.0-beta.17",
|
|
32
|
+
"@nocobase/evaluators": "2.2.0-beta.17",
|
|
33
33
|
"@formily/antd-v5": "1.2.3",
|
|
34
34
|
"@formily/reactive": "2.3.7",
|
|
35
35
|
"@emotion/css": "11.13.0",
|
|
36
36
|
"@formily/json-schema": "2.3.7",
|
|
37
37
|
"antd-style": "3.7.1",
|
|
38
38
|
"dayjs": "1.11.13",
|
|
39
|
-
"@nocobase/actions": "2.2.0-beta.
|
|
40
|
-
"@nocobase/plugin-workflow-test": "2.2.0-beta.
|
|
41
|
-
"@nocobase/test": "2.2.0-beta.
|
|
39
|
+
"@nocobase/actions": "2.2.0-beta.17",
|
|
40
|
+
"@nocobase/plugin-workflow-test": "2.2.0-beta.17",
|
|
41
|
+
"@nocobase/test": "2.2.0-beta.17",
|
|
42
42
|
"@dnd-kit/sortable": "7.0.2"
|
|
43
43
|
};
|
|
@@ -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":"2026-
|
|
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":"2026-08-10T16:51:19.677Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-
|
|
1
|
+
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-08-10T16:51:19.396Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/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","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-
|
|
1
|
+
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/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","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-08-10T16:51:18.632Z"}
|
|
@@ -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":"2026-
|
|
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":"2026-08-10T16:51:18.462Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export default class PluginWorkflowServer extends Plugin {
|
|
|
70
70
|
abortExecutionIfExpired(execution: ExecutionModel, options?: {
|
|
71
71
|
transaction?: Transaction;
|
|
72
72
|
}): Promise<boolean>;
|
|
73
|
-
registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): void;
|
|
73
|
+
registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): () => void;
|
|
74
74
|
unregisterRunningExecution(executionId: number | string): void;
|
|
75
75
|
abortRunningExecution(executionId: number | string, reason?: string): boolean;
|
|
76
76
|
/**
|
package/dist/server/Plugin.js
CHANGED
|
@@ -225,7 +225,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
225
225
|
return this.timeoutManager.abortExecutionIfExpired(execution, options);
|
|
226
226
|
}
|
|
227
227
|
registerRunningExecution(executionId, abort) {
|
|
228
|
-
this.runningExecutionRegistry.register(executionId, { abort });
|
|
228
|
+
return this.runningExecutionRegistry.register(executionId, { abort });
|
|
229
229
|
}
|
|
230
230
|
unregisterRunningExecution(executionId) {
|
|
231
231
|
this.runningExecutionRegistry.unregister(executionId);
|
|
@@ -73,6 +73,7 @@ export default class Processor {
|
|
|
73
73
|
abortController: AbortController;
|
|
74
74
|
timeoutGuard: NodeJS.Timeout | null;
|
|
75
75
|
private runningRegistered;
|
|
76
|
+
private unregisterRunningExecution?;
|
|
76
77
|
private abortReason;
|
|
77
78
|
private aborted;
|
|
78
79
|
constructor(execution: ExecutionModel, options: ProcessorOptions);
|
package/dist/server/Processor.js
CHANGED
|
@@ -90,6 +90,7 @@ class Processor {
|
|
|
90
90
|
abortController = new AbortController();
|
|
91
91
|
timeoutGuard = null;
|
|
92
92
|
runningRegistered = false;
|
|
93
|
+
unregisterRunningExecution;
|
|
93
94
|
abortReason = null;
|
|
94
95
|
aborted = false;
|
|
95
96
|
get abortSignal() {
|
|
@@ -461,34 +462,40 @@ class Processor {
|
|
|
461
462
|
}
|
|
462
463
|
if (this.jobsToSave.size) {
|
|
463
464
|
const newJobs = [];
|
|
465
|
+
const JobCollection = this.options.plugin.db.getCollection("jobs");
|
|
466
|
+
const JobsModel = this.options.plugin.db.getModel("jobs");
|
|
464
467
|
for (const job of this.jobsToSave.values()) {
|
|
465
468
|
if (job.isNewRecord) {
|
|
466
469
|
newJobs.push(job);
|
|
467
470
|
} else {
|
|
468
|
-
const JobCollection = this.options.plugin.db.getCollection("jobs");
|
|
469
471
|
const changes = [];
|
|
470
472
|
if (job.changed("status")) {
|
|
471
|
-
changes.push([
|
|
472
|
-
job.changed("status", false);
|
|
473
|
+
changes.push(["status", job.status]);
|
|
473
474
|
}
|
|
474
475
|
if (job.changed("meta")) {
|
|
475
|
-
changes.push([
|
|
476
|
-
job.changed("meta", false);
|
|
476
|
+
changes.push(["meta", JSON.stringify(job.meta ?? null)]);
|
|
477
477
|
}
|
|
478
478
|
if (job.changed("result")) {
|
|
479
|
-
changes.push([
|
|
480
|
-
|
|
479
|
+
changes.push(["result", JSON.stringify(job.result ?? null)]);
|
|
480
|
+
}
|
|
481
|
+
if (job.changed("startedAt")) {
|
|
482
|
+
changes.push(["startedAt", job.startedAt]);
|
|
481
483
|
}
|
|
482
484
|
if (changes.length) {
|
|
485
|
+
const idColumn = JobsModel.rawAttributes.id.field || "id";
|
|
483
486
|
await this.options.plugin.db.sequelize.query(
|
|
484
|
-
`UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(
|
|
487
|
+
`UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(
|
|
488
|
+
([field]) => `${this.options.plugin.db.quoteIdentifier(JobsModel.rawAttributes[field].field || field)} = ?`
|
|
489
|
+
)} WHERE ${this.options.plugin.db.quoteIdentifier(idColumn)}='${job.id}'`,
|
|
485
490
|
{ replacements: changes.map(([, value]) => value) }
|
|
486
491
|
);
|
|
492
|
+
for (const [field] of changes) {
|
|
493
|
+
job.changed(field, false);
|
|
494
|
+
}
|
|
487
495
|
}
|
|
488
496
|
}
|
|
489
497
|
}
|
|
490
498
|
if (newJobs.length) {
|
|
491
|
-
const JobsModel = this.options.plugin.db.getModel("jobs");
|
|
492
499
|
for (let offset = 0; offset < newJobs.length; offset += JOB_SAVE_BATCH_SIZE) {
|
|
493
500
|
const batch = newJobs.slice(offset, offset + JOB_SAVE_BATCH_SIZE);
|
|
494
501
|
await JobsModel.bulkCreate(
|
|
@@ -644,6 +651,7 @@ class Processor {
|
|
|
644
651
|
const { database } = this.execution.constructor;
|
|
645
652
|
const model = database.getModel("jobs");
|
|
646
653
|
let job;
|
|
654
|
+
const startedAt = Object.prototype.hasOwnProperty.call(payload, "startedAt") ? payload.startedAt : /* @__PURE__ */ new Date();
|
|
647
655
|
if (payload instanceof model) {
|
|
648
656
|
job = payload;
|
|
649
657
|
job.set("updatedAt", /* @__PURE__ */ new Date());
|
|
@@ -653,6 +661,7 @@ class Processor {
|
|
|
653
661
|
status: payload.status,
|
|
654
662
|
result: Object.prototype.hasOwnProperty.call(payload, "result") ? payload.result : null,
|
|
655
663
|
meta: Object.prototype.hasOwnProperty.call(payload, "meta") ? payload.meta : null,
|
|
664
|
+
startedAt,
|
|
656
665
|
updatedAt: /* @__PURE__ */ new Date()
|
|
657
666
|
});
|
|
658
667
|
} else {
|
|
@@ -660,6 +669,7 @@ class Processor {
|
|
|
660
669
|
{
|
|
661
670
|
...payload,
|
|
662
671
|
id: this.options.plugin.snowflake.getUniqueID().toString(),
|
|
672
|
+
startedAt,
|
|
663
673
|
createdAt: /* @__PURE__ */ new Date(),
|
|
664
674
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
665
675
|
executionId: this.execution.id
|
|
@@ -688,7 +698,10 @@ class Processor {
|
|
|
688
698
|
this.options.plugin.timeoutManager.clear(this.execution.id);
|
|
689
699
|
this.abortReason = null;
|
|
690
700
|
this.aborted = false;
|
|
691
|
-
this.options.plugin.registerRunningExecution(
|
|
701
|
+
this.unregisterRunningExecution = this.options.plugin.registerRunningExecution(
|
|
702
|
+
this.execution.id,
|
|
703
|
+
(reason) => this.abortExecution(reason)
|
|
704
|
+
);
|
|
692
705
|
this.runningRegistered = true;
|
|
693
706
|
const remaining = this.execution.expiresAt ? this.execution.expiresAt.getTime() - Date.now() : null;
|
|
694
707
|
if (remaining == null) {
|
|
@@ -704,6 +717,7 @@ class Processor {
|
|
|
704
717
|
return this.options.plugin.timeoutManager.shouldContinue(this.execution);
|
|
705
718
|
}
|
|
706
719
|
leaveRunningState() {
|
|
720
|
+
var _a;
|
|
707
721
|
if (this.timeoutGuard) {
|
|
708
722
|
clearTimeout(this.timeoutGuard);
|
|
709
723
|
this.timeoutGuard = null;
|
|
@@ -711,7 +725,8 @@ class Processor {
|
|
|
711
725
|
if (!this.runningRegistered) {
|
|
712
726
|
return;
|
|
713
727
|
}
|
|
714
|
-
this.
|
|
728
|
+
(_a = this.unregisterRunningExecution) == null ? void 0 : _a.call(this);
|
|
729
|
+
this.unregisterRunningExecution = void 0;
|
|
715
730
|
this.runningRegistered = false;
|
|
716
731
|
}
|
|
717
732
|
/**
|
|
@@ -11,8 +11,8 @@ type AbortHandler = {
|
|
|
11
11
|
};
|
|
12
12
|
export default class RunningExecutionRegistry {
|
|
13
13
|
private readonly executions;
|
|
14
|
-
register(executionId: number | string, handler: AbortHandler): void;
|
|
15
|
-
unregister(executionId: number | string): void;
|
|
14
|
+
register(executionId: number | string, handler: AbortHandler): () => void;
|
|
15
|
+
unregister(executionId: number | string, handler?: AbortHandler): void;
|
|
16
16
|
abort(executionId: number | string, reason?: string): boolean;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -32,17 +32,32 @@ module.exports = __toCommonJS(RunningExecutionRegistry_exports);
|
|
|
32
32
|
class RunningExecutionRegistry {
|
|
33
33
|
executions = /* @__PURE__ */ new Map();
|
|
34
34
|
register(executionId, handler) {
|
|
35
|
-
|
|
35
|
+
const key = String(executionId);
|
|
36
|
+
const handlers = this.executions.get(key) ?? /* @__PURE__ */ new Set();
|
|
37
|
+
handlers.add(handler);
|
|
38
|
+
this.executions.set(key, handlers);
|
|
39
|
+
return () => this.unregister(executionId, handler);
|
|
36
40
|
}
|
|
37
|
-
unregister(executionId) {
|
|
38
|
-
|
|
41
|
+
unregister(executionId, handler) {
|
|
42
|
+
const key = String(executionId);
|
|
43
|
+
if (!handler) {
|
|
44
|
+
this.executions.delete(key);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const handlers = this.executions.get(key);
|
|
48
|
+
handlers == null ? void 0 : handlers.delete(handler);
|
|
49
|
+
if (!(handlers == null ? void 0 : handlers.size)) {
|
|
50
|
+
this.executions.delete(key);
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
abort(executionId, reason) {
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
54
|
+
const handlers = this.executions.get(String(executionId));
|
|
55
|
+
if (!(handlers == null ? void 0 : handlers.size)) {
|
|
43
56
|
return false;
|
|
44
57
|
}
|
|
45
|
-
handler
|
|
58
|
+
for (const handler of handlers) {
|
|
59
|
+
handler.abort(reason);
|
|
60
|
+
}
|
|
46
61
|
return true;
|
|
47
62
|
}
|
|
48
63
|
}
|
|
@@ -225,7 +225,7 @@ async function execute(context, next) {
|
|
|
225
225
|
filter: { key: workflow.key }
|
|
226
226
|
});
|
|
227
227
|
let newVersion;
|
|
228
|
-
if (executed
|
|
228
|
+
if (executed === 0 && Number(autoRevision) === 1) {
|
|
229
229
|
newVersion = await repository.revision({
|
|
230
230
|
filterByTk: workflow.id,
|
|
231
231
|
filter: { key: workflow.key },
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
7
7
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
8
8
|
"description.ru-RU": "Мощный инструмент BPM, обеспечивающий базовую поддержку автоматизации бизнес-процессов с возможностью неограниченного расширения триггеров и узлов.",
|
|
9
|
-
"version": "2.2.0-beta.
|
|
9
|
+
"version": "2.2.0-beta.17",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@nocobase/test": "2.x",
|
|
52
52
|
"@nocobase/utils": "2.x"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d7a69c4f47fe38b17a2ce1408258902cf64f6c83",
|
|
55
55
|
"keywords": [
|
|
56
56
|
"Workflow"
|
|
57
57
|
]
|