@nocobase/plugin-workflow 2.1.17 → 2.1.19
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/964.5e11e1820fece37b.js +10 -0
- package/dist/client/index.js +1 -1
- 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/Dispatcher.js +20 -22
- package/package.json +2 -2
- package/dist/client/964.ffbf5b47ed12bbdc.js +0 -10
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.19",
|
|
15
|
+
"@nocobase/utils": "2.1.19",
|
|
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.19",
|
|
24
|
+
"@nocobase/plugin-mobile": "2.1.19",
|
|
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.19",
|
|
27
|
+
"@nocobase/database": "2.1.19",
|
|
28
|
+
"@nocobase/data-source-manager": "2.1.19",
|
|
29
|
+
"@nocobase/logger": "2.1.19",
|
|
30
|
+
"@nocobase/evaluators": "2.1.19",
|
|
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.19",
|
|
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.19",
|
|
38
|
+
"@nocobase/test": "2.1.19"
|
|
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-07-
|
|
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-07-03T14:32:52.250Z"}
|
|
@@ -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-07-
|
|
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-07-03T14:32:52.099Z"}
|
|
@@ -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-07-
|
|
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-07-03T14:32:51.671Z"}
|
|
@@ -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-07-
|
|
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-07-03T14:32:51.559Z"}
|
|
@@ -54,7 +54,7 @@ class Dispatcher {
|
|
|
54
54
|
const execution = await ExecutionRepo.findOne({
|
|
55
55
|
filterByTk: event.executionId
|
|
56
56
|
});
|
|
57
|
-
if (!execution || execution.dispatched) {
|
|
57
|
+
if (!execution || execution.dispatched || execution.status !== import_constants.EXECUTION_STATUS.QUEUEING) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
this.plugin.getLogger(execution.workflowId).info(`execution (${execution.id}) received from queue, adding to pending list`);
|
|
@@ -350,8 +350,7 @@ class Dispatcher {
|
|
|
350
350
|
const logger = input ? this.plugin.getLogger(input.workflowId) : this.plugin.getLogger("dispatcher");
|
|
351
351
|
if (options.transaction) {
|
|
352
352
|
try {
|
|
353
|
-
|
|
354
|
-
return execution;
|
|
353
|
+
return await this.acquireExecution(input, options, options.transaction);
|
|
355
354
|
} catch (error) {
|
|
356
355
|
if (error instanceof Error) {
|
|
357
356
|
logger.error(`entering execution failed: ${error.message}`, { error });
|
|
@@ -364,13 +363,12 @@ class Dispatcher {
|
|
|
364
363
|
await this.acquireWithRetry(
|
|
365
364
|
async () => {
|
|
366
365
|
const tx = await this.plugin.db.sequelize.transaction({
|
|
367
|
-
isolationLevel: this.plugin.db.options.dialect === "sqlite" ? void 0 : import_sequelize.Transaction.ISOLATION_LEVELS.
|
|
366
|
+
isolationLevel: this.plugin.db.options.dialect === "sqlite" ? void 0 : import_sequelize.Transaction.ISOLATION_LEVELS.READ_COMMITTED
|
|
368
367
|
});
|
|
369
368
|
try {
|
|
370
|
-
const
|
|
369
|
+
const execution = await this.acquireExecution(input, options, tx);
|
|
371
370
|
await tx.commit();
|
|
372
371
|
result = execution;
|
|
373
|
-
return shouldRetry;
|
|
374
372
|
} catch (error) {
|
|
375
373
|
await tx.rollback();
|
|
376
374
|
if (this.isConcurrentAcquireError(error)) {
|
|
@@ -380,7 +378,6 @@ class Dispatcher {
|
|
|
380
378
|
logger.error(`entering execution failed: ${error.message}`, { error });
|
|
381
379
|
}
|
|
382
380
|
result = null;
|
|
383
|
-
return false;
|
|
384
381
|
}
|
|
385
382
|
},
|
|
386
383
|
{
|
|
@@ -404,10 +401,17 @@ class Dispatcher {
|
|
|
404
401
|
await execution.reload({ transaction });
|
|
405
402
|
}
|
|
406
403
|
} else {
|
|
404
|
+
const workflowIds = [...this.plugin.enabledCache.keys()];
|
|
405
|
+
if (!workflowIds.length) {
|
|
406
|
+
this.plugin.getLogger("dispatcher").debug(`no enabled workflow to process`);
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
407
409
|
execution = await this.plugin.db.getRepository("executions").findOne({
|
|
408
410
|
filter: {
|
|
409
411
|
dispatched: false,
|
|
410
|
-
|
|
412
|
+
status: import_constants.EXECUTION_STATUS.QUEUEING,
|
|
413
|
+
startedAt: null,
|
|
414
|
+
workflowId: workflowIds
|
|
411
415
|
},
|
|
412
416
|
sort: "id",
|
|
413
417
|
transaction,
|
|
@@ -421,30 +425,24 @@ class Dispatcher {
|
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
if (!execution) {
|
|
424
|
-
return
|
|
428
|
+
return null;
|
|
425
429
|
}
|
|
426
|
-
|
|
427
|
-
const shouldRetry = !input && !entered;
|
|
428
|
-
return { execution: entered, shouldRetry };
|
|
430
|
+
return this.enter(execution, transaction);
|
|
429
431
|
}
|
|
430
432
|
async acquireWithRetry(acquire, options) {
|
|
431
433
|
for (let attempt = 1; attempt <= EXECUTION_ACQUIRE_MAX_ATTEMPTS; attempt++) {
|
|
432
|
-
let shouldRetry = false;
|
|
433
434
|
try {
|
|
434
|
-
|
|
435
|
+
await acquire();
|
|
436
|
+
break;
|
|
435
437
|
} catch (error) {
|
|
436
438
|
if (!this.isConcurrentAcquireError(error)) {
|
|
437
439
|
throw error;
|
|
438
440
|
}
|
|
439
|
-
shouldRetry = true;
|
|
440
441
|
options.logger.warn(options.conflictMessage, { error });
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (attempt >= EXECUTION_ACQUIRE_MAX_ATTEMPTS) {
|
|
446
|
-
options.logger.warn(options.maxAttemptsMessage);
|
|
447
|
-
break;
|
|
442
|
+
if (attempt >= EXECUTION_ACQUIRE_MAX_ATTEMPTS) {
|
|
443
|
+
options.logger.warn(options.maxAttemptsMessage);
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
448
|
}
|
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.19",
|
|
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": "c316683666cfb478cb355b971c8f067a4f925fcb",
|
|
53
53
|
"keywords": [
|
|
54
54
|
"Workflow"
|
|
55
55
|
]
|
|
@@ -1,10 +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
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).push([["964"],{2596:function(e,t,n){n.d(t,{i:function(){return x}});var r=n(2059),o=n(9155),l=n.n(o);let a=(0,o.createContext)(null),i={didCatch:!1,error:null};class c extends o.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=i}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,o=Array(r),l=0;l<r;l++)o[l]=arguments[l];null==(t=(n=this.props).onReset)||t.call(n,{args:o,reason:"imperative-api"}),this.setState(i)}}componentDidCatch(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)){var o,l;null==(o=(l=this.props).onReset)||o.call(l,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(i)}}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:l,error:i}=this.state,c=e;if(l){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if((0,o.isValidElement)(r))c=r;else if("function"==typeof t)c=t(e);else if(n)c=(0,o.createElement)(n,e);else throw i}return(0,o.createElement)(a.Provider,{value:{didCatch:l,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}var s=n(7375),u=n(3342),d=n(5324),m=n(8083),p=n(404),f=n(3872),y=n(6660),b=n(8201),v=n(4562);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){var e=w(["\n margin-top: 0 !important;\n "]);return h=function(){return e},e}function g(){var e=w(["\n margin-bottom: 1em;\n "]);return g=function(){return e},e}function k(){var e=w(["\n margin-top: 0 !important;\n "]);return k=function(){return e},e}function x(e){var t,n,o=e.entry,a=(0,y.A)().styles,i=(0,v.sD)(),w=(0,p.x)(),x=(0,u.useCompile)(),C=(0,u.usePlugin)(d.default),O=function(e){if(Array.isArray(e))return e}(t=l().useState(100))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return E(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return E(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),j=O[0],S=O[1],A=null==w?void 0:w.clipboard,P=A?C.instructions.get(A.type):null,N=A?P?x(P.title):A.type:"";return l().createElement("div",{className:"workflow-canvas-wrapper"},l().createElement(c,{FallbackComponent:u.ErrorFallback,onError:console.error},l().createElement("div",{className:"workflow-canvas",style:{zoom:j/100}},l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(h()))},l().createElement("div",{className:a.branchClass},i?l().createElement(r.Alert,{type:"warning",message:(0,f.vV)("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:(0,u.css)(g())}):null,l().createElement(b.Vo,null),l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(k()))},l().createElement(m.lg,{entry:o})),l().createElement("div",{className:a.terminalClass},(0,f.vV)("End")))))),A?l().createElement("div",{className:a.clipboardPreviewClass},l().createElement("div",{className:"workflow-clipboard-header"},l().createElement("span",null,(0,f.vV)("Copied node")),l().createElement(r.Button,{type:"text",size:"small",icon:l().createElement(s.CloseOutlined,null),onClick:function(){var e;return null==w||null==(e=w.clearClipboard)?void 0:e.call(w)}})),l().createElement("div",{className:"workflow-clipboard-card"},l().createElement("div",{className:"workflow-clipboard-type"},N),l().createElement("div",{className:"workflow-clipboard-title"},null!=(n=A.title)?n:A.type))):null,l().createElement("div",{className:"workflow-canvas-zoomer"},l().createElement(r.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:j,onChange:S})))}},3639:function(e,t,n){n.r(t),n.d(t,{ExecutionPage:function(){return B}});var r=n(3342),o=n(9155),l=n.n(o),a=n(4442),i=n(2059),c=n(7768),s=n(7375),u=n(5953),d=n(5324),m=n(2596),p=n(1958),f=n(7428),y=n(7846),b=n(3872),v=n(7065),E=n(6660),w=n(6072),h=n(6773);function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function O(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return l}}(e,t)||A(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||A(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}function P(e){var t=e.jobData,n=e.loading,o=O(e,["jobData","loading"]);if(n)return l().createElement(i.Spin,null);var a=(0,h.get)(t,"result");return l().createElement(r.Input.JSON,C(x({},o),{value:a,disabled:!0}))}function N(e){var t=e.jobData;if(e.loading)return null;var n=(0,h.get)(t,"log");return l().createElement(v.KV,{value:n})}function D(e){var t,n,o=e.job,a=e.setViewJob,c=(0,r.usePlugin)(d.default).instructions,s=(0,r.useCompile)(),u=(0,E.A)().styles,m=(t=o.id,(0,r.useRequest)({resource:"jobs",action:"get",params:{filterByTk:t}},{cacheKey:"job-".concat(t)})),p=m.data,y=m.loading,v=null!=(n=(0,h.get)(p,"data"))?n:o,w=(null!=o?o:{}).node,g=void 0===w?{}:w,O=c.get(g.type);return l().createElement(r.ActionContextProvider,{value:{visible:!!o,setVisible:a}},l().createElement(r.SchemaComponent,{components:{JobResult:P,JobLog:N},schema:{type:"void",properties:k({},"".concat(v.id,"-").concat(v.updatedAt,"-modal"),{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:C(x({},o,v),{node:g})},"x-component":"Action.Modal",title:l().createElement("div",{className:u.nodeTitleClass},l().createElement(i.Tag,null,s(null==O?void 0:O.title)),l().createElement("strong",null,g.title),l().createElement("span",{className:"workflow-node-id"},"#",g.id)),properties:{status:{type:"number",title:'{{t("Status", { ns: "'.concat(b.CU,'" })}}'),"x-decorator":"FormItem","x-component":"Select",enum:f.ox,"x-read-pretty":!0},updatedAt:{type:"string",title:'{{t("Executed at", { ns: "'.concat(b.CU,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:'{{t("Node result", { ns: "'.concat(b.CU,'" })}}'),"x-decorator":"FormItem","x-component":"JobResult","x-component-props":{jobData:v,loading:y,className:u.nodeJobResultClass,autoSize:{minRows:4,maxRows:32}}},log:{type:"string","x-component":"JobLog","x-component-props":{jobData:v,loading:y}}}})}}))}function V(){var e=(0,y.$K)(),t=e.viewJob,n=e.setViewJob;return t?l().createElement(D,{job:t,setViewJob:n}):null}function I(e){var t=(0,y.$K)().execution,n=(0,r.useAPIClient)(),u=(0,a.useNavigate)(),d=(0,E.A)().styles,m=(0,r.useResourceActionContext)().refresh,b=j((0,o.useState)([]),2),v=b[0],h=b[1],g=j((0,o.useState)([]),2),k=g[0],x=g[1],C=j((0,o.useState)(null),2),O=C[0],A=C[1],P=j((0,o.useState)(null),2),N=P[0],D=P[1],V=j((0,o.useState)(null),2),I=V[0],R=V[1],B=(0,o.useCallback)(function(e){t&&e&&(O!==t.id&&n.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-id",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){var n=e.data;A(t.id),h(n.data)}).catch(function(){}),(N!==t.id||I&&Date.now()-Number(I)>6e4&&k.length<10)&&n.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"id",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){var n=e.data;D(t.id),R(Date.now()),x(n.data.reverse())}).catch(function(){}))},[t,O,N,I,k.length,n]),T=(0,o.useCallback)(function(e){var n=e.key;n!=t.id&&u((0,w.mz)(n))},[t.id,u]);return t?l().createElement(i.Space,null,l().createElement(i.Dropdown,{onOpenChange:B,menu:{onClick:T,defaultSelectedKeys:["".concat(t.id)],className:(0,r.cx)(d.dropdownClass,d.executionsDropdownRowClass),items:S(k).concat([t],S(v)).map(function(e){return{key:e.id,label:l().createElement(l().Fragment,null,l().createElement("span",{className:"id"},"#".concat(e.id)),l().createElement("time",null,(0,c.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss"))),icon:l().createElement("span",null,l().createElement(p.p,{statusMap:f.$Y,status:e.status}))}})}},l().createElement(i.Space,null,l().createElement("strong",null,"#".concat(t.id)),l().createElement(s.DownOutlined,null))),l().createElement(i.Button,{type:"link",size:"small",icon:l().createElement(s.ReloadOutlined,null),onClick:m})):null}function R(){var e,t,n,d=(0,u.useTranslation)().t,p=(0,r.useCompile)(),v=(0,r.useResourceActionContext)(),E=v.data,h=v.loading,g=v.refresh,k=(0,r.useDocumentTitle)().setTitle,x=j((0,o.useState)(null),2),C=x[0],S=x[1],A=(0,r.useApp)(),P=(0,r.useAPIClient)();(0,o.useEffect)(function(){var e,t=(null!=(e=null==E?void 0:E.data)?e:{}).workflow;null==k||k("".concat((null==t?void 0:t.title)?"".concat(t.title," - "):"").concat((0,b.vV)("Execution history")))},[null==E?void 0:E.data,k]);var N=(0,o.useCallback)(function(){i.Modal.confirm({title:(0,b.vV)("Cancel the execution"),icon:l().createElement(s.ExclamationCircleFilled,null),content:(0,b.vV)("Are you sure you want to cancel the execution?"),onOk:function(){P.resource("executions").cancel({filterByTk:null==E?void 0:E.data.id}).then(function(){i.message.success(d("Operation succeeded")),g()}).catch(function(e){console.error(e.data.error)})}})},[null==E?void 0:E.data]),D=(0,o.useCallback)(function(){history.back()},[]);if(!(null==E?void 0:E.data))return h?l().createElement(i.Spin,null):l().createElement(i.Result,{status:"404",title:"Not found"});var R=null!=(e=null==E?void 0:E.data)?e:{},B=R.jobs,T=R.workflow,z=O(R,["jobs","workflow"]),J=(T||{}).nodes,K=void 0===J?[]:J;(0,w.KD)(K),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map;e.forEach(function(e){e.jobs=[],n.set(e.id,e)}),t.forEach(function(e){var t=n.get(e.nodeId);t&&(t.jobs.push(e),e.node={id:t.id,key:t.key,title:t.title,type:t.type})}),e.forEach(function(e){e.jobs=e.jobs.sort(function(e,t){return e.id-t.id})})}(K,void 0===B?[]:B);var M=K.find(function(e){return!e.upstream}),Y=f.$Y[z.status];return T?l().createElement(y.cB.Provider,{value:{workflow:T.type?T:null,nodes:K,execution:z,viewJob:C,setViewJob:S}},l().createElement("div",{className:"workflow-toolbar"},l().createElement("header",null,l().createElement(i.Breadcrumb,{items:[{title:l().createElement(a.Link,{to:A.pluginSettingsManager.getRoutePath("workflow")},(0,b.vV)("Workflow"))},{title:l().createElement(i.Tooltip,{title:"Key: ".concat(T.key)},l().createElement(a.Link,{to:(0,w.Yz)(T.id)},T.title))},{title:l().createElement(I,null)}]})),l().createElement("aside",null,l().createElement(i.Tag,{color:Y.color},l().createElement(i.Space,null,p(Y.label),z.reason?l().createElement(i.Tooltip,{title:p(null!=(t=null==(n=f.BI[z.reason])?void 0:n.label)?t:z.reason),placement:"bottom"},l().createElement(s.QuestionCircleOutlined,null)):null)),z.status?null:l().createElement(i.Tooltip,{title:(0,b.vV)("Cancel the execution")},l().createElement(i.Button,{type:"link",danger:!0,onClick:N,shape:"circle",size:"small",icon:l().createElement(s.StopOutlined,null)})),l().createElement("time",null,(0,c.str2moment)(z.updatedAt).format("YYYY-MM-DD HH:mm:ss")))),l().createElement(m.i,{entry:M}),l().createElement(V,null)):l().createElement(i.Result,{status:"404",title:(0,b.vV)("Not found"),subTitle:(0,b.vV)("Workflow of execution is not existed"),extra:l().createElement(i.Button,{onClick:D},(0,b.vV)("Go back"))})}var B=function(){var e,t,n,o=(0,a.useParams)(),i=(0,E.A)().styles;return l().createElement("div",{className:(0,r.cx)(i.workflowPageClass)},l().createElement(r.SchemaComponent,{schema:{type:"void",properties:(e={},t="execution_".concat(o.id),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:o,appends:["jobs","workflow","workflow.nodes","workflow.versionStats","workflow.stats"],except:["jobs.result","workflow.options"]}}},"x-component":"ExecutionCanvas"},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},components:{ExecutionCanvas:R}}))}}}]);
|