@nocobase/plugin-workflow 0.20.0-alpha.9 → 0.21.0-alpha.2

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 (37) hide show
  1. package/dist/client/ExecutionContextProvider.d.ts +7 -0
  2. package/dist/client/components/CollectionBlockInitializer.d.ts +1 -1
  3. package/dist/client/components/DetailsBlockProvider.d.ts +6 -0
  4. package/dist/client/components/SimpleDesigner.d.ts +2 -0
  5. package/dist/client/components/TriggerOptionRender.d.ts +4 -0
  6. package/dist/client/components/ValueBlock.d.ts +1 -0
  7. package/dist/client/components/index.d.ts +2 -0
  8. package/dist/client/hooks/index.d.ts +3 -0
  9. package/dist/client/hooks/useWorkflowExecuted.d.ts +2 -0
  10. package/dist/client/index.d.ts +12 -12
  11. package/dist/client/index.js +40 -40
  12. package/dist/client/nodes/calculation.d.ts +1 -0
  13. package/dist/client/nodes/create.d.ts +2 -5
  14. package/dist/client/nodes/destroy.d.ts +5 -8
  15. package/dist/client/nodes/query.d.ts +5 -8
  16. package/dist/client/nodes/update.d.ts +6 -9
  17. package/dist/client/schemas/collection.d.ts +5 -8
  18. package/dist/client/triggers/collection.d.ts +11 -9
  19. package/dist/client/triggers/schedule/OnField.d.ts +1 -1
  20. package/dist/client/utils.d.ts +2 -1
  21. package/dist/externalVersion.js +11 -10
  22. package/dist/locale/zh-CN.json +3 -3
  23. package/dist/node_modules/cron-parser/package.json +1 -1
  24. package/dist/node_modules/lru-cache/package.json +1 -1
  25. package/dist/server/Plugin.d.ts +3 -1
  26. package/dist/server/Plugin.js +20 -8
  27. package/dist/server/collections/executions.js +1 -1
  28. package/dist/server/instructions/CreateInstruction.js +7 -4
  29. package/dist/server/instructions/DestroyInstruction.js +5 -3
  30. package/dist/server/instructions/QueryInstruction.js +5 -3
  31. package/dist/server/instructions/UpdateInstruction.js +5 -3
  32. package/dist/server/migrations/20230411034722-manual-multi-form.js +3 -5
  33. package/dist/server/migrations/20230612021134-manual-collection-block.js +2 -4
  34. package/dist/server/triggers/CollectionTrigger.js +33 -22
  35. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +18 -10
  36. package/package.json +3 -3
  37. package/dist/client/constant.d.ts +0 -2
@@ -51,6 +51,7 @@ export default class extends Instruction {
51
51
  ValueBlock: (() => JSX.Element) & {
52
52
  Initializer: () => JSX.Element;
53
53
  Result: (props: any) => JSX.Element;
54
+ Designer: () => JSX.Element;
54
55
  };
55
56
  };
56
57
  useVariables({ key, title }: {
@@ -8,15 +8,12 @@ export default class extends Instruction {
8
8
  description: string;
9
9
  fieldset: {
10
10
  collection: {
11
+ 'x-reactions': any[];
11
12
  type: string;
12
13
  title: string;
13
14
  required: boolean;
14
- 'x-reactions': any[];
15
15
  'x-decorator': string;
16
16
  'x-component': string;
17
- 'x-component-props': {
18
- className: string;
19
- };
20
17
  };
21
18
  params: {
22
19
  type: string;
@@ -24,13 +21,13 @@ export default class extends Instruction {
24
21
  values: {
25
22
  type: string;
26
23
  title: string;
24
+ description: string;
27
25
  'x-decorator': string;
28
26
  'x-decorator-props': {
29
27
  labelAlign: string;
30
28
  className: string;
31
29
  };
32
30
  'x-component': string;
33
- description: string;
34
31
  };
35
32
  appends: {
36
33
  type: string;
@@ -8,15 +8,12 @@ export default class extends Instruction {
8
8
  description: string;
9
9
  fieldset: {
10
10
  collection: {
11
+ 'x-reactions': any[];
11
12
  type: string;
12
13
  title: string;
13
14
  required: boolean;
14
- 'x-reactions': any[];
15
15
  'x-decorator': string;
16
16
  'x-component': string;
17
- 'x-component-props': {
18
- className: string;
19
- };
20
17
  };
21
18
  params: {
22
19
  type: string;
@@ -27,11 +24,11 @@ export default class extends Instruction {
27
24
  title: string;
28
25
  'x-decorator': string;
29
26
  'x-component': string;
27
+ 'x-use-component-props': () => {
28
+ options: any[];
29
+ className: string;
30
+ };
30
31
  'x-component-props': {
31
- useProps(): {
32
- options: any[];
33
- className: string;
34
- };
35
32
  dynamicComponent: string;
36
33
  };
37
34
  };
@@ -10,15 +10,12 @@ export default class extends Instruction {
10
10
  description: string;
11
11
  fieldset: {
12
12
  collection: {
13
+ 'x-reactions': any[];
13
14
  type: string;
14
15
  title: string;
15
16
  required: boolean;
16
- 'x-reactions': any[];
17
17
  'x-decorator': string;
18
18
  'x-component': string;
19
- 'x-component-props': {
20
- className: string;
21
- };
22
19
  };
23
20
  multiple: {
24
21
  type: string;
@@ -36,11 +33,11 @@ export default class extends Instruction {
36
33
  title: string;
37
34
  'x-decorator': string;
38
35
  'x-component': string;
36
+ 'x-use-component-props': () => {
37
+ options: any[];
38
+ className: string;
39
+ };
39
40
  'x-component-props': {
40
- useProps(): {
41
- options: any[];
42
- className: string;
43
- };
44
41
  dynamicComponent: string;
45
42
  };
46
43
  };
@@ -13,15 +13,12 @@ export default class extends Instruction {
13
13
  description: string;
14
14
  fieldset: {
15
15
  collection: {
16
+ 'x-reactions': any[];
16
17
  type: string;
17
18
  title: string;
18
19
  required: boolean;
19
- 'x-reactions': any[];
20
20
  'x-decorator': string;
21
21
  'x-component': string;
22
- 'x-component-props': {
23
- className: string;
24
- };
25
22
  };
26
23
  params: {
27
24
  type: string;
@@ -46,11 +43,11 @@ export default class extends Instruction {
46
43
  type: string;
47
44
  'x-decorator': string;
48
45
  'x-component': string;
46
+ 'x-use-component-props': () => {
47
+ options: any[];
48
+ className: string;
49
+ };
49
50
  'x-component-props': {
50
- useProps(): {
51
- options: any[];
52
- className: string;
53
- };
54
51
  dynamicComponent: string;
55
52
  };
56
53
  };
@@ -60,13 +57,13 @@ export default class extends Instruction {
60
57
  };
61
58
  type: string;
62
59
  title: string;
60
+ description: string;
63
61
  'x-decorator': string;
64
62
  'x-decorator-props': {
65
63
  labelAlign: string;
66
64
  className: string;
67
65
  };
68
66
  'x-component': string;
69
- description: string;
70
67
  };
71
68
  };
72
69
  };
@@ -5,31 +5,28 @@ export declare const collection: {
5
5
  'x-reactions': any[];
6
6
  'x-decorator': string;
7
7
  'x-component': string;
8
- 'x-component-props': {
9
- className: string;
10
- };
11
8
  };
12
9
  export declare const values: {
13
10
  type: string;
14
11
  title: string;
12
+ description: string;
15
13
  'x-decorator': string;
16
14
  'x-decorator-props': {
17
15
  labelAlign: string;
18
16
  className: string;
19
17
  };
20
18
  'x-component': string;
21
- description: string;
22
19
  };
23
20
  export declare const filter: {
24
21
  type: string;
25
22
  title: string;
26
23
  'x-decorator': string;
27
24
  'x-component': string;
25
+ 'x-use-component-props': () => {
26
+ options: any[];
27
+ className: string;
28
+ };
28
29
  'x-component-props': {
29
- useProps(): {
30
- options: any[];
31
- className: string;
32
- };
33
30
  dynamicComponent: string;
34
31
  };
35
32
  };
@@ -1,20 +1,22 @@
1
1
  /// <reference types="react" />
2
2
  import { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
3
+ import { useWorkflowAnyExecuted } from '../hooks';
3
4
  import { Trigger } from '.';
4
5
  export default class extends Trigger {
5
6
  title: string;
6
7
  description: string;
7
8
  fieldset: {
8
9
  collection: {
10
+ 'x-disabled': string;
11
+ 'x-component-props': {
12
+ dataSourceFilter(item: any): any;
13
+ };
9
14
  "x-reactions": any[];
10
15
  type: string;
11
16
  title: string;
12
17
  required: boolean;
13
18
  'x-decorator': string;
14
19
  'x-component': string;
15
- 'x-component-props': {
16
- className: string;
17
- };
18
20
  };
19
21
  mode: {
20
22
  type: string;
@@ -62,12 +64,7 @@ export default class extends Trigger {
62
64
  };
63
65
  condition: {
64
66
  title: string;
65
- 'x-component-props': {
66
- useProps: () => {
67
- options: any[];
68
- className: string;
69
- };
70
- };
67
+ 'x-component-props': {};
71
68
  'x-reactions': {
72
69
  dependencies: string[];
73
70
  fulfill: {
@@ -79,6 +76,10 @@ export default class extends Trigger {
79
76
  type: string;
80
77
  'x-decorator': string;
81
78
  'x-component': string;
79
+ 'x-use-component-props': () => {
80
+ options: any[];
81
+ className: string;
82
+ };
82
83
  };
83
84
  appends: {
84
85
  'x-reactions': {
@@ -103,6 +104,7 @@ export default class extends Trigger {
103
104
  };
104
105
  scope: {
105
106
  useCollectionDataSource: typeof useCollectionDataSource;
107
+ useWorkflowAnyExecuted: typeof useWorkflowAnyExecuted;
106
108
  };
107
109
  components: {
108
110
  FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare function OnField({ value, onChange }: {
2
+ export declare function OnField({ value: propsValue, onChange }: {
3
3
  value: any;
4
4
  onChange: any;
5
5
  }): React.JSX.Element;
@@ -1,3 +1,4 @@
1
1
  export declare function linkNodes(nodes: any): void;
2
- export declare function isValidFilter(condition: any): any;
3
2
  export declare function traverseSchema(schema: any, fn: any): void;
3
+ export declare function getWorkflowDetailPath(id: string | number): string;
4
+ export declare function getWorkflowExecutionsPath(id: string | number): string;
@@ -2,22 +2,23 @@ module.exports = {
2
2
  "react": "18.2.0",
3
3
  "antd": "5.12.8",
4
4
  "@ant-design/icons": "5.2.6",
5
- "@nocobase/client": "0.20.0-alpha.9",
5
+ "@nocobase/client": "0.21.0-alpha.2",
6
6
  "react-router-dom": "6.21.0",
7
- "@nocobase/utils": "0.20.0-alpha.9",
7
+ "@nocobase/utils": "0.21.0-alpha.2",
8
8
  "react-i18next": "11.18.6",
9
9
  "@formily/core": "2.3.0",
10
10
  "@formily/react": "2.3.0",
11
- "@nocobase/database": "0.20.0-alpha.9",
12
- "@nocobase/server": "0.20.0-alpha.9",
13
- "@nocobase/logger": "0.20.0-alpha.9",
14
- "@nocobase/evaluators": "0.20.0-alpha.9",
11
+ "@nocobase/database": "0.21.0-alpha.2",
12
+ "@nocobase/server": "0.21.0-alpha.2",
13
+ "@nocobase/logger": "0.21.0-alpha.2",
14
+ "@nocobase/evaluators": "0.21.0-alpha.2",
15
+ "@formily/shared": "2.3.0",
15
16
  "lodash": "4.17.21",
16
17
  "@formily/antd-v5": "1.1.9",
17
- "@formily/shared": "2.3.0",
18
- "@nocobase/actions": "0.20.0-alpha.9",
18
+ "@nocobase/actions": "0.21.0-alpha.2",
19
+ "@nocobase/data-source-manager": "0.21.0-alpha.2",
19
20
  "sequelize": "6.35.2",
20
- "@nocobase/plugin-workflow-test": "0.20.0-alpha.9",
21
- "@nocobase/test": "0.20.0-alpha.9",
21
+ "@nocobase/plugin-workflow-test": "0.21.0-alpha.2",
22
+ "@nocobase/test": "0.21.0-alpha.2",
22
23
  "dayjs": "1.11.10"
23
24
  };
@@ -46,8 +46,8 @@
46
46
  "Full form data": "完整表单数据",
47
47
  "Select context": "选择上下文",
48
48
  "Collection event": "数据表事件",
49
- "Event will be triggered on collection data row created, updated or deleted.":
50
- "当数据表中的数据被新增、更新或删除时触发。",
49
+ "Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike \"Post-action event\", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use \"Post-action event\".":
50
+ "当数据表中的数据发生变化时触发,比如新增、更新或删除一条数据后。与“操作后事件”不同,数据表事件监听数据变动而不是 HTTP 请求,除非你明白确切含义,否则推荐使用“操作后事件”。",
51
51
  "Trigger on": "触发时机",
52
52
  "After record added": "新增数据后",
53
53
  "After record updated": "更新数据后",
@@ -61,7 +61,7 @@
61
61
  "Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.":
62
62
  "请选中需要在后续节点中被访问的关系字段。超过两层的对多关联可能会导致性能问题,请谨慎使用。",
63
63
  "Schedule event": "定时任务",
64
- "Event will be scheduled and triggered base on time conditions.": "基于时间条件进行定时触发的事件。",
64
+ "Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.": "按预设的时间条件定时触发。适用于一次性或周期性的任务,如定时发送通知、清理数据等。",
65
65
  "Trigger mode": "触发模式",
66
66
  "Based on certain date": "自定义时间",
67
67
  "Based on date field of collection": "根据数据表时间字段",
@@ -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":"2024-03-12T13:26:04.248Z"}
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":"2024-04-03T15:43:08.830Z"}
@@ -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":"2024-03-12T13:26:03.924Z"}
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":"2024-04-03T15:43:08.498Z"}
@@ -12,6 +12,7 @@ export default class PluginWorkflowServer extends Plugin {
12
12
  instructions: Registry<InstructionInterface>;
13
13
  triggers: Registry<Trigger>;
14
14
  functions: Registry<CustomFunction>;
15
+ enabledCache: Map<number, WorkflowModel>;
15
16
  private ready;
16
17
  private executing;
17
18
  private pending;
@@ -21,7 +22,7 @@ export default class PluginWorkflowServer extends Plugin {
21
22
  private meter;
22
23
  getLogger(workflowId: ID): Logger;
23
24
  isWorkflowSync(workflow: WorkflowModel): boolean;
24
- onBeforeSave: (instance: WorkflowModel, options: any) => Promise<void>;
25
+ private onBeforeSave;
25
26
  registerTrigger<T extends Trigger>(type: string, trigger: T | {
26
27
  new (p: Plugin): T;
27
28
  }): void;
@@ -42,5 +43,6 @@ export default class PluginWorkflowServer extends Plugin {
42
43
  private prepare;
43
44
  private dispatch;
44
45
  private process;
46
+ useDataSourceTransaction(dataSourceName: string, transaction: any, create?: boolean): any;
45
47
  }
46
48
  export {};
@@ -52,6 +52,7 @@ class PluginWorkflowServer extends import_server.Plugin {
52
52
  instructions = new import_utils.Registry();
53
53
  triggers = new import_utils.Registry();
54
54
  functions = new import_utils.Registry();
55
+ enabledCache = /* @__PURE__ */ new Map();
55
56
  ready = false;
56
57
  executing = null;
57
58
  pending = [];
@@ -247,8 +248,10 @@ class PluginWorkflowServer extends import_server.Plugin {
247
248
  trigger.off({ ...workflow.get(), ...prev });
248
249
  }
249
250
  trigger.on(workflow);
251
+ this.enabledCache.set(workflow.id, workflow);
250
252
  } else {
251
253
  trigger.off(workflow);
254
+ this.enabledCache.delete(workflow.id);
252
255
  }
253
256
  }
254
257
  trigger(workflow, context, options = {}) {
@@ -269,9 +272,7 @@ class PluginWorkflowServer extends import_server.Plugin {
269
272
  this.events.push([workflow, context, rest]);
270
273
  this.eventsCount = this.events.length;
271
274
  logger.info(`new event triggered, now events: ${this.events.length}`);
272
- logger.debug(`event data:`, {
273
- data: context
274
- });
275
+ logger.debug(`event data:`, { context });
275
276
  if (this.events.length > 1) {
276
277
  return;
277
278
  }
@@ -419,19 +420,30 @@ class PluginWorkflowServer extends import_server.Plugin {
419
420
  if (execution.status === import_constants.EXECUTION_STATUS.QUEUEING) {
420
421
  await execution.update({ status: import_constants.EXECUTION_STATUS.STARTED }, { transaction: options.transaction });
421
422
  }
423
+ const logger = this.getLogger(execution.workflowId);
422
424
  const processor = this.createProcessor(execution, options);
423
- this.getLogger(execution.workflowId).info(`execution (${execution.id}) ${job ? "resuming" : "starting"}...`);
425
+ logger.info(`execution (${execution.id}) ${job ? "resuming" : "starting"}...`);
424
426
  try {
425
427
  await (job ? processor.resume(job) : processor.start());
426
- this.getLogger(execution.workflowId).info(
427
- `execution (${execution.id}) finished with status: ${execution.status}`
428
- );
428
+ logger.info(`execution (${execution.id}) finished with status: ${execution.status}`, { execution });
429
429
  if (execution.status && ((_b = (_a = execution.workflow.options) == null ? void 0 : _a.deleteExecutionOnStatus) == null ? void 0 : _b.includes(execution.status))) {
430
430
  await execution.destroy();
431
431
  }
432
432
  } catch (err) {
433
- this.getLogger(execution.workflowId).error(`execution (${execution.id}) error: ${err.message}`, err);
433
+ logger.error(`execution (${execution.id}) error: ${err.message}`, err);
434
434
  }
435
435
  return processor;
436
436
  }
437
+ useDataSourceTransaction(dataSourceName = "main", transaction, create = false) {
438
+ const { db } = this.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager;
439
+ if (!db) {
440
+ return;
441
+ }
442
+ if (db.sequelize === (transaction == null ? void 0 : transaction.sequelize)) {
443
+ return transaction;
444
+ }
445
+ if (create) {
446
+ return db.sequelize.transaction();
447
+ }
448
+ }
437
449
  }
@@ -32,7 +32,7 @@ var executions_default = {
32
32
  name: "workflow"
33
33
  },
34
34
  {
35
- type: "uid",
35
+ type: "string",
36
36
  name: "key"
37
37
  },
38
38
  {
@@ -21,20 +21,23 @@ __export(CreateInstruction_exports, {
21
21
  default: () => CreateInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(CreateInstruction_exports);
24
+ var import_data_source_manager = require("@nocobase/data-source-manager");
24
25
  var import_constants = require("../constants");
25
26
  var import_utils = require("../utils");
26
27
  var import__ = require(".");
27
28
  class CreateInstruction extends import__.Instruction {
28
29
  async run(node, input, processor) {
29
30
  const { collection, params: { appends = [], ...params } = {} } = node.config;
30
- const { repository, model } = node.constructor.database.getCollection(collection);
31
+ const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
32
+ const { repository, filterTargetKey } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
31
33
  const options = processor.getParsedValue(params, node.id);
34
+ const transaction = this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction);
32
35
  const created = await repository.create({
33
36
  ...options,
34
37
  context: {
35
38
  stack: Array.from(new Set((processor.execution.context.stack ?? []).concat(processor.execution.id)))
36
39
  },
37
- transaction: processor.transaction
40
+ transaction
38
41
  });
39
42
  let result = created;
40
43
  if (created && appends.length) {
@@ -44,9 +47,9 @@ class CreateInstruction extends import__.Instruction {
44
47
  return set;
45
48
  }, /* @__PURE__ */ new Set());
46
49
  result = await repository.findOne({
47
- filterByTk: created[model.primaryKeyAttribute],
50
+ filterByTk: created[filterTargetKey],
48
51
  appends: Array.from(includeFields),
49
- transaction: processor.transaction
52
+ transaction
50
53
  });
51
54
  }
52
55
  return {
@@ -21,19 +21,21 @@ __export(DestroyInstruction_exports, {
21
21
  default: () => DestroyInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(DestroyInstruction_exports);
24
+ var import_data_source_manager = require("@nocobase/data-source-manager");
24
25
  var import__ = require(".");
25
26
  var import_constants = require("../constants");
26
27
  class DestroyInstruction extends import__.Instruction {
27
28
  async run(node, input, processor) {
28
29
  const { collection, params = {} } = node.config;
29
- const repo = node.constructor.database.getRepository(collection);
30
+ const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
31
+ const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
30
32
  const options = processor.getParsedValue(params, node.id);
31
- const result = await repo.destroy({
33
+ const result = await repository.destroy({
32
34
  ...options,
33
35
  context: {
34
36
  stack: Array.from(new Set((processor.execution.context.stack ?? []).concat(processor.execution.id)))
35
37
  },
36
- transaction: processor.transaction
38
+ transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction)
37
39
  });
38
40
  return {
39
41
  result,
@@ -22,13 +22,15 @@ __export(QueryInstruction_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(QueryInstruction_exports);
24
24
  var import_actions = require("@nocobase/actions");
25
+ var import_data_source_manager = require("@nocobase/data-source-manager");
25
26
  var import_constants = require("../constants");
26
27
  var import_utils = require("../utils");
27
28
  var import__ = require(".");
28
29
  class QueryInstruction extends import__.Instruction {
29
30
  async run(node, input, processor) {
30
31
  const { collection, multiple, params = {}, failOnEmpty = false } = node.config;
31
- const repo = node.constructor.database.getRepository(collection);
32
+ const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
33
+ const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
32
34
  const {
33
35
  page = import_actions.DEFAULT_PAGE,
34
36
  pageSize = import_actions.DEFAULT_PER_PAGE,
@@ -42,7 +44,7 @@ class QueryInstruction extends import__.Instruction {
42
44
  return set;
43
45
  }, /* @__PURE__ */ new Set())
44
46
  ) : options.appends;
45
- const result = await (multiple ? repo.find : repo.findOne).call(repo, {
47
+ const result = await (multiple ? repository.find : repository.findOne).call(repository, {
46
48
  ...options,
47
49
  ...import_actions.utils.pageArgsToLimitArgs(page, pageSize),
48
50
  sort: sort.filter((item) => item.field).map((item) => {
@@ -50,7 +52,7 @@ class QueryInstruction extends import__.Instruction {
50
52
  return `${((_a = item.direction) == null ? void 0 : _a.toLowerCase()) === "desc" ? "-" : ""}${item.field}`;
51
53
  }),
52
54
  appends,
53
- transaction: processor.transaction
55
+ transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction)
54
56
  });
55
57
  if (failOnEmpty && (multiple ? !result.length : !result)) {
56
58
  return {
@@ -21,19 +21,21 @@ __export(UpdateInstruction_exports, {
21
21
  default: () => UpdateInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(UpdateInstruction_exports);
24
+ var import_data_source_manager = require("@nocobase/data-source-manager");
24
25
  var import_constants = require("../constants");
25
26
  var import__ = require(".");
26
27
  class UpdateInstruction extends import__.Instruction {
27
28
  async run(node, input, processor) {
28
29
  const { collection, params = {} } = node.config;
29
- const repo = node.constructor.database.getRepository(collection);
30
+ const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
31
+ const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
30
32
  const options = processor.getParsedValue(params, node.id);
31
- const result = await repo.update({
33
+ const result = await repository.update({
32
34
  ...options,
33
35
  context: {
34
36
  stack: Array.from(new Set((processor.execution.context.stack ?? []).concat(processor.execution.id)))
35
37
  },
36
- transaction: processor.transaction
38
+ transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction)
37
39
  });
38
40
  return {
39
41
  result: result.length ?? result,
@@ -112,12 +112,10 @@ function migrateConfig({ schema = {}, actions = [] }) {
112
112
  [formId]: {
113
113
  type: "void",
114
114
  "x-component": "FormV2",
115
- "x-component-props": {
116
- useProps: "{{ useFormBlockProps }}"
117
- },
115
+ "x-use-component-props": "useFormBlockProps",
118
116
  properties: {
119
117
  grid: Object.assign(formBlock.properties.grid, {
120
- "x-initializer": "AddCustomFormField"
118
+ "x-initializer": "workflowManual:customForm:configureFields"
121
119
  }),
122
120
  // 7.
123
121
  actions: {
@@ -130,7 +128,7 @@ function migrateConfig({ schema = {}, actions = [] }) {
130
128
  marginTop: "1.5em"
131
129
  }
132
130
  },
133
- "x-initializer": "AddActionButton",
131
+ "x-initializer": "workflowManual:form:configureActions",
134
132
  properties: schema.actions
135
133
  }
136
134
  }
@@ -67,15 +67,13 @@ function migrateSchema(schema = {}) {
67
67
  type: "void",
68
68
  name: id,
69
69
  "x-component": "FormV2",
70
- "x-component-props": {
71
- useProps: "{{useDetailsBlockProps}}"
72
- },
70
+ "x-use-component-props": "useDetailsBlockProps",
73
71
  properties: {
74
72
  grid: {
75
73
  type: "void",
76
74
  name: "grid",
77
75
  "x-component": "Grid",
78
- "x-initializer": "ReadPrettyFormItemInitializers",
76
+ "x-initializer": "details:configureFields",
79
77
  properties: grid.properties
80
78
  }
81
79
  }