@nocobase/plugin-workflow 2.0.0-alpha.24 → 2.0.0-alpha.26

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.
@@ -140,9 +140,9 @@ export declare const executionSchema: {
140
140
  unique?: undefined;
141
141
  onDelete?: undefined;
142
142
  } | {
143
- interface: string;
144
143
  type: string;
145
144
  name: string;
145
+ interface: string;
146
146
  uiSchema: {
147
147
  type: string;
148
148
  title: string;
@@ -129,9 +129,9 @@ declare const _default: {
129
129
  unique?: undefined;
130
130
  onDelete?: undefined;
131
131
  } | {
132
- interface: string;
133
132
  type: string;
134
133
  name: string;
134
+ interface: string;
135
135
  uiSchema: {
136
136
  type: string;
137
137
  title: string;
@@ -115,9 +115,9 @@ var executions_default = {
115
115
  name: "output"
116
116
  },
117
117
  {
118
- interface: "createdAt",
119
118
  type: "datetime",
120
119
  name: "createdAt",
120
+ interface: "createdAt",
121
121
  uiSchema: {
122
122
  type: "datetime",
123
123
  title: `{{t("Triggered at", { ns: "${import_constants.NAMESPACE}" })}}`,
@@ -125,6 +125,18 @@ var executions_default = {
125
125
  "x-component-props": {},
126
126
  "x-read-pretty": true
127
127
  }
128
+ },
129
+ {
130
+ type: "boolean",
131
+ name: "manually",
132
+ interface: "checkbox",
133
+ uiSchema: {
134
+ type: "boolean",
135
+ title: `{{t("Triggered manually", { ns: "${import_constants.NAMESPACE}" })}}`,
136
+ "x-component": "Checkbox",
137
+ "x-component-props": {},
138
+ "x-read-pretty": true
139
+ }
128
140
  }
129
141
  ],
130
142
  indexes: [{ fields: ["dispatched", "id"] }]
@@ -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.24",
15
- "@nocobase/utils": "2.0.0-alpha.24",
14
+ "@nocobase/client": "2.0.0-alpha.26",
15
+ "@nocobase/utils": "2.0.0-alpha.26",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "react-router-dom": "6.30.1",
@@ -20,17 +20,17 @@ 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/plugin-mobile": "2.0.0-alpha.24",
23
+ "@nocobase/plugin-mobile": "2.0.0-alpha.26",
24
24
  "sequelize": "6.35.2",
25
- "@nocobase/database": "2.0.0-alpha.24",
26
- "@nocobase/server": "2.0.0-alpha.24",
27
- "@nocobase/data-source-manager": "2.0.0-alpha.24",
28
- "@nocobase/logger": "2.0.0-alpha.24",
29
- "@nocobase/evaluators": "2.0.0-alpha.24",
25
+ "@nocobase/database": "2.0.0-alpha.26",
26
+ "@nocobase/server": "2.0.0-alpha.26",
27
+ "@nocobase/data-source-manager": "2.0.0-alpha.26",
28
+ "@nocobase/logger": "2.0.0-alpha.26",
29
+ "@nocobase/evaluators": "2.0.0-alpha.26",
30
30
  "@formily/antd-v5": "1.2.3",
31
31
  "@formily/reactive": "2.3.7",
32
- "@nocobase/actions": "2.0.0-alpha.24",
32
+ "@nocobase/actions": "2.0.0-alpha.26",
33
33
  "dayjs": "1.11.13",
34
- "@nocobase/plugin-workflow-test": "2.0.0-alpha.24",
35
- "@nocobase/test": "2.0.0-alpha.24"
34
+ "@nocobase/plugin-workflow-test": "2.0.0-alpha.26",
35
+ "@nocobase/test": "2.0.0-alpha.26"
36
36
  };
@@ -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":"2025-10-26T10:32:12.906Z"}
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":"2025-10-30T01:02:38.717Z"}
@@ -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":"2025-10-26T10:32:12.547Z"}
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":"2025-10-30T01:02:38.364Z"}
@@ -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":"2025-10-26T10:32:12.339Z"}
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":"2025-10-30T01:02:38.171Z"}
@@ -14,7 +14,7 @@ import type PluginWorkflowServer from './Plugin';
14
14
  type Pending = {
15
15
  execution: ExecutionModel;
16
16
  job?: JobModel;
17
- force?: boolean;
17
+ loaded?: boolean;
18
18
  };
19
19
  export type EventOptions = {
20
20
  eventKey?: string;
@@ -38,7 +38,7 @@ export default class Dispatcher {
38
38
  constructor(plugin: PluginWorkflowServer);
39
39
  readonly onQueueExecution: QueueEventOptions['process'];
40
40
  setReady(ready: boolean): void;
41
- isReady(): boolean;
41
+ private serving;
42
42
  getEventsCount(): number;
43
43
  trigger(workflow: WorkflowModel, context: object, options?: EventOptions): void | Promise<Processor | null>;
44
44
  resume(job: any): Promise<void>;
@@ -62,8 +62,8 @@ class Dispatcher {
62
62
  setReady(ready) {
63
63
  this.ready = ready;
64
64
  }
65
- isReady() {
66
- return this.ready;
65
+ serving() {
66
+ return this.plugin.app.serving(WORKER_JOB_WORKFLOW_PROCESS);
67
67
  }
68
68
  getEventsCount() {
69
69
  return this.eventsCount;
@@ -112,14 +112,14 @@ class Dispatcher {
112
112
  execution = await job.getExecution();
113
113
  }
114
114
  this.plugin.getLogger(execution.workflowId).info(`execution (${execution.id}) resuming from job (${job.id}) added to pending list`);
115
- this.run({ execution, job, force: true });
115
+ this.run({ execution, job, loaded: true });
116
116
  }
117
117
  async start(execution) {
118
118
  if (execution.status) {
119
119
  return;
120
120
  }
121
121
  this.plugin.getLogger(execution.workflowId).info(`starting deferred execution (${execution.id})`);
122
- this.run({ execution, force: true });
122
+ this.run({ execution, loaded: true });
123
123
  }
124
124
  async beforeStop() {
125
125
  this.ready = false;
@@ -135,10 +135,6 @@ class Dispatcher {
135
135
  this.plugin.getLogger("dispatcher").warn(`app is not ready, new dispatching will be ignored`);
136
136
  return;
137
137
  }
138
- if (!this.plugin.app.serving(WORKER_JOB_WORKFLOW_PROCESS)) {
139
- this.plugin.getLogger("dispatcher").warn(`${WORKER_JOB_WORKFLOW_PROCESS} is not serving, new dispatching will be ignored`);
140
- return;
141
- }
142
138
  if (this.executing) {
143
139
  this.plugin.getLogger("dispatcher").warn(`workflow executing is not finished, new dispatching will be ignored`);
144
140
  return;
@@ -151,12 +147,16 @@ class Dispatcher {
151
147
  let execution = null;
152
148
  if (this.pending.length) {
153
149
  const pending = this.pending.shift();
154
- execution = pending.force ? pending.execution : await this.acquirePendingExecution(pending.execution);
150
+ execution = pending.loaded ? pending.execution : await this.acquirePendingExecution(pending.execution);
155
151
  if (execution) {
156
152
  next = [execution, pending.job];
157
153
  this.plugin.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
158
154
  }
159
155
  } else {
156
+ if (!this.serving()) {
157
+ this.plugin.getLogger("dispatcher").warn(`${WORKER_JOB_WORKFLOW_PROCESS} is not serving on this instance, new dispatching will be ignored`);
158
+ return;
159
+ }
160
160
  execution = await this.acquireQueueingExecution();
161
161
  if (execution) {
162
162
  next = [execution];
@@ -237,7 +237,8 @@ class Dispatcher {
237
237
  key: workflow.key,
238
238
  eventKey: options.eventKey ?? (0, import_crypto.randomUUID)(),
239
239
  stack: options.stack,
240
- dispatched: deferred ?? false
240
+ dispatched: deferred ?? false,
241
+ manually: options.manually
241
242
  },
242
243
  { transaction }
243
244
  );
@@ -283,11 +284,13 @@ class Dispatcher {
283
284
  try {
284
285
  const execution = await this.createExecution(...event);
285
286
  if (!(execution == null ? void 0 : execution.dispatched)) {
286
- if (!this.executing && !this.pending.length) {
287
+ if (this.serving() && !this.executing && !this.pending.length) {
287
288
  logger.info(`local pending list is empty, adding execution (${execution.id}) to pending list`);
288
289
  this.pending.push({ execution });
289
290
  } else {
290
- logger.info(`local pending list is not empty, sending execution (${execution.id}) to queue`);
291
+ logger.info(
292
+ `instance is not serving as worker or local pending list is not empty, sending execution (${execution.id}) to queue`
293
+ );
291
294
  if (this.ready) {
292
295
  this.plugin.app.backgroundJobManager.publish(`${this.plugin.name}.pendingExecution`, {
293
296
  executionId: execution.id
@@ -158,7 +158,7 @@ async function destroy(context, next) {
158
158
  const repository = import_actions.utils.getRepositoryFromParams(context);
159
159
  const { filterByTk, keepBranch } = context.action.params;
160
160
  const keepBranchIndex = keepBranch == null || keepBranch === "" ? null : Number.parseInt(keepBranch, 10);
161
- const fields = ["id", "upstreamId", "downstreamId", "branchIndex"];
161
+ const fields = ["id", "upstreamId", "downstreamId", "branchIndex", "key"];
162
162
  const instance = await repository.findOne({
163
163
  filterByTk,
164
164
  fields: [...fields, "workflowId"],
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
6
6
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
7
- "version": "2.0.0-alpha.24",
7
+ "version": "2.0.0-alpha.26",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow",
@@ -45,7 +45,7 @@
45
45
  "@nocobase/test": "2.x",
46
46
  "@nocobase/utils": "2.x"
47
47
  },
48
- "gitHead": "4e6d1ae61143f01aba213355b4c416aab4d64077",
48
+ "gitHead": "3f9e6825dfefabec9640dc46783955174275df04",
49
49
  "keywords": [
50
50
  "Workflow"
51
51
  ]