@nocobase/plugin-workflow 2.0.0-alpha.67 → 2.0.0-alpha.68

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.
@@ -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.0.0-alpha.67",
15
- "@nocobase/utils": "2.0.0-alpha.67",
14
+ "@nocobase/client": "2.0.0-alpha.68",
15
+ "@nocobase/utils": "2.0.0-alpha.68",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "react-router-dom": "6.30.1",
@@ -20,18 +20,18 @@ module.exports = {
20
20
  "lodash": "4.17.21",
21
21
  "@dnd-kit/core": "6.1.0",
22
22
  "@formily/shared": "2.3.7",
23
- "@nocobase/flow-engine": "2.0.0-alpha.67",
24
- "@nocobase/plugin-mobile": "2.0.0-alpha.67",
23
+ "@nocobase/flow-engine": "2.0.0-alpha.68",
24
+ "@nocobase/plugin-mobile": "2.0.0-alpha.68",
25
25
  "sequelize": "6.35.2",
26
- "@nocobase/server": "2.0.0-alpha.67",
27
- "@nocobase/database": "2.0.0-alpha.67",
28
- "@nocobase/data-source-manager": "2.0.0-alpha.67",
29
- "@nocobase/logger": "2.0.0-alpha.67",
30
- "@nocobase/evaluators": "2.0.0-alpha.67",
26
+ "@nocobase/server": "2.0.0-alpha.68",
27
+ "@nocobase/database": "2.0.0-alpha.68",
28
+ "@nocobase/data-source-manager": "2.0.0-alpha.68",
29
+ "@nocobase/logger": "2.0.0-alpha.68",
30
+ "@nocobase/evaluators": "2.0.0-alpha.68",
31
31
  "@formily/antd-v5": "1.2.3",
32
32
  "@formily/reactive": "2.3.7",
33
- "@nocobase/actions": "2.0.0-alpha.67",
33
+ "@nocobase/actions": "2.0.0-alpha.68",
34
34
  "dayjs": "1.11.13",
35
- "@nocobase/plugin-workflow-test": "2.0.0-alpha.67",
36
- "@nocobase/test": "2.0.0-alpha.67"
35
+ "@nocobase/plugin-workflow-test": "2.0.0-alpha.68",
36
+ "@nocobase/test": "2.0.0-alpha.68"
37
37
  };
@@ -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-01-26T10:56:54.866Z"}
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-01-27T02:57:52.161Z"}
@@ -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":"2026-01-26T10:56:54.522Z"}
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":"2026-01-27T02:57:51.839Z"}
@@ -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-01-26T10:56:54.331Z"}
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-01-27T02:57:51.644Z"}
@@ -338,6 +338,7 @@ class PluginWorkflowServer extends import_server.Plugin {
338
338
  "flow_nodes:update",
339
339
  "flow_nodes:destroy",
340
340
  "flow_nodes:destroyBranch",
341
+ "flow_nodes:move",
341
342
  "flow_nodes:test",
342
343
  "jobs:get",
343
344
  "workflowCategories:*"
@@ -63,6 +63,7 @@ function actions_default({ app }) {
63
63
  update: nodes.update,
64
64
  destroy: nodes.destroy,
65
65
  destroyBranch: nodes.destroyBranch,
66
+ move: nodes.move,
66
67
  test: nodes.test
67
68
  }),
68
69
  ...make("jobs", jobs),
@@ -10,5 +10,6 @@ import { Context } from '@nocobase/actions';
10
10
  export declare function create(context: Context, next: any): Promise<void>;
11
11
  export declare function destroy(context: Context, next: any): Promise<void>;
12
12
  export declare function destroyBranch(context: Context, next: any): Promise<void>;
13
+ export declare function move(context: Context, next: any): Promise<void>;
13
14
  export declare function update(context: Context, next: any): Promise<void>;
14
15
  export declare function test(context: Context, next: any): Promise<void>;
@@ -39,6 +39,7 @@ __export(nodes_exports, {
39
39
  create: () => create,
40
40
  destroy: () => destroy,
41
41
  destroyBranch: () => destroyBranch,
42
+ move: () => move,
42
43
  test: () => test,
43
44
  update: () => update
44
45
  });
@@ -336,6 +337,170 @@ async function destroyBranch(context, next) {
336
337
  context.body = deletedBranchHead;
337
338
  await next();
338
339
  }
340
+ async function move(context, next) {
341
+ const { db } = context;
342
+ const repository = import_actions.utils.getRepositoryFromParams(context);
343
+ const { filterByTk, values = {} } = context.action.params;
344
+ const rawUpstreamId = values.upstreamId;
345
+ const rawBranchIndex = values.branchIndex;
346
+ const upstreamId = rawUpstreamId == null || rawUpstreamId === "" ? null : rawUpstreamId;
347
+ let branchIndex = rawBranchIndex == null || rawBranchIndex === "" ? null : Number.parseInt(rawBranchIndex, 10);
348
+ if (rawBranchIndex != null && rawBranchIndex !== "" && Number.isNaN(branchIndex)) {
349
+ context.throw(400, "branchIndex must be a number");
350
+ }
351
+ if (upstreamId == null) {
352
+ branchIndex = null;
353
+ }
354
+ const fields = ["id", "upstreamId", "downstreamId", "branchIndex", "workflowId"];
355
+ context.body = await db.sequelize.transaction(async (transaction) => {
356
+ const instance = await repository.findOne({
357
+ filterByTk,
358
+ fields,
359
+ appends: ["upstream", "downstream", "workflow.versionStats"],
360
+ transaction
361
+ });
362
+ if (!instance) {
363
+ context.throw(404, "Node not found");
364
+ }
365
+ if (instance.workflow.versionStats.executed > 0) {
366
+ context.throw(400, "Nodes in executed workflow could not be moved");
367
+ }
368
+ if (upstreamId != null && String(upstreamId) === String(instance.id)) {
369
+ context.throw(400, "Invalid upstream node");
370
+ }
371
+ const sameUpstream = (instance.upstreamId ?? null) == (upstreamId ?? null);
372
+ const sameBranchIndex = (instance.branchIndex ?? null) == (branchIndex ?? null);
373
+ if (sameUpstream && sameBranchIndex) {
374
+ context.throw(400, "Node does not need to be moved");
375
+ }
376
+ const { upstream: oldUpstream, downstream: oldDownstream } = instance.get();
377
+ if (oldUpstream && oldUpstream.downstreamId === instance.id) {
378
+ await oldUpstream.update(
379
+ {
380
+ downstreamId: oldDownstream ? oldDownstream.id : null
381
+ },
382
+ { transaction }
383
+ );
384
+ }
385
+ if (oldDownstream && oldDownstream.upstreamId === instance.id) {
386
+ await oldDownstream.update(
387
+ {
388
+ upstreamId: oldUpstream ? oldUpstream.id : null,
389
+ branchIndex: instance.branchIndex ?? null
390
+ },
391
+ { transaction }
392
+ );
393
+ }
394
+ let targetUpstream = null;
395
+ if (upstreamId != null) {
396
+ targetUpstream = await repository.findOne({
397
+ filterByTk: upstreamId,
398
+ fields,
399
+ transaction
400
+ });
401
+ if (!targetUpstream) {
402
+ context.throw(404, "Upstream node not found");
403
+ }
404
+ if (targetUpstream.workflowId !== instance.workflowId) {
405
+ context.throw(400, "Upstream node is not in the same workflow");
406
+ }
407
+ }
408
+ let newDownstream = null;
409
+ if (!targetUpstream) {
410
+ const previousHead = await repository.findOne({
411
+ filter: {
412
+ workflowId: instance.workflowId,
413
+ upstreamId: null,
414
+ id: {
415
+ [import_database.Op.ne]: instance.id
416
+ }
417
+ },
418
+ fields,
419
+ transaction
420
+ });
421
+ if (previousHead) {
422
+ await previousHead.update(
423
+ {
424
+ upstreamId: instance.id,
425
+ branchIndex: null
426
+ },
427
+ { transaction }
428
+ );
429
+ newDownstream = previousHead;
430
+ }
431
+ await instance.update(
432
+ {
433
+ upstreamId: null,
434
+ branchIndex: null,
435
+ downstreamId: newDownstream ? newDownstream.id : null
436
+ },
437
+ { transaction }
438
+ );
439
+ return instance;
440
+ }
441
+ if (branchIndex == null) {
442
+ if (targetUpstream.downstreamId) {
443
+ newDownstream = await repository.findOne({
444
+ filterByTk: targetUpstream.downstreamId,
445
+ fields,
446
+ transaction
447
+ });
448
+ }
449
+ if (newDownstream) {
450
+ await newDownstream.update(
451
+ {
452
+ upstreamId: instance.id,
453
+ branchIndex: null
454
+ },
455
+ { transaction }
456
+ );
457
+ }
458
+ await targetUpstream.update(
459
+ {
460
+ downstreamId: instance.id
461
+ },
462
+ { transaction }
463
+ );
464
+ await instance.update(
465
+ {
466
+ upstreamId: targetUpstream.id,
467
+ branchIndex: null,
468
+ downstreamId: newDownstream ? newDownstream.id : null
469
+ },
470
+ { transaction }
471
+ );
472
+ return instance;
473
+ }
474
+ const branchHead = await repository.findOne({
475
+ filter: {
476
+ upstreamId: targetUpstream.id,
477
+ branchIndex
478
+ },
479
+ fields,
480
+ transaction
481
+ });
482
+ if (branchHead) {
483
+ await branchHead.update(
484
+ {
485
+ upstreamId: instance.id,
486
+ branchIndex: null
487
+ },
488
+ { transaction }
489
+ );
490
+ newDownstream = branchHead;
491
+ }
492
+ await instance.update(
493
+ {
494
+ upstreamId: targetUpstream.id,
495
+ branchIndex,
496
+ downstreamId: newDownstream ? newDownstream.id : null
497
+ },
498
+ { transaction }
499
+ );
500
+ return instance;
501
+ });
502
+ await next();
503
+ }
339
504
  async function update(context, next) {
340
505
  const { db } = context;
341
506
  const repository = import_actions.utils.getRepositoryFromParams(context);
@@ -385,6 +550,7 @@ async function test(context, next) {
385
550
  create,
386
551
  destroy,
387
552
  destroyBranch,
553
+ move,
388
554
  test,
389
555
  update
390
556
  });
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.0.0-alpha.67",
9
+ "version": "2.0.0-alpha.68",
10
10
  "license": "AGPL-3.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow",
@@ -48,7 +48,7 @@
48
48
  "@nocobase/test": "2.x",
49
49
  "@nocobase/utils": "2.x"
50
50
  },
51
- "gitHead": "1fa998002c2e78c777fb4134799f15ea0f4e6cea",
51
+ "gitHead": "3f34be3bf31b710ba427ab6b48a8c3bda8d9ee04",
52
52
  "keywords": [
53
53
  "Workflow"
54
54
  ]