@nocobase/plugin-workflow 0.9.2-alpha.1 → 0.9.2-alpha.3

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.
Files changed (66) hide show
  1. package/lib/client/AddButton.js +1 -3
  2. package/lib/client/Branch.d.ts +1 -1
  3. package/lib/client/ExecutionCanvas.js +1 -1
  4. package/lib/client/FlowContext.d.ts +1 -1
  5. package/lib/client/WorkflowProvider.js +0 -1
  6. package/lib/client/components/CollectionFieldset.d.ts +1 -1
  7. package/lib/client/components/CollectionFieldset.js +13 -13
  8. package/lib/client/components/Duration.js +3 -3
  9. package/lib/client/components/DynamicExpression.d.ts +1 -1
  10. package/lib/client/components/RadioWithTooltip.js +4 -4
  11. package/lib/client/components/renderEngineReference.js +3 -2
  12. package/lib/client/interfaces/expression.d.ts +1 -1
  13. package/lib/client/locale/en-US.d.ts +70 -70
  14. package/lib/client/locale/en-US.js +115 -115
  15. package/lib/client/locale/ja-JP.d.ts +57 -57
  16. package/lib/client/locale/ja-JP.js +85 -85
  17. package/lib/client/locale/pt-BR.d.ts +70 -70
  18. package/lib/client/locale/pt-BR.js +115 -115
  19. package/lib/client/locale/ru-RU.d.ts +57 -57
  20. package/lib/client/locale/ru-RU.js +85 -85
  21. package/lib/client/locale/tr-TR.d.ts +57 -57
  22. package/lib/client/locale/tr-TR.js +85 -85
  23. package/lib/client/locale/zh-CN.js +55 -55
  24. package/lib/client/nodes/calculation.js +6 -6
  25. package/lib/client/nodes/condition.d.ts +3 -3
  26. package/lib/client/nodes/condition.js +46 -42
  27. package/lib/client/nodes/delay.d.ts +1 -1
  28. package/lib/client/nodes/index.js +35 -37
  29. package/lib/client/nodes/manual/ModeConfig.js +5 -5
  30. package/lib/client/nodes/manual/SchemaConfig.js +2 -5
  31. package/lib/client/nodes/manual/WorkflowTodo.js +3 -3
  32. package/lib/client/nodes/manual/forms/customForm.js +1 -2
  33. package/lib/client/nodes/parallel.d.ts +1 -1
  34. package/lib/client/nodes/parallel.js +6 -6
  35. package/lib/client/nodes/request.d.ts +2 -0
  36. package/lib/client/nodes/request.js +7 -5
  37. package/lib/client/style.js +67 -63
  38. package/lib/client/triggers/index.d.ts +4 -4
  39. package/lib/client/triggers/index.js +5 -7
  40. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +1 -1
  41. package/lib/client/triggers/schedule/EndsByField.js +3 -3
  42. package/lib/client/triggers/schedule/OnField.js +3 -3
  43. package/lib/client/triggers/schedule/RepeatField.js +16 -16
  44. package/lib/client/triggers/schedule/ScheduleConfig.js +2 -2
  45. package/lib/client/utils.js +1 -1
  46. package/lib/client/variable.js +4 -4
  47. package/lib/server/Processor.js +1 -1
  48. package/lib/server/functions/index.d.ts +1 -1
  49. package/lib/server/functions/index.js +1 -2
  50. package/lib/server/instructions/calculation.d.ts +1 -1
  51. package/lib/server/instructions/condition.d.ts +2 -2
  52. package/lib/server/instructions/create.d.ts +1 -1
  53. package/lib/server/instructions/destroy.d.ts +1 -1
  54. package/lib/server/instructions/manual/index.js +1 -2
  55. package/lib/server/instructions/parallel.d.ts +3 -3
  56. package/lib/server/instructions/query.d.ts +2 -2
  57. package/lib/server/instructions/request.js +0 -1
  58. package/lib/server/instructions/update.d.ts +2 -2
  59. package/lib/server/migrations/20230221071831-calculation-expression.js +11 -11
  60. package/lib/server/migrations/20230221121203-condition-calculation.js +6 -6
  61. package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -5
  62. package/lib/server/migrations/20230411034722-manual-multi-form.js +3 -2
  63. package/lib/server/triggers/collection.d.ts +2 -2
  64. package/lib/server/triggers/collection.js +2 -2
  65. package/lib/server/triggers/schedule.js +26 -20
  66. package/package.json +12 -12
@@ -22,16 +22,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
22
22
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
23
23
  class _default extends _server().Migration {
24
24
  up() {
25
- var _arguments = arguments,
26
- _this = this;
25
+ var _this = this;
27
26
  return _asyncToGenerator(function* () {
28
27
  const match = yield _this.app.version.satisfies('<0.9.0-alpha.3');
29
28
  if (!match) {
30
29
  return;
31
30
  }
32
- const _arguments$0$context = _arguments[0].context,
33
- sequelize = _arguments$0$context.sequelize,
34
- queryInterface = _arguments$0$context.queryInterface;
31
+ const sequelize = _this.sequelize;
32
+ const queryInterface = _this.queryInterface;
35
33
  const db = _this.app.db;
36
34
  yield sequelize.transaction( /*#__PURE__*/function () {
37
35
  var _ref = _asyncToGenerator(function* (transaction) {
@@ -185,7 +185,7 @@ function migrateUsedConfig(config, manualForms) {
185
185
  }
186
186
  return `{{$jobsMapByNodeId.${id}.${manualForms[id]}${path || ''}}}`;
187
187
  });
188
- } else if (valueType === 'object') {
188
+ } else if (valueType === 'object' && config[key]) {
189
189
  migrateUsedConfig(config[key], manualForms);
190
190
  }
191
191
  });
@@ -285,8 +285,9 @@ class _default extends _server().Migration {
285
285
  }
286
286
  });
287
287
  yield usedNodes.reduce((promise, node) => promise.then( /*#__PURE__*/_asyncToGenerator(function* () {
288
+ var _node$config2;
288
289
  yield node.update({
289
- config: migrateUsedConfig((0, _lodash().cloneDeep)(node.config), nodeForms)
290
+ config: migrateUsedConfig((0, _lodash().cloneDeep)((_node$config2 = node.config) !== null && _node$config2 !== void 0 ? _node$config2 : {}), nodeForms)
290
291
  }, {
291
292
  silent: true,
292
293
  transaction
@@ -1,5 +1,5 @@
1
- import { Trigger } from "..";
2
- import WorkflowModel from "../models/Workflow";
1
+ import { Trigger } from '..';
2
+ import WorkflowModel from '../models/Workflow';
3
3
  export interface CollectionChangeTriggerConfig {
4
4
  collection: string;
5
5
  mode: number;
@@ -112,7 +112,7 @@ class CollectionTrigger extends _.Trigger {
112
112
  _step;
113
113
  try {
114
114
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
115
- let _step$value = _slicedToArray(_step.value, 2),
115
+ const _step$value = _slicedToArray(_step.value, 2),
116
116
  key = _step$value[0],
117
117
  type = _step$value[1];
118
118
  const event = `${collection}.${type}`;
@@ -150,7 +150,7 @@ class CollectionTrigger extends _.Trigger {
150
150
  _step2;
151
151
  try {
152
152
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
153
- let _step2$value = _slicedToArray(_step2.value, 2),
153
+ const _step2$value = _slicedToArray(_step2.value, 2),
154
154
  key = _step2$value[0],
155
155
  type = _step2$value[1];
156
156
  const event = `${collection}.${type}`;
@@ -106,18 +106,20 @@ function getOnTimestampWithOffset(on, now) {
106
106
  case 'string':
107
107
  return parseDateWithoutMs(on);
108
108
  case 'object':
109
- const field = on.field,
110
- _on$offset = on.offset,
111
- offset = _on$offset === void 0 ? 0 : _on$offset,
112
- _on$unit = on.unit,
113
- unit = _on$unit === void 0 ? 1000 : _on$unit;
114
- if (!field) {
115
- return null;
109
+ {
110
+ const field = on.field,
111
+ _on$offset = on.offset,
112
+ offset = _on$offset === void 0 ? 0 : _on$offset,
113
+ _on$unit = on.unit,
114
+ unit = _on$unit === void 0 ? 1000 : _on$unit;
115
+ if (!field) {
116
+ return null;
117
+ }
118
+ const timestamp = now.getTime();
119
+ // onDate + offset > now
120
+ // onDate > now - offset
121
+ return timestamp - offset * unit;
116
122
  }
117
- const timestamp = now.getTime();
118
- // onDate + offset > now
119
- // onDate > now - offset
120
- return timestamp - offset * unit;
121
123
  default:
122
124
  return null;
123
125
  }
@@ -128,15 +130,19 @@ function getDataOptionTime(data, on, dir = 1) {
128
130
  }
129
131
  switch (typeof on) {
130
132
  case 'string':
131
- const time = parseDateWithoutMs(on);
132
- return time ? time : null;
133
+ {
134
+ const time = parseDateWithoutMs(on);
135
+ return time ? time : null;
136
+ }
133
137
  case 'object':
134
- const field = on.field,
135
- _on$offset2 = on.offset,
136
- offset = _on$offset2 === void 0 ? 0 : _on$offset2,
137
- _on$unit2 = on.unit,
138
- unit = _on$unit2 === void 0 ? 1000 : _on$unit2;
139
- return data.get(field) ? data.get(field).getTime() - offset * unit * dir : null;
138
+ {
139
+ const field = on.field,
140
+ _on$offset2 = on.offset,
141
+ offset = _on$offset2 === void 0 ? 0 : _on$offset2,
142
+ _on$unit2 = on.unit,
143
+ unit = _on$unit2 === void 0 ? 1000 : _on$unit2;
144
+ return data.get(field) ? data.get(field).getTime() - offset * unit * dir : null;
145
+ }
140
146
  default:
141
147
  return null;
142
148
  }
@@ -365,7 +371,7 @@ function matchNext(workflow, now, range = this.cacheCycle) {
365
371
  const interval = _cronParser().default.parseExpression(repeat, {
366
372
  currentDate
367
373
  });
368
- let next = interval.next();
374
+ const next = interval.next();
369
375
  // NOTE: cache all workflows will be matched in current cycle
370
376
  if (next.getTime() - timestamp <= range) {
371
377
  return true;
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow",
3
- "version": "0.9.2-alpha.1",
3
+ "version": "0.9.2-alpha.3",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
7
7
  "types": "./lib/index.d.ts",
8
8
  "dependencies": {
9
- "@nocobase/actions": "0.9.2-alpha.1",
10
- "@nocobase/client": "0.9.2-alpha.1",
11
- "@nocobase/database": "0.9.2-alpha.1",
12
- "@nocobase/evaluators": "0.9.2-alpha.1",
13
- "@nocobase/logger": "0.9.2-alpha.1",
14
- "@nocobase/resourcer": "0.9.2-alpha.1",
15
- "@nocobase/server": "0.9.2-alpha.1",
16
- "@nocobase/utils": "0.9.2-alpha.1",
9
+ "@nocobase/actions": "0.9.2-alpha.3",
10
+ "@nocobase/client": "0.9.2-alpha.3",
11
+ "@nocobase/database": "0.9.2-alpha.3",
12
+ "@nocobase/evaluators": "0.9.2-alpha.3",
13
+ "@nocobase/logger": "0.9.2-alpha.3",
14
+ "@nocobase/resourcer": "0.9.2-alpha.3",
15
+ "@nocobase/server": "0.9.2-alpha.3",
16
+ "@nocobase/utils": "0.9.2-alpha.3",
17
17
  "antd": "4.22.8",
18
18
  "axios": "^0.27.2",
19
19
  "classnames": "^2.3.1",
@@ -24,9 +24,9 @@
24
24
  "react-js-cron": "^3.1.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@nocobase/plugin-formula-field": "0.9.2-alpha.1",
28
- "@nocobase/test": "0.9.2-alpha.1",
27
+ "@nocobase/plugin-formula-field": "0.9.2-alpha.3",
28
+ "@nocobase/test": "0.9.2-alpha.3",
29
29
  "@types/ejs": "^3.1.1"
30
30
  },
31
- "gitHead": "a4f103eb0144f07205aff7b2a6be8ea6aa1330df"
31
+ "gitHead": "b6b5f9372202d942c97d2d90a4197e060db05124"
32
32
  }