@nocobase/plugin-workflow-javascript 2.2.0-beta.17 → 2.2.0-beta.18

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.
@@ -8,13 +8,13 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-beta.17",
12
- "@nocobase/plugin-workflow": "2.2.0-beta.17",
13
- "@nocobase/flow-engine": "2.2.0-beta.17",
11
+ "@nocobase/client": "2.2.0-beta.18",
12
+ "@nocobase/plugin-workflow": "2.2.0-beta.18",
13
+ "@nocobase/flow-engine": "2.2.0-beta.18",
14
14
  "react-i18next": "11.18.6",
15
- "@nocobase/client-v2": "2.2.0-beta.17",
15
+ "@nocobase/client-v2": "2.2.0-beta.18",
16
16
  "winston": "3.13.0",
17
- "@nocobase/server": "2.2.0-beta.17",
17
+ "@nocobase/server": "2.2.0-beta.18",
18
18
  "sequelize": "6.35.2",
19
19
  "antd": "5.24.2",
20
20
  "@emotion/css": "11.13.0",
@@ -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-10T16:51:51.300Z"}
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-20T12:48:15.224Z"}
@@ -1 +1 @@
1
- {"name":"winston-transport","description":"Base stream implementations for winston@3 and up.","version":"4.7.0","main":"index.js","browser":"dist/index.js","scripts":{"lint":"eslint test/*.js index.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist","pretest":"npm run lint && npm run build","test":"nyc mocha test/*.test.js","report":"nyc report --reporter=lcov","build":"rimraf dist && babel *.js -d ./dist","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git@github.com:winstonjs/winston-transport.git"},"keywords":["winston","transport","winston3"],"author":"Charlie Robbins <charlie.robbins@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/winstonjs/winston-transport/issues"},"homepage":"https://github.com/winstonjs/winston-transport#readme","dependencies":{"logform":"^2.3.2","readable-stream":"^3.6.0","triple-beam":"^1.3.0"},"devDependencies":{"@types/node":"^20.8.6","abstract-winston-transport":">=0.5.1","assume":"^2.3.0","babel-cli":"^6.26.0","babel-preset-env":"^1.7.0","deep-equal":"^2.0.5","eslint":"^8.8.0","@dabh/eslint-config-populist":"^5.0.0","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^5.0.5","winston-compat":"^0.1.5"},"engines":{"node":">= 12.0.0"},"_lastModified":"2026-08-10T16:51:52.009Z"}
1
+ {"name":"winston-transport","description":"Base stream implementations for winston@3 and up.","version":"4.7.0","main":"index.js","browser":"dist/index.js","scripts":{"lint":"eslint test/*.js index.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist","pretest":"npm run lint && npm run build","test":"nyc mocha test/*.test.js","report":"nyc report --reporter=lcov","build":"rimraf dist && babel *.js -d ./dist","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git@github.com:winstonjs/winston-transport.git"},"keywords":["winston","transport","winston3"],"author":"Charlie Robbins <charlie.robbins@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/winstonjs/winston-transport/issues"},"homepage":"https://github.com/winstonjs/winston-transport#readme","dependencies":{"logform":"^2.3.2","readable-stream":"^3.6.0","triple-beam":"^1.3.0"},"devDependencies":{"@types/node":"^20.8.6","abstract-winston-transport":">=0.5.1","assume":"^2.3.0","babel-cli":"^6.26.0","babel-preset-env":"^1.7.0","deep-equal":"^2.0.5","eslint":"^8.8.0","@dabh/eslint-config-populist":"^5.0.0","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^5.0.5","winston-compat":"^0.1.5"},"engines":{"node":">= 12.0.0"},"_lastModified":"2026-08-20T12:48:15.870Z"}
@@ -35,6 +35,7 @@ var import_constants = require("../common/constants");
35
35
  const RECOVERY_BATCH_SIZE = 100;
36
36
  const RECOVERY_MAX_SCAN_SIZE = 1e3;
37
37
  const RECOVERY_INTERVAL = 6e4;
38
+ const RECOVERY_GRACE_PERIOD = RECOVERY_INTERVAL;
38
39
  class TaskRecovery {
39
40
  constructor(workflowPlugin, taskQueueChannel) {
40
41
  this.workflowPlugin = workflowPlugin;
@@ -85,14 +86,19 @@ class TaskRecovery {
85
86
  async republishQueuedJobs() {
86
87
  let cursor = null;
87
88
  let scanned = 0;
88
- const staleBefore = new Date(Date.now() - 12e4);
89
+ const now = /* @__PURE__ */ new Date();
90
+ const recoverableBefore = new Date(now.getTime() - RECOVERY_GRACE_PERIOD);
91
+ const staleBefore = new Date(now.getTime() - 12e4);
89
92
  const logger = this.workflowPlugin.getLogger("javascript");
90
93
  const JobModel = this.workflowPlugin.db.getModel("jobs");
91
94
  while (scanned < RECOVERY_MAX_SCAN_SIZE) {
92
95
  const jobs = await JobModel.findAll({
93
96
  where: {
94
97
  ...cursor == null ? {} : { id: { [import_sequelize.Op.gt]: cursor } },
95
- status: import_plugin_workflow.JOB_STATUS.PENDING
98
+ status: import_plugin_workflow.JOB_STATUS.PENDING,
99
+ createdAt: {
100
+ [import_sequelize.Op.lt]: recoverableBefore
101
+ }
96
102
  },
97
103
  attributes: ["id", "startedAt", "updatedAt"],
98
104
  include: [
@@ -103,6 +109,22 @@ class TaskRecovery {
103
109
  type: import_constants.SCRIPT_INSTRUCTION_TYPE
104
110
  },
105
111
  required: true
112
+ },
113
+ {
114
+ association: "execution",
115
+ attributes: [],
116
+ where: {
117
+ status: import_plugin_workflow.EXECUTION_STATUS.STARTED,
118
+ [import_sequelize.Op.or]: [
119
+ { expiresAt: null },
120
+ {
121
+ expiresAt: {
122
+ [import_sequelize.Op.gt]: now
123
+ }
124
+ }
125
+ ]
126
+ },
127
+ required: true
106
128
  }
107
129
  ],
108
130
  order: [["id", "ASC"]],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow-javascript",
3
- "version": "2.2.0-beta.17",
3
+ "version": "2.2.0-beta.18",
4
4
  "displayName": "Workflow: JavaScript",
5
5
  "displayName.zh-CN": "工作流:JavaScript 节点",
6
6
  "description": "Execute a piece of JavaScript in an isolated Node.js environment.",
@@ -35,5 +35,5 @@
35
35
  "Workflow"
36
36
  ],
37
37
  "license": "Apache-2.0",
38
- "gitHead": "d7a69c4f47fe38b17a2ce1408258902cf64f6c83"
38
+ "gitHead": "b74c962f7d35aa12012d908d16bd74fe6ac20a3d"
39
39
  }