@nocobase/plugin-workflow 2.1.37 → 2.1.39
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/common/collections/jobs.js +2 -2
- package/dist/externalVersion.js +12 -12
- 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/types/Job.d.ts +1 -0
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -11,8 +11,8 @@ 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.1.
|
|
15
|
-
"@nocobase/utils": "2.1.
|
|
14
|
+
"@nocobase/client": "2.1.39",
|
|
15
|
+
"@nocobase/utils": "2.1.39",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
18
|
"react-router-dom": "6.30.1",
|
|
@@ -20,20 +20,20 @@ module.exports = {
|
|
|
20
20
|
"lodash": "4.18.1",
|
|
21
21
|
"@dnd-kit/core": "6.1.0",
|
|
22
22
|
"@formily/shared": "2.3.7",
|
|
23
|
-
"@nocobase/flow-engine": "2.1.
|
|
24
|
-
"@nocobase/plugin-mobile": "2.1.
|
|
23
|
+
"@nocobase/flow-engine": "2.1.39",
|
|
24
|
+
"@nocobase/plugin-mobile": "2.1.39",
|
|
25
25
|
"sequelize": "6.35.2",
|
|
26
|
-
"@nocobase/server": "2.1.
|
|
27
|
-
"@nocobase/database": "2.1.
|
|
28
|
-
"@nocobase/data-source-manager": "2.1.
|
|
29
|
-
"@nocobase/logger": "2.1.
|
|
30
|
-
"@nocobase/evaluators": "2.1.
|
|
26
|
+
"@nocobase/server": "2.1.39",
|
|
27
|
+
"@nocobase/database": "2.1.39",
|
|
28
|
+
"@nocobase/data-source-manager": "2.1.39",
|
|
29
|
+
"@nocobase/logger": "2.1.39",
|
|
30
|
+
"@nocobase/evaluators": "2.1.39",
|
|
31
31
|
"@formily/antd-v5": "1.2.3",
|
|
32
32
|
"@formily/reactive": "2.3.7",
|
|
33
33
|
"@emotion/css": "11.13.0",
|
|
34
34
|
"@formily/json-schema": "2.3.7",
|
|
35
|
-
"@nocobase/actions": "2.1.
|
|
35
|
+
"@nocobase/actions": "2.1.39",
|
|
36
36
|
"dayjs": "1.11.13",
|
|
37
|
-
"@nocobase/plugin-workflow-test": "2.1.
|
|
38
|
-
"@nocobase/test": "2.1.
|
|
37
|
+
"@nocobase/plugin-workflow-test": "2.1.39",
|
|
38
|
+
"@nocobase/test": "2.1.39"
|
|
39
39
|
};
|
|
@@ -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-08-
|
|
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-11T06:27:05.546Z"}
|
|
@@ -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-08-
|
|
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-11T06:27:05.286Z"}
|
|
@@ -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-08-
|
|
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-11T06:27:04.560Z"}
|
|
@@ -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-08-
|
|
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-11T06:27:04.393Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export default class PluginWorkflowServer extends Plugin {
|
|
|
46
46
|
abortExecutionIfExpired(execution: ExecutionModel, options?: {
|
|
47
47
|
transaction?: Transaction;
|
|
48
48
|
}): Promise<boolean>;
|
|
49
|
-
registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): void;
|
|
49
|
+
registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): () => void;
|
|
50
50
|
unregisterRunningExecution(executionId: number | string): void;
|
|
51
51
|
abortRunningExecution(executionId: number | string, reason?: string): boolean;
|
|
52
52
|
/**
|
package/dist/server/Plugin.js
CHANGED
|
@@ -223,7 +223,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
223
223
|
return this.timeoutManager.abortExecutionIfExpired(execution, options);
|
|
224
224
|
}
|
|
225
225
|
registerRunningExecution(executionId, abort) {
|
|
226
|
-
this.runningExecutionRegistry.register(executionId, { abort });
|
|
226
|
+
return this.runningExecutionRegistry.register(executionId, { abort });
|
|
227
227
|
}
|
|
228
228
|
unregisterRunningExecution(executionId) {
|
|
229
229
|
this.runningExecutionRegistry.unregister(executionId);
|
|
@@ -66,6 +66,7 @@ export default class Processor {
|
|
|
66
66
|
abortController: AbortController;
|
|
67
67
|
timeoutGuard: NodeJS.Timeout | null;
|
|
68
68
|
private runningRegistered;
|
|
69
|
+
private unregisterRunningExecution?;
|
|
69
70
|
private abortReason;
|
|
70
71
|
private aborted;
|
|
71
72
|
constructor(execution: ExecutionModel, options: ProcessorOptions);
|
package/dist/server/Processor.js
CHANGED
|
@@ -88,6 +88,7 @@ class Processor {
|
|
|
88
88
|
abortController = new AbortController();
|
|
89
89
|
timeoutGuard = null;
|
|
90
90
|
runningRegistered = false;
|
|
91
|
+
unregisterRunningExecution;
|
|
91
92
|
abortReason = null;
|
|
92
93
|
aborted = false;
|
|
93
94
|
get abortSignal() {
|
|
@@ -450,34 +451,40 @@ class Processor {
|
|
|
450
451
|
}
|
|
451
452
|
if (this.jobsToSave.size) {
|
|
452
453
|
const newJobs = [];
|
|
454
|
+
const JobCollection = this.options.plugin.db.getCollection("jobs");
|
|
455
|
+
const JobsModel = this.options.plugin.db.getModel("jobs");
|
|
453
456
|
for (const job of this.jobsToSave.values()) {
|
|
454
457
|
if (job.isNewRecord) {
|
|
455
458
|
newJobs.push(job);
|
|
456
459
|
} else {
|
|
457
|
-
const JobCollection = this.options.plugin.db.getCollection("jobs");
|
|
458
460
|
const changes = [];
|
|
459
461
|
if (job.changed("status")) {
|
|
460
|
-
changes.push([
|
|
461
|
-
job.changed("status", false);
|
|
462
|
+
changes.push(["status", job.status]);
|
|
462
463
|
}
|
|
463
464
|
if (job.changed("meta")) {
|
|
464
|
-
changes.push([
|
|
465
|
-
job.changed("meta", false);
|
|
465
|
+
changes.push(["meta", JSON.stringify(job.meta ?? null)]);
|
|
466
466
|
}
|
|
467
467
|
if (job.changed("result")) {
|
|
468
|
-
changes.push([
|
|
469
|
-
|
|
468
|
+
changes.push(["result", JSON.stringify(job.result ?? null)]);
|
|
469
|
+
}
|
|
470
|
+
if (job.changed("startedAt")) {
|
|
471
|
+
changes.push(["startedAt", job.startedAt]);
|
|
470
472
|
}
|
|
471
473
|
if (changes.length) {
|
|
474
|
+
const idColumn = JobsModel.rawAttributes.id.field || "id";
|
|
472
475
|
await this.options.plugin.db.sequelize.query(
|
|
473
|
-
`UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(
|
|
476
|
+
`UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(
|
|
477
|
+
([field]) => `${this.options.plugin.db.quoteIdentifier(JobsModel.rawAttributes[field].field || field)} = ?`
|
|
478
|
+
)} WHERE ${this.options.plugin.db.quoteIdentifier(idColumn)}='${job.id}'`,
|
|
474
479
|
{ replacements: changes.map(([, value]) => value) }
|
|
475
480
|
);
|
|
481
|
+
for (const [field] of changes) {
|
|
482
|
+
job.changed(field, false);
|
|
483
|
+
}
|
|
476
484
|
}
|
|
477
485
|
}
|
|
478
486
|
}
|
|
479
487
|
if (newJobs.length) {
|
|
480
|
-
const JobsModel = this.options.plugin.db.getModel("jobs");
|
|
481
488
|
for (let offset = 0; offset < newJobs.length; offset += JOB_SAVE_BATCH_SIZE) {
|
|
482
489
|
const batch = newJobs.slice(offset, offset + JOB_SAVE_BATCH_SIZE);
|
|
483
490
|
await JobsModel.bulkCreate(
|
|
@@ -532,6 +539,7 @@ class Processor {
|
|
|
532
539
|
const { database } = this.execution.constructor;
|
|
533
540
|
const model = database.getModel("jobs");
|
|
534
541
|
let job;
|
|
542
|
+
const startedAt = Object.prototype.hasOwnProperty.call(payload, "startedAt") ? payload.startedAt : /* @__PURE__ */ new Date();
|
|
535
543
|
if (payload instanceof model) {
|
|
536
544
|
job = payload;
|
|
537
545
|
job.set("updatedAt", /* @__PURE__ */ new Date());
|
|
@@ -541,6 +549,7 @@ class Processor {
|
|
|
541
549
|
status: payload.status,
|
|
542
550
|
result: Object.prototype.hasOwnProperty.call(payload, "result") ? payload.result : null,
|
|
543
551
|
meta: Object.prototype.hasOwnProperty.call(payload, "meta") ? payload.meta : null,
|
|
552
|
+
startedAt,
|
|
544
553
|
updatedAt: /* @__PURE__ */ new Date()
|
|
545
554
|
});
|
|
546
555
|
} else {
|
|
@@ -548,6 +557,7 @@ class Processor {
|
|
|
548
557
|
{
|
|
549
558
|
...payload,
|
|
550
559
|
id: this.options.plugin.snowflake.getUniqueID().toString(),
|
|
560
|
+
startedAt,
|
|
551
561
|
createdAt: /* @__PURE__ */ new Date(),
|
|
552
562
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
553
563
|
executionId: this.execution.id
|
|
@@ -576,7 +586,10 @@ class Processor {
|
|
|
576
586
|
this.options.plugin.timeoutManager.clear(this.execution.id);
|
|
577
587
|
this.abortReason = null;
|
|
578
588
|
this.aborted = false;
|
|
579
|
-
this.options.plugin.registerRunningExecution(
|
|
589
|
+
this.unregisterRunningExecution = this.options.plugin.registerRunningExecution(
|
|
590
|
+
this.execution.id,
|
|
591
|
+
(reason) => this.abortExecution(reason)
|
|
592
|
+
);
|
|
580
593
|
this.runningRegistered = true;
|
|
581
594
|
const remaining = this.execution.expiresAt ? this.execution.expiresAt.getTime() - Date.now() : null;
|
|
582
595
|
if (remaining == null) {
|
|
@@ -592,6 +605,7 @@ class Processor {
|
|
|
592
605
|
return this.options.plugin.timeoutManager.shouldContinue(this.execution);
|
|
593
606
|
}
|
|
594
607
|
leaveRunningState() {
|
|
608
|
+
var _a;
|
|
595
609
|
if (this.timeoutGuard) {
|
|
596
610
|
clearTimeout(this.timeoutGuard);
|
|
597
611
|
this.timeoutGuard = null;
|
|
@@ -599,7 +613,8 @@ class Processor {
|
|
|
599
613
|
if (!this.runningRegistered) {
|
|
600
614
|
return;
|
|
601
615
|
}
|
|
602
|
-
this.
|
|
616
|
+
(_a = this.unregisterRunningExecution) == null ? void 0 : _a.call(this);
|
|
617
|
+
this.unregisterRunningExecution = void 0;
|
|
603
618
|
this.runningRegistered = false;
|
|
604
619
|
}
|
|
605
620
|
/**
|
|
@@ -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
|
}
|
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.1.
|
|
9
|
+
"version": "2.1.39",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@nocobase/test": "2.x",
|
|
50
50
|
"@nocobase/utils": "2.x"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ddbf88ac2a5de1ad94ff4779618cdf1b81aae037",
|
|
53
53
|
"keywords": [
|
|
54
54
|
"Workflow"
|
|
55
55
|
]
|