@nocobase/plugin-workflow 0.7.1-alpha.5 → 0.7.2-alpha.1

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 (127) hide show
  1. package/client.d.ts +4 -0
  2. package/client.js +30 -0
  3. package/lib/client/ExecutionResourceProvider.d.ts +4 -0
  4. package/lib/client/ExecutionResourceProvider.js +64 -0
  5. package/lib/client/WorkflowCanvas.d.ts +15 -0
  6. package/lib/client/WorkflowCanvas.js +393 -0
  7. package/lib/client/WorkflowLink.d.ts +1 -0
  8. package/lib/client/WorkflowLink.js +66 -0
  9. package/lib/client/WorkflowPage.d.ts +1 -0
  10. package/lib/client/WorkflowPage.js +92 -0
  11. package/lib/client/WorkflowProvider.d.ts +1 -0
  12. package/lib/client/WorkflowProvider.js +78 -0
  13. package/lib/client/WorkflowShortcut.d.ts +1 -0
  14. package/lib/client/WorkflowShortcut.js +123 -0
  15. package/lib/client/calculators.d.ts +101 -0
  16. package/lib/client/calculators.js +739 -0
  17. package/lib/client/components/Duration.d.ts +5 -0
  18. package/lib/client/components/Duration.js +96 -0
  19. package/lib/client/index.d.ts +3 -0
  20. package/lib/client/index.js +38 -0
  21. package/lib/client/nodes/calculation.d.ts +25 -0
  22. package/lib/client/nodes/calculation.js +85 -0
  23. package/lib/client/nodes/condition.d.ts +46 -0
  24. package/lib/client/nodes/condition.js +346 -0
  25. package/lib/client/nodes/create.d.ts +46 -0
  26. package/lib/client/nodes/create.js +133 -0
  27. package/lib/client/nodes/delay.d.ts +36 -0
  28. package/lib/client/nodes/delay.js +49 -0
  29. package/lib/client/nodes/destroy.d.ts +55 -0
  30. package/lib/client/nodes/destroy.js +46 -0
  31. package/lib/client/nodes/index.d.ts +33 -0
  32. package/lib/client/nodes/index.js +390 -0
  33. package/lib/client/nodes/parallel.d.ts +24 -0
  34. package/lib/client/nodes/parallel.js +216 -0
  35. package/lib/client/nodes/query.d.ts +70 -0
  36. package/lib/client/nodes/query.js +143 -0
  37. package/lib/client/nodes/update.d.ts +60 -0
  38. package/lib/client/nodes/update.js +48 -0
  39. package/lib/client/schemas/collection.d.ts +42 -0
  40. package/lib/client/schemas/collection.js +98 -0
  41. package/lib/client/schemas/executions.d.ts +209 -0
  42. package/lib/client/schemas/executions.js +164 -0
  43. package/lib/client/schemas/workflows.d.ts +2 -0
  44. package/lib/client/schemas/workflows.js +328 -0
  45. package/lib/client/style.d.ts +12 -0
  46. package/lib/client/style.js +216 -0
  47. package/lib/client/triggers/collection.d.ts +92 -0
  48. package/lib/client/triggers/collection.js +253 -0
  49. package/lib/client/triggers/index.d.ts +26 -0
  50. package/lib/client/triggers/index.js +238 -0
  51. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
  52. package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
  53. package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
  54. package/lib/client/triggers/schedule/EndsByField.js +102 -0
  55. package/lib/client/triggers/schedule/OnField.d.ts +5 -0
  56. package/lib/client/triggers/schedule/OnField.js +128 -0
  57. package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
  58. package/lib/client/triggers/schedule/RepeatField.js +191 -0
  59. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
  60. package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
  61. package/lib/client/triggers/schedule/index.d.ts +25 -0
  62. package/lib/client/triggers/schedule/index.js +124 -0
  63. package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
  64. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
  65. package/lib/index.d.ts +1 -6
  66. package/lib/index.js +2 -73
  67. package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
  68. package/lib/{Plugin.js → server/Plugin.js} +0 -0
  69. package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
  70. package/lib/{Processor.js → server/Processor.js} +40 -24
  71. package/lib/{actions → server/actions}/index.d.ts +0 -0
  72. package/lib/{actions → server/actions}/index.js +0 -0
  73. package/lib/{actions → server/actions}/nodes.d.ts +0 -0
  74. package/lib/{actions → server/actions}/nodes.js +1 -0
  75. package/lib/{actions → server/actions}/workflows.d.ts +0 -0
  76. package/lib/{actions → server/actions}/workflows.js +0 -0
  77. package/lib/{calculators → server/calculators}/index.d.ts +0 -0
  78. package/lib/{calculators → server/calculators}/index.js +0 -0
  79. package/lib/{collections → server/collections}/executions.d.ts +0 -0
  80. package/lib/{collections → server/collections}/executions.js +0 -0
  81. package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
  82. package/lib/{collections → server/collections}/flow_nodes.js +0 -0
  83. package/lib/{collections → server/collections}/jobs.d.ts +0 -0
  84. package/lib/{collections → server/collections}/jobs.js +0 -0
  85. package/lib/{collections → server/collections}/workflows.d.ts +0 -0
  86. package/lib/{collections → server/collections}/workflows.js +0 -0
  87. package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
  88. package/lib/{constants.js → server/constants.js} +0 -0
  89. package/lib/server/index.d.ts +6 -0
  90. package/lib/server/index.js +86 -0
  91. package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
  92. package/lib/{instructions → server/instructions}/calculation.js +0 -0
  93. package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
  94. package/lib/{instructions → server/instructions}/condition.js +0 -0
  95. package/lib/{instructions → server/instructions}/create.d.ts +0 -0
  96. package/lib/{instructions → server/instructions}/create.js +0 -0
  97. package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
  98. package/lib/{instructions → server/instructions}/delay.js +12 -5
  99. package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
  100. package/lib/{instructions → server/instructions}/destroy.js +0 -0
  101. package/lib/{instructions → server/instructions}/index.d.ts +0 -0
  102. package/lib/{instructions → server/instructions}/index.js +0 -0
  103. package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
  104. package/lib/{instructions → server/instructions}/parallel.js +62 -20
  105. package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
  106. package/lib/{instructions → server/instructions}/prompt.js +0 -0
  107. package/lib/{instructions → server/instructions}/query.d.ts +0 -0
  108. package/lib/{instructions → server/instructions}/query.js +0 -0
  109. package/lib/{instructions → server/instructions}/update.d.ts +0 -0
  110. package/lib/{instructions → server/instructions}/update.js +0 -0
  111. package/lib/{models → server/models}/Execution.d.ts +0 -0
  112. package/lib/{models → server/models}/Execution.js +0 -0
  113. package/lib/{models → server/models}/FlowNode.d.ts +0 -0
  114. package/lib/{models → server/models}/FlowNode.js +0 -0
  115. package/lib/{models → server/models}/Job.d.ts +0 -0
  116. package/lib/{models → server/models}/Job.js +0 -0
  117. package/lib/{models → server/models}/Workflow.d.ts +0 -0
  118. package/lib/{models → server/models}/Workflow.js +0 -0
  119. package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
  120. package/lib/{triggers → server/triggers}/collection.js +0 -0
  121. package/lib/{triggers → server/triggers}/index.d.ts +0 -0
  122. package/lib/{triggers → server/triggers}/index.js +0 -0
  123. package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
  124. package/lib/{triggers → server/triggers}/schedule.js +2 -2
  125. package/package.json +10 -8
  126. package/server.d.ts +4 -0
  127. package/server.js +30 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function _antd() {
9
+ const data = require("antd");
10
+
11
+ _antd = function _antd() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _react() {
19
+ const data = _interopRequireDefault(require("react"));
20
+
21
+ _react = function _react() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _reactI18next() {
29
+ const data = require("react-i18next");
30
+
31
+ _reactI18next = function _reactI18next() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _client() {
39
+ const data = require("@nocobase/client");
40
+
41
+ _client = function _client() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ var _calculators = require("../calculators");
49
+
50
+ var _collection = require("../schemas/collection");
51
+
52
+ var _WorkflowCanvas = require("../WorkflowCanvas");
53
+
54
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55
+
56
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
+
58
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
59
+
60
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
61
+
62
+ var _default = {
63
+ title: '{{t("Create record")}}',
64
+ type: 'create',
65
+ group: 'collection',
66
+ fieldset: {
67
+ 'config.collection': _objectSpread(_objectSpread({}, _collection.collection), {}, {
68
+ name: 'config.collection'
69
+ }),
70
+ // multiple: {
71
+ // type: 'boolean',
72
+ // title: '多条数据',
73
+ // name: 'multiple',
74
+ // 'x-decorator': 'FormItem',
75
+ // 'x-component': 'Checkbox',
76
+ // 'x-component-props': {
77
+ // disabled: true
78
+ // }
79
+ // },
80
+ 'config.params.values': _collection.values
81
+ },
82
+ view: {},
83
+ scope: {
84
+ useCollectionDataSource: _client().useCollectionDataSource
85
+ },
86
+ components: {
87
+ CollectionFieldset: _calculators.CollectionFieldset
88
+ },
89
+
90
+ getter({
91
+ type,
92
+ options,
93
+ onChange: _onChange
94
+ }) {
95
+ var _collections$find;
96
+
97
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
98
+ t = _useTranslation.t;
99
+
100
+ const compile = (0, _client().useCompile)();
101
+
102
+ const _useCollectionManager = (0, _client().useCollectionManager)(),
103
+ _useCollectionManager2 = _useCollectionManager.collections,
104
+ collections = _useCollectionManager2 === void 0 ? [] : _useCollectionManager2;
105
+
106
+ const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
107
+ nodes = _useFlowContext.nodes;
108
+
109
+ const _nodes$find = nodes.find(n => n.id == options.nodeId),
110
+ config = _nodes$find.config;
111
+
112
+ const collection = (_collections$find = collections.find(item => item.name === config.collection)) !== null && _collections$find !== void 0 ? _collections$find : {
113
+ fields: []
114
+ };
115
+ return _react().default.createElement(_antd().Select, {
116
+ value: options.path,
117
+ placeholder: t('Fields'),
118
+ onChange: path => {
119
+ _onChange({
120
+ type,
121
+ options: _objectSpread(_objectSpread({}, options), {}, {
122
+ path
123
+ })
124
+ });
125
+ }
126
+ }, collection.fields.filter(field => _calculators.BaseTypeSet.has(field.uiSchema.type)).map(field => _react().default.createElement(_antd().Select.Option, {
127
+ key: field.name,
128
+ value: field.name
129
+ }, compile(field.uiSchema.title))));
130
+ }
131
+
132
+ };
133
+ exports.default = _default;
@@ -0,0 +1,36 @@
1
+ import Duration from "../components/Duration";
2
+ declare const _default: {
3
+ title: string;
4
+ type: string;
5
+ group: string;
6
+ fieldset: {
7
+ 'config.duration': {
8
+ type: string;
9
+ name: string;
10
+ title: string;
11
+ 'x-decorator': string;
12
+ 'x-component': string;
13
+ default: number;
14
+ };
15
+ 'config.endStatus': {
16
+ type: string;
17
+ name: string;
18
+ title: string;
19
+ 'x-decorator': string;
20
+ 'x-component': string;
21
+ 'x-component-props': {
22
+ placeholder: string;
23
+ };
24
+ enum: {
25
+ label: string;
26
+ value: number;
27
+ }[];
28
+ };
29
+ };
30
+ view: {};
31
+ scope: {};
32
+ components: {
33
+ Duration: typeof Duration;
34
+ };
35
+ };
36
+ export default _default;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Duration = _interopRequireDefault(require("../components/Duration"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = {
13
+ title: '{{t("Delay")}}',
14
+ type: 'delay',
15
+ group: 'control',
16
+ fieldset: {
17
+ 'config.duration': {
18
+ type: 'number',
19
+ name: 'config.duration',
20
+ title: '{{t("Duration")}}',
21
+ 'x-decorator': 'FormItem',
22
+ 'x-component': 'Duration',
23
+ default: 60000
24
+ },
25
+ 'config.endStatus': {
26
+ type: 'number',
27
+ name: 'config.endStatus',
28
+ title: '{{t("End Status")}}',
29
+ 'x-decorator': 'FormItem',
30
+ 'x-component': 'Select',
31
+ 'x-component-props': {
32
+ placeholder: '{{t("Select status")}}'
33
+ },
34
+ enum: [{
35
+ label: '{{t("Succeed and continue")}}',
36
+ value: 1
37
+ }, {
38
+ label: '{{t("Fail and exit")}}',
39
+ value: -1
40
+ }]
41
+ }
42
+ },
43
+ view: {},
44
+ scope: {},
45
+ components: {
46
+ Duration: _Duration.default
47
+ }
48
+ };
49
+ exports.default = _default;
@@ -0,0 +1,55 @@
1
+ import { useCollectionDataSource } from '@nocobase/client';
2
+ import { VariableComponent } from '../calculators';
3
+ declare const _default: {
4
+ title: string;
5
+ type: string;
6
+ group: string;
7
+ fieldset: {
8
+ 'config.collection': {
9
+ type: string;
10
+ title: string;
11
+ name: string;
12
+ required: boolean;
13
+ 'x-reactions': string[];
14
+ 'x-decorator': string;
15
+ 'x-component': string;
16
+ 'x-component-props': {
17
+ placeholder: string;
18
+ };
19
+ };
20
+ 'config.params': {
21
+ type: string;
22
+ name: string;
23
+ title: string;
24
+ 'x-decorator': string;
25
+ properties: {
26
+ filter: {
27
+ type: string;
28
+ title: string;
29
+ name: string;
30
+ 'x-decorator': string;
31
+ 'x-decorator-props': {
32
+ labelAlign: string;
33
+ className: string;
34
+ };
35
+ 'x-component': string;
36
+ 'x-component-props': {
37
+ useProps(): {
38
+ options: any[];
39
+ className: string;
40
+ };
41
+ dynamicComponent: string;
42
+ };
43
+ };
44
+ };
45
+ };
46
+ };
47
+ view: {};
48
+ scope: {
49
+ useCollectionDataSource: typeof useCollectionDataSource;
50
+ };
51
+ components: {
52
+ VariableComponent: typeof VariableComponent;
53
+ };
54
+ };
55
+ export default _default;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function _client() {
9
+ const data = require("@nocobase/client");
10
+
11
+ _client = function _client() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ var _calculators = require("../calculators");
19
+
20
+ var _collection = require("../schemas/collection");
21
+
22
+ var _default = {
23
+ title: '{{t("Delete record")}}',
24
+ type: 'destroy',
25
+ group: 'collection',
26
+ fieldset: {
27
+ 'config.collection': _collection.collection,
28
+ 'config.params': {
29
+ type: 'object',
30
+ name: 'config.params',
31
+ title: '',
32
+ 'x-decorator': 'FormItem',
33
+ properties: {
34
+ filter: _collection.filter
35
+ }
36
+ }
37
+ },
38
+ view: {},
39
+ scope: {
40
+ useCollectionDataSource: _client().useCollectionDataSource
41
+ },
42
+ components: {
43
+ VariableComponent: _calculators.VariableComponent
44
+ }
45
+ };
46
+ exports.default = _default;
@@ -0,0 +1,33 @@
1
+ import { ISchema } from '@formily/react';
2
+ import { Registry } from '@nocobase/utils/client';
3
+ import React from 'react';
4
+ export interface Instruction {
5
+ title: string;
6
+ type: string;
7
+ group: string;
8
+ options?: {
9
+ label: string;
10
+ value: any;
11
+ key: string;
12
+ }[];
13
+ fieldset: {
14
+ [key: string]: ISchema;
15
+ };
16
+ view?: ISchema;
17
+ scope?: {
18
+ [key: string]: any;
19
+ };
20
+ components?: {
21
+ [key: string]: any;
22
+ };
23
+ render?(props: any): React.ReactElement;
24
+ endding?: boolean;
25
+ getter?(node: any): React.ReactElement;
26
+ }
27
+ export declare const instructions: Registry<Instruction>;
28
+ export declare function useNodeContext(): any;
29
+ export declare function Node({ data }: {
30
+ data: any;
31
+ }): JSX.Element;
32
+ export declare function RemoveButton(): JSX.Element;
33
+ export declare function NodeDefaultView(props: any): JSX.Element;