@nocobase/plugin-workflow 0.14.0-alpha.7 → 0.14.0-alpha.8

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 (44) hide show
  1. package/dist/client/AddButton.d.ts +2 -1
  2. package/dist/client/Branch.d.ts +4 -2
  3. package/dist/client/constants.d.ts +2 -0
  4. package/dist/client/hooks/useGetAriaLabelOfAddButton.d.ts +6 -0
  5. package/dist/client/index.d.ts +8 -2
  6. package/dist/client/index.js +100 -97
  7. package/dist/client/nodes/aggregate.d.ts +3 -3
  8. package/dist/client/nodes/calculation.d.ts +6 -5
  9. package/dist/client/nodes/create.d.ts +3 -2
  10. package/dist/client/nodes/index.d.ts +1 -1
  11. package/dist/client/nodes/manual/index.d.ts +3 -3
  12. package/dist/client/nodes/query.d.ts +3 -2
  13. package/dist/client/schemas/collection.d.ts +1 -0
  14. package/dist/client/triggers/collection.d.ts +1 -0
  15. package/dist/client/triggers/form.d.ts +2 -0
  16. package/dist/client/triggers/index.d.ts +4 -0
  17. package/dist/client/variable.d.ts +1 -0
  18. package/dist/externalVersion.js +9 -10
  19. package/dist/locale/zh-CN.d.ts +5 -3
  20. package/dist/locale/zh-CN.js +5 -3
  21. package/dist/node_modules/cron-parser/package.json +1 -1
  22. package/dist/node_modules/lru-cache/package.json +1 -1
  23. package/dist/server/Plugin.js +4 -1
  24. package/dist/server/Processor.d.ts +4 -4
  25. package/dist/server/Processor.js +9 -6
  26. package/dist/server/actions/workflows.d.ts +1 -0
  27. package/dist/server/actions/workflows.js +13 -52
  28. package/dist/server/collections/flow_nodes.js +4 -0
  29. package/dist/server/constants.d.ts +2 -0
  30. package/dist/server/constants.js +4 -2
  31. package/dist/server/index.d.ts +1 -0
  32. package/dist/server/index.js +2 -0
  33. package/dist/server/instructions/index.d.ts +3 -1
  34. package/dist/server/migrations/20230221162902-jsonb-to-json.js +0 -16
  35. package/dist/server/migrations/20230809113132-workflow-options.js +5 -2
  36. package/dist/server/migrations/20231024172342-add-node-key.d.ts +4 -0
  37. package/dist/server/migrations/20231024172342-add-node-key.js +80 -0
  38. package/dist/server/triggers/form.d.ts +3 -3
  39. package/dist/server/triggers/form.js +15 -11
  40. package/dist/server/triggers/index.d.ts +2 -0
  41. package/dist/server/triggers/index.js +1 -1
  42. package/dist/server/triggers/schedule.js +1 -1
  43. package/dist/server/utils.js +5 -4
  44. package/package.json +2 -3
@@ -177,8 +177,8 @@ declare const _default: {
177
177
  };
178
178
  AssociatedConfig: typeof AssociatedConfig;
179
179
  };
180
- useVariables({ id, title }: {
181
- id: any;
180
+ useVariables({ key, title }: {
181
+ key: any;
182
182
  title: any;
183
183
  }, { types, fieldNames }: {
184
184
  types: any;
@@ -188,7 +188,7 @@ declare const _default: {
188
188
  readonly children: "children";
189
189
  };
190
190
  }): {
191
- value: string;
191
+ value: any;
192
192
  label: any;
193
193
  };
194
194
  useInitializers(node: any): SchemaInitializerItemOptions | null;
@@ -83,17 +83,18 @@ declare const _default: {
83
83
  components: {
84
84
  CalculationExpression(props: any): React.JSX.Element;
85
85
  ScopeSelect(props: any): React.JSX.Element;
86
- CalculationResult({ dataSource }: {
87
- dataSource: any;
88
- }): string | React.JSX.Element;
89
86
  RadioWithTooltip: typeof RadioWithTooltip;
90
87
  DynamicConfig: ({ value, onChange }: {
91
88
  value: any;
92
89
  onChange: any;
93
90
  }) => React.JSX.Element;
91
+ ValueBlock: (() => JSX.Element) & {
92
+ Initializer: (props: any) => JSX.Element;
93
+ Result: (props: any) => JSX.Element;
94
+ };
94
95
  };
95
- useVariables({ id, title }: {
96
- id: any;
96
+ useVariables({ key, title }: {
97
+ key: any;
97
98
  title: any;
98
99
  }, { types, fieldNames }: {
99
100
  types: any;
@@ -38,6 +38,7 @@ declare const _default: {
38
38
  'x-decorator': string;
39
39
  'x-component': string;
40
40
  'x-component-props': {
41
+ title: string;
41
42
  multiple: boolean;
42
43
  useCollection(): any;
43
44
  };
@@ -60,8 +61,8 @@ declare const _default: {
60
61
  components: {
61
62
  CollectionFieldset: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
62
63
  };
63
- useVariables({ id, title, config }: {
64
- id: any;
64
+ useVariables({ key: name, title, config }: {
65
+ key: any;
65
66
  title: any;
66
67
  config: any;
67
68
  }, options: any): import("../variable").VariableOption;
@@ -23,13 +23,13 @@ export interface Instruction {
23
23
  [key: string]: any;
24
24
  };
25
25
  component?(props: any): JSX.Element;
26
- endding?: boolean;
27
26
  useVariables?(node: any, options?: any): VariableOption;
28
27
  useScopeVariables?(node: any, options?: any): VariableOptions;
29
28
  useInitializers?(node: any): SchemaInitializerItemOptions | null;
30
29
  initializers?: {
31
30
  [key: string]: any;
32
31
  };
32
+ isAvailable?(ctx: object): boolean;
33
33
  }
34
34
  export declare const instructions: any;
35
35
  export declare const NodeContext: React.Context<any>;
@@ -58,8 +58,8 @@ declare const _default: {
58
58
  ModeConfig: typeof ModeConfig;
59
59
  AssigneesSelect: typeof AssigneesSelect;
60
60
  };
61
- useVariables({ id, title, config }: {
62
- id: any;
61
+ useVariables({ key, title, config }: {
62
+ key: any;
63
63
  title: any;
64
64
  config: any;
65
65
  }, { types, fieldNames }: {
@@ -70,7 +70,7 @@ declare const _default: {
70
70
  readonly children: "children";
71
71
  };
72
72
  }): {
73
- value: string;
73
+ value: any;
74
74
  label: any;
75
75
  children: {
76
76
  key: string;
@@ -161,6 +161,7 @@ declare const _default: {
161
161
  'x-decorator': string;
162
162
  'x-component': string;
163
163
  'x-component-props': {
164
+ title: string;
164
165
  multiple: boolean;
165
166
  useCollection(): any;
166
167
  };
@@ -208,8 +209,8 @@ declare const _default: {
208
209
  FilterDynamicComponent: typeof FilterDynamicComponent;
209
210
  SchemaComponentContext: import("react").Context<import("@nocobase/client").ISchemaComponentContext>;
210
211
  };
211
- useVariables({ id, title, config }: {
212
- id: any;
212
+ useVariables({ key: name, title, config }: {
213
+ key: any;
213
214
  title: any;
214
215
  config: any;
215
216
  }, options: any): import("../variable").VariableOption;
@@ -151,6 +151,7 @@ export declare const appends: {
151
151
  'x-decorator': string;
152
152
  'x-component': string;
153
153
  'x-component-props': {
154
+ title: string;
154
155
  multiple: boolean;
155
156
  useCollection(): any;
156
157
  };
@@ -95,6 +95,7 @@ declare const _default: {
95
95
  'x-decorator': string;
96
96
  'x-component': string;
97
97
  'x-component-props': {
98
+ title: string;
98
99
  multiple: boolean;
99
100
  useCollection(): any;
100
101
  };
@@ -23,6 +23,7 @@ declare const _default: {
23
23
  'x-decorator': string;
24
24
  'x-component': string;
25
25
  'x-component-props': {
26
+ title: string;
26
27
  multiple: boolean;
27
28
  useCollection(): any;
28
29
  };
@@ -43,6 +44,7 @@ declare const _default: {
43
44
  useVariables(config: any, options: any): import("../variable").VariableOption[];
44
45
  useInitializers(config: any): SchemaInitializerItemOptions | null;
45
46
  initializers: {};
47
+ actionTriggerable: boolean;
46
48
  };
47
49
  export default _default;
48
50
  export declare function useTriggerWorkflowsActionProps(): {
@@ -19,6 +19,7 @@ export interface Trigger {
19
19
  };
20
20
  useInitializers?(config: any): SchemaInitializerItemOptions | null;
21
21
  initializers?: any;
22
+ actionTriggerable?: boolean;
22
23
  }
23
24
  export declare const triggers: any;
24
25
  export declare const TriggerConfig: () => React.JSX.Element;
@@ -27,4 +28,7 @@ export declare function getTriggersOptions(): {
27
28
  value: any;
28
29
  label: any;
29
30
  color: string;
31
+ options: {
32
+ [x: string]: any;
33
+ };
30
34
  }[];
@@ -21,6 +21,7 @@ export type OptionsOfUseVariableOptions = {
21
21
  children?: string;
22
22
  };
23
23
  appends?: string[] | null;
24
+ depth?: number;
24
25
  };
25
26
  export declare const defaultFieldNames: {
26
27
  readonly label: "label";
@@ -1,24 +1,23 @@
1
1
  module.exports = {
2
2
  "@ant-design/icons": "5.1.4",
3
- "@nocobase/client": "0.14.0-alpha.7",
3
+ "@nocobase/client": "0.14.0-alpha.8",
4
4
  "antd": "5.8.6",
5
5
  "react": "18.2.0",
6
- "@nocobase/utils": "0.14.0-alpha.7",
6
+ "@nocobase/utils": "0.14.0-alpha.8",
7
7
  "react-router-dom": "6.14.1",
8
8
  "react-i18next": "11.18.6",
9
9
  "winston": "3.9.0",
10
- "@nocobase/database": "0.14.0-alpha.7",
11
- "@nocobase/server": "0.14.0-alpha.7",
12
- "@nocobase/logger": "0.14.0-alpha.7",
13
- "@nocobase/evaluators": "0.14.0-alpha.7",
10
+ "@nocobase/database": "0.14.0-alpha.8",
11
+ "@nocobase/server": "0.14.0-alpha.8",
12
+ "@nocobase/logger": "0.14.0-alpha.8",
13
+ "@nocobase/evaluators": "0.14.0-alpha.8",
14
14
  "@formily/react": "2.2.27",
15
15
  "@formily/core": "2.2.27",
16
- "@formily/antd-v5": "1.1.0",
16
+ "@formily/antd-v5": "1.1.7",
17
17
  "lodash": "4.17.21",
18
- "@nocobase/actions": "0.14.0-alpha.7",
18
+ "@nocobase/actions": "0.14.0-alpha.8",
19
19
  "axios": "0.26.1",
20
20
  "sequelize": "6.32.1",
21
- "@emotion/css": "11.11.2",
22
21
  "dayjs": "1.11.9",
23
- "@nocobase/resourcer": "0.14.0-alpha.7"
22
+ "@nocobase/resourcer": "0.14.0-alpha.8"
24
23
  };
@@ -83,6 +83,7 @@ declare const _default: {
83
83
  Advanced: string;
84
84
  End: string;
85
85
  'Node result': string;
86
+ 'Variable key of node': string;
86
87
  Calculator: string;
87
88
  'Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression can be static or dynamic one from an expression collections.': string;
88
89
  'String operation': string;
@@ -99,6 +100,7 @@ declare const _default: {
99
100
  Aborted: string;
100
101
  Canceled: string;
101
102
  Rejected: string;
103
+ 'Retry needed': string;
102
104
  'Triggered but still waiting in queue to execute.': string;
103
105
  'Started and executing, maybe waiting for an async callback (manual, delay etc.).': string;
104
106
  'Successfully finished.': string;
@@ -107,6 +109,7 @@ declare const _default: {
107
109
  'Running of some node was aborted by program flow.': string;
108
110
  'Manually canceled whole execution when waiting.': string;
109
111
  'Rejected from a manual node.': string;
112
+ 'General failed but should do another try.': string;
110
113
  'Continue the process': string;
111
114
  'Terminate the process': string;
112
115
  'Save temporarily': string;
@@ -213,8 +216,7 @@ declare const _default: {
213
216
  'Field to aggregate': string;
214
217
  Distinct: string;
215
218
  'Query result': string;
216
- 'Trigger in executed workflow cannot be modified': string;
217
- 'Node in executed workflow cannot be modified': string;
219
+ 'Executed workflow cannot be modified': string;
218
220
  'Can not delete': string;
219
221
  'The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.': string;
220
222
  'HTTP request': string;
@@ -234,7 +236,7 @@ declare const _default: {
234
236
  'Input request data': string;
235
237
  'Only support standard JSON data': string;
236
238
  '"Content-Type" only support "application/json", and no need to specify': string;
237
- 'Ignore fail request and continue workflow': string;
239
+ 'Ignore failed request and continue workflow': string;
238
240
  'Workflow todos': string;
239
241
  Task: string;
240
242
  'Dynamic expression': string;
@@ -105,6 +105,7 @@ var zh_CN_default = {
105
105
  Advanced: "\u9AD8\u7EA7\u6A21\u5F0F",
106
106
  End: "\u7ED3\u675F",
107
107
  "Node result": "\u8282\u70B9\u6570\u636E",
108
+ "Variable key of node": "\u8282\u70B9\u53D8\u91CF\u6807\u8BC6",
108
109
  Calculator: "\u8FD0\u7B97",
109
110
  "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression can be static or dynamic one from an expression collections.": "\u57FA\u4E8E\u8BA1\u7B97\u5F15\u64CE\u5BF9\u4E00\u4E2A\u8868\u8FBE\u5F0F\u8FDB\u884C\u8BA1\u7B97\uFF0C\u5E76\u83B7\u5F97\u4E00\u4E2A\u503C\u4F5C\u4E3A\u7ED3\u679C\u3002\u8868\u8FBE\u5F0F\u4E2D\u53EF\u4EE5\u4F7F\u7528\u4E0A\u6E38\u8282\u70B9\u91CC\u7684\u53D8\u91CF\u3002\u8868\u8FBE\u5F0F\u53EF\u4EE5\u662F\u9759\u6001\u7684\uFF0C\u4E5F\u53EF\u4EE5\u662F\u8868\u8FBE\u5F0F\u8868\u4E2D\u7684\u52A8\u6001\u8868\u8FBE\u5F0F\u3002",
110
111
  "String operation": "\u5B57\u7B26\u4E32",
@@ -121,6 +122,7 @@ var zh_CN_default = {
121
122
  Aborted: "\u5DF2\u7EC8\u6B62",
122
123
  Canceled: "\u5DF2\u53D6\u6D88",
123
124
  Rejected: "\u5DF2\u62D2\u7EDD",
125
+ "Retry needed": "\u9700\u91CD\u8BD5",
124
126
  "Triggered but still waiting in queue to execute.": "\u5DF2\u89E6\u53D1\u4F46\u4ECD\u5728\u961F\u5217\u4E2D\u7B49\u5F85\u6267\u884C\u3002",
125
127
  "Started and executing, maybe waiting for an async callback (manual, delay etc.).": "\u5DF2\u5F00\u59CB\u6267\u884C\uFF0C\u53EF\u80FD\u5728\u7B49\u5F85\u5F02\u6B65\u56DE\u8C03\uFF08\u4EBA\u5DE5\u3001\u5EF6\u65F6\u7B49\uFF09\u3002",
126
128
  "Successfully finished.": "\u6210\u529F\u5B8C\u6210\u3002",
@@ -129,6 +131,7 @@ var zh_CN_default = {
129
131
  "Running of some node was aborted by program flow.": "\u67D0\u4E2A\u8282\u70B9\u88AB\u7A0B\u5E8F\u6D41\u7A0B\u7EC8\u6B62\u3002",
130
132
  "Manually canceled whole execution when waiting.": "\u7B49\u5F85\u65F6\u88AB\u624B\u52A8\u53D6\u6D88\u6574\u4E2A\u6267\u884C\u3002",
131
133
  "Rejected from a manual node.": "\u88AB\u4EBA\u5DE5\u8282\u70B9\u62D2\u7EDD\u7EE7\u7EED\u3002",
134
+ "General failed but should do another try.": "\u6267\u884C\u5931\u8D25\uFF0C\u9700\u91CD\u8BD5\u3002",
132
135
  "Continue the process": "\u7EE7\u7EED\u6D41\u7A0B",
133
136
  "Terminate the process": "\u7EC8\u6B62\u6D41\u7A0B",
134
137
  "Save temporarily": "\u6682\u5B58",
@@ -235,8 +238,7 @@ var zh_CN_default = {
235
238
  "Field to aggregate": "\u805A\u5408\u5B57\u6BB5",
236
239
  Distinct: "\u53BB\u91CD",
237
240
  "Query result": "\u67E5\u8BE2\u7ED3\u679C",
238
- "Trigger in executed workflow cannot be modified": "\u5DF2\u7ECF\u6267\u884C\u8FC7\u5DE5\u4F5C\u6D41\u7684\u89E6\u53D1\u5668\u4E0D\u80FD\u88AB\u4FEE\u6539",
239
- "Node in executed workflow cannot be modified": "\u5DF2\u7ECF\u6267\u884C\u8FC7\u5DE5\u4F5C\u6D41\u4E2D\u7684\u8282\u70B9\u4E0D\u80FD\u88AB\u4FEE\u6539",
241
+ "Executed workflow cannot be modified": "\u5DF2\u7ECF\u6267\u884C\u8FC7\u7684\u5DE5\u4F5C\u6D41\u4E0D\u80FD\u88AB\u4FEE\u6539",
240
242
  "Can not delete": "\u65E0\u6CD5\u5220\u9664",
241
243
  "The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.": "\u8BE5\u8282\u70B9\u7684\u6267\u884C\u7ED3\u679C\u5DF2\u88AB\u5176\u4ED6\u8282\u70B9\uFF08{{nodes}}\uFF09\u5F15\u7528\uFF0C\u5220\u9664\u524D\u8BF7\u5148\u79FB\u9664\u5F15\u7528\u3002",
242
244
  "HTTP request": "HTTP \u8BF7\u6C42",
@@ -256,7 +258,7 @@ var zh_CN_default = {
256
258
  "Input request data": "\u8F93\u5165\u8BF7\u6C42\u6570\u636E",
257
259
  "Only support standard JSON data": "\u4EC5\u652F\u6301\u6807\u51C6 JSON \u6570\u636E",
258
260
  '"Content-Type" only support "application/json", and no need to specify': '"Content-Type" \u8BF7\u6C42\u5934\u4EC5\u652F\u6301 "application/json"\uFF0C\u65E0\u9700\u586B\u5199',
259
- "Ignore fail request and continue workflow": "\u5FFD\u7565\u5931\u8D25\u7684\u8BF7\u6C42\u5E76\u7EE7\u7EED\u5DE5\u4F5C\u6D41",
261
+ "Ignore failed request and continue workflow": "\u5FFD\u7565\u5931\u8D25\u7684\u8BF7\u6C42\u5E76\u7EE7\u7EED\u5DE5\u4F5C\u6D41",
260
262
  "Workflow todos": "\u5DE5\u4F5C\u6D41\u5F85\u529E",
261
263
  Task: "\u4EFB\u52A1",
262
264
  "Dynamic expression": "\u52A8\u6001\u8868\u8FBE\u5F0F",
@@ -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":"2023-10-07T08:33:03.346Z"}
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":"2023-11-01T02:16:46.199Z"}
@@ -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":"2023-10-07T08:33:02.747Z"}
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":"2023-11-01T02:16:45.638Z"}
@@ -288,7 +288,10 @@ class WorkflowPlugin extends import_server.Plugin {
288
288
  } else {
289
289
  const execution = await this.db.getRepository("executions").findOne({
290
290
  filter: {
291
- status: import_constants.EXECUTION_STATUS.QUEUEING
291
+ status: import_constants.EXECUTION_STATUS.QUEUEING,
292
+ "workflow.id": {
293
+ [import_database.Op.not]: null
294
+ }
292
295
  },
293
296
  appends: ["workflow"],
294
297
  sort: "createdAt"
@@ -16,8 +16,8 @@ export default class Processor {
16
16
  nodes: FlowNodeModel[];
17
17
  nodesMap: Map<number, FlowNodeModel>;
18
18
  jobsMap: Map<number, JobModel>;
19
- jobsMapByNodeId: {
20
- [key: number]: any;
19
+ jobsMapByNodeKey: {
20
+ [key: string]: any;
21
21
  };
22
22
  constructor(execution: ExecutionModel, options: ProcessorOptions);
23
23
  private makeNodes;
@@ -41,8 +41,8 @@ export default class Processor {
41
41
  findBranchLastJob(node: FlowNodeModel, job: JobModel): JobModel | null;
42
42
  getScope(sourceNodeId: number): {
43
43
  $context: any;
44
- $jobsMapByNodeId: {
45
- [key: number]: any;
44
+ $jobsMapByNodeKey: {
45
+ [key: string]: any;
46
46
  };
47
47
  $system: {};
48
48
  $scopes: {};
@@ -37,14 +37,15 @@ class Processor {
37
37
  [import_constants.JOB_STATUS.ERROR]: import_constants.EXECUTION_STATUS.ERROR,
38
38
  [import_constants.JOB_STATUS.ABORTED]: import_constants.EXECUTION_STATUS.ABORTED,
39
39
  [import_constants.JOB_STATUS.CANCELED]: import_constants.EXECUTION_STATUS.CANCELED,
40
- [import_constants.JOB_STATUS.REJECTED]: import_constants.EXECUTION_STATUS.REJECTED
40
+ [import_constants.JOB_STATUS.REJECTED]: import_constants.EXECUTION_STATUS.REJECTED,
41
+ [import_constants.JOB_STATUS.RETRY_NEEDED]: import_constants.EXECUTION_STATUS.RETRY_NEEDED
41
42
  };
42
43
  logger;
43
44
  transaction;
44
45
  nodes = [];
45
46
  nodesMap = /* @__PURE__ */ new Map();
46
47
  jobsMap = /* @__PURE__ */ new Map();
47
- jobsMapByNodeId = {};
48
+ jobsMapByNodeKey = {};
48
49
  // make dual linked nodes list then cache
49
50
  makeNodes(nodes = []) {
50
51
  this.nodes = nodes;
@@ -63,7 +64,8 @@ class Processor {
63
64
  makeJobs(jobs) {
64
65
  jobs.forEach((job) => {
65
66
  this.jobsMap.set(job.id, job);
66
- this.jobsMapByNodeId[job.nodeId] = job.result;
67
+ const node = this.nodesMap.get(job.nodeId);
68
+ this.jobsMapByNodeKey[node.key] = job.result;
67
69
  });
68
70
  }
69
71
  async getTransaction() {
@@ -214,7 +216,8 @@ class Processor {
214
216
  );
215
217
  }
216
218
  this.jobsMap.set(job.id, job);
217
- this.jobsMapByNodeId[job.nodeId] = job.result;
219
+ const node = this.nodesMap.get(job.nodeId);
220
+ this.jobsMapByNodeKey[node.key] = job.result;
218
221
  return job;
219
222
  }
220
223
  getBranches(node) {
@@ -290,12 +293,12 @@ class Processor {
290
293
  for (let n = this.findBranchParentNode(node); n; n = this.findBranchParentNode(n)) {
291
294
  const instruction = this.options.plugin.instructions.get(n.type);
292
295
  if (typeof instruction.getScope === "function") {
293
- $scopes[n.id] = instruction.getScope(n, this.jobsMapByNodeId[n.id], this);
296
+ $scopes[n.id] = $scopes[n.key] = instruction.getScope(n, this.jobsMapByNodeKey[n.key], this);
294
297
  }
295
298
  }
296
299
  return {
297
300
  $context: this.execution.context,
298
- $jobsMapByNodeId: this.jobsMapByNodeId,
301
+ $jobsMapByNodeKey: this.jobsMapByNodeKey,
299
302
  $system: systemFns,
300
303
  $scopes
301
304
  };
@@ -3,3 +3,4 @@ export declare function update(context: Context, next: any): Promise<void>;
3
3
  export declare function destroy(context: Context, next: any): Promise<void>;
4
4
  export declare function revision(context: Context, next: any): Promise<void>;
5
5
  export declare function sync(context: Context, next: any): Promise<void>;
6
+ export declare function trigger(context: Context, next: any): Promise<any>;
@@ -30,6 +30,7 @@ __export(workflows_exports, {
30
30
  destroy: () => destroy,
31
31
  revision: () => revision,
32
32
  sync: () => sync,
33
+ trigger: () => trigger,
33
34
  update: () => update
34
35
  });
35
36
  module.exports = __toCommonJS(workflows_exports);
@@ -78,48 +79,8 @@ async function destroy(context, next) {
78
79
  });
79
80
  next();
80
81
  }
81
- function typeOf(value) {
82
- if (Array.isArray(value)) {
83
- return "array";
84
- } else if (value instanceof Date) {
85
- return "date";
86
- } else if (value === null) {
87
- return "null";
88
- }
89
- return typeof value;
90
- }
91
- function migrateConfig(config, oldToNew) {
92
- function migrate(value) {
93
- var _a, _b;
94
- switch (typeOf(value)) {
95
- case "object":
96
- if (value.type === "$jobsMapByNodeId") {
97
- return {
98
- ...value,
99
- options: {
100
- ...value.options,
101
- nodeId: (_b = oldToNew.get((_a = value.options) == null ? void 0 : _a.nodeId)) == null ? void 0 : _b.id
102
- }
103
- };
104
- }
105
- return Object.keys(value).reduce((result, key) => ({ ...result, [key]: migrate(value[key]) }), {});
106
- case "array":
107
- return value.map((item) => migrate(item));
108
- case "string":
109
- return value.replace(/({{\$jobsMapByNodeId|{{\$scopes)\.([\w-]+)/g, (_, jobVar, oldNodeId) => {
110
- const newNode = oldToNew.get(Number.parseInt(oldNodeId, 10));
111
- if (!newNode) {
112
- throw new Error("node configurated for result is not existed");
113
- }
114
- return `${jobVar}.${newNode.id}`;
115
- });
116
- default:
117
- return value;
118
- }
119
- }
120
- return migrate(config);
121
- }
122
82
  async function revision(context, next) {
83
+ const plugin = context.app.getPlugin("workflow");
123
84
  const { db } = context;
124
85
  const repository = import_actions.utils.getRepositoryFromParams(context);
125
86
  const { filterByTk, filter = {}, values = {} } = context.action.params;
@@ -131,6 +92,7 @@ async function revision(context, next) {
131
92
  context,
132
93
  transaction
133
94
  });
95
+ const trigger2 = plugin.triggers.get(origin.type);
134
96
  const revisionData = filter.key ? {
135
97
  key: filter.key,
136
98
  title: origin.title,
@@ -140,9 +102,9 @@ async function revision(context, next) {
140
102
  values: {
141
103
  title: `${origin.title} copy`,
142
104
  description: origin.description,
105
+ ...revisionData,
143
106
  type: origin.type,
144
- config: origin.config,
145
- ...revisionData
107
+ config: typeof trigger2.duplicateConfig === "function" ? await trigger2.duplicateConfig(origin, { transaction }) : origin.config
146
108
  },
147
109
  transaction
148
110
  });
@@ -153,10 +115,12 @@ async function revision(context, next) {
153
115
  const oldToNew = /* @__PURE__ */ new Map();
154
116
  const newToOld = /* @__PURE__ */ new Map();
155
117
  for await (const node of origin.nodes) {
118
+ const instruction = plugin.instructions.get(node.type);
156
119
  const newNode = await instance.createNode(
157
120
  {
158
121
  type: node.type,
159
- config: node.config,
122
+ key: node.key,
123
+ config: typeof instruction.duplicateConfig === "function" ? await instruction.duplicateConfig(node, { transaction }) : node.config,
160
124
  title: node.title,
161
125
  branchIndex: node.branchIndex
162
126
  },
@@ -169,17 +133,10 @@ async function revision(context, next) {
169
133
  const oldNode = originalNodesMap.get(oldId);
170
134
  const newUpstream = oldNode.upstreamId ? oldToNew.get(oldNode.upstreamId) : null;
171
135
  const newDownstream = oldNode.downstreamId ? oldToNew.get(oldNode.downstreamId) : null;
172
- let migratedConfig;
173
- try {
174
- migratedConfig = migrateConfig(oldNode.config, oldToNew);
175
- } catch (err) {
176
- return context.throw(400, err.message);
177
- }
178
136
  await newNode.update(
179
137
  {
180
138
  upstreamId: (newUpstream == null ? void 0 : newUpstream.id) ?? null,
181
- downstreamId: (newDownstream == null ? void 0 : newDownstream.id) ?? null,
182
- config: migratedConfig
139
+ downstreamId: (newDownstream == null ? void 0 : newDownstream.id) ?? null
183
140
  },
184
141
  { transaction }
185
142
  );
@@ -203,10 +160,14 @@ async function sync(context, next) {
203
160
  context.status = 204;
204
161
  await next();
205
162
  }
163
+ async function trigger(context, next) {
164
+ return next();
165
+ }
206
166
  // Annotate the CommonJS export names for ESM import in node:
207
167
  0 && (module.exports = {
208
168
  destroy,
209
169
  revision,
210
170
  sync,
171
+ trigger,
211
172
  update
212
173
  });
@@ -25,6 +25,10 @@ var flow_nodes_default = {
25
25
  duplicator: "required",
26
26
  name: "flow_nodes",
27
27
  fields: [
28
+ {
29
+ type: "uid",
30
+ name: "key"
31
+ },
28
32
  {
29
33
  type: "string",
30
34
  name: "title"
@@ -7,6 +7,7 @@ export declare const EXECUTION_STATUS: {
7
7
  ABORTED: number;
8
8
  CANCELED: number;
9
9
  REJECTED: number;
10
+ RETRY_NEEDED: number;
10
11
  };
11
12
  export declare const JOB_STATUS: {
12
13
  PENDING: number;
@@ -16,6 +17,7 @@ export declare const JOB_STATUS: {
16
17
  ABORTED: number;
17
18
  CANCELED: number;
18
19
  REJECTED: number;
20
+ RETRY_NEEDED: number;
19
21
  };
20
22
  export declare const BRANCH_INDEX: {
21
23
  DEFAULT: any;
@@ -30,7 +30,8 @@ const EXECUTION_STATUS = {
30
30
  ERROR: -2,
31
31
  ABORTED: -3,
32
32
  CANCELED: -4,
33
- REJECTED: -5
33
+ REJECTED: -5,
34
+ RETRY_NEEDED: -6
34
35
  };
35
36
  const JOB_STATUS = {
36
37
  PENDING: 0,
@@ -39,7 +40,8 @@ const JOB_STATUS = {
39
40
  ERROR: -2,
40
41
  ABORTED: -3,
41
42
  CANCELED: -4,
42
- REJECTED: -5
43
+ REJECTED: -5,
44
+ RETRY_NEEDED: -6
43
45
  };
44
46
  const BRANCH_INDEX = {
45
47
  DEFAULT: null,
@@ -1,3 +1,4 @@
1
+ export * from './utils';
1
2
  export * from './constants';
2
3
  export type * from './instructions';
3
4
  export { Trigger } from './triggers';
@@ -33,6 +33,7 @@ __export(server_exports, {
33
33
  default: () => import_Plugin.default
34
34
  });
35
35
  module.exports = __toCommonJS(server_exports);
36
+ __reExport(server_exports, require("./utils"), module.exports);
36
37
  __reExport(server_exports, require("./constants"), module.exports);
37
38
  var import_triggers = require("./triggers");
38
39
  var import_Processor = __toESM(require("./Processor"));
@@ -42,6 +43,7 @@ __reExport(server_exports, require("./types"), module.exports);
42
43
  0 && (module.exports = {
43
44
  Processor,
44
45
  Trigger,
46
+ ...require("./utils"),
45
47
  ...require("./constants"),
46
48
  ...require("./types")
47
49
  });
@@ -1,3 +1,4 @@
1
+ import { Transactionable } from '@nocobase/database';
1
2
  import Plugin from '..';
2
3
  import Processor from '../Processor';
3
4
  import type { FlowNodeModel } from '../types';
@@ -11,7 +12,8 @@ export type Runner = (node: FlowNodeModel, input: any, processor: Processor) =>
11
12
  export interface Instruction {
12
13
  run: Runner;
13
14
  resume?: Runner;
14
- getScope?: (node: FlowNodeModel, job: any, processor: Processor) => any;
15
+ getScope?: (node: FlowNodeModel, data: any, processor: Processor) => any;
16
+ duplicateConfig?: (node: FlowNodeModel, options: Transactionable) => object | Promise<object>;
15
17
  }
16
18
  type InstructionConstructor<T> = {
17
19
  new (p: Plugin): T;