@nocobase/plugin-workflow 0.7.1-alpha.7 → 0.7.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 (129) 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/CollectionFieldSelect.d.ts +2 -0
  18. package/lib/client/components/CollectionFieldSelect.js +106 -0
  19. package/lib/client/components/Duration.d.ts +5 -0
  20. package/lib/client/components/Duration.js +96 -0
  21. package/lib/client/index.d.ts +3 -0
  22. package/lib/client/index.js +38 -0
  23. package/lib/client/nodes/calculation.d.ts +25 -0
  24. package/lib/client/nodes/calculation.js +85 -0
  25. package/lib/client/nodes/condition.d.ts +46 -0
  26. package/lib/client/nodes/condition.js +346 -0
  27. package/lib/client/nodes/create.d.ts +42 -0
  28. package/lib/client/nodes/create.js +99 -0
  29. package/lib/client/nodes/delay.d.ts +36 -0
  30. package/lib/client/nodes/delay.js +49 -0
  31. package/lib/client/nodes/destroy.d.ts +55 -0
  32. package/lib/client/nodes/destroy.js +46 -0
  33. package/lib/client/nodes/index.d.ts +33 -0
  34. package/lib/client/nodes/index.js +390 -0
  35. package/lib/client/nodes/parallel.d.ts +24 -0
  36. package/lib/client/nodes/parallel.js +216 -0
  37. package/lib/client/nodes/query.d.ts +66 -0
  38. package/lib/client/nodes/query.js +105 -0
  39. package/lib/client/nodes/update.d.ts +60 -0
  40. package/lib/client/nodes/update.js +48 -0
  41. package/lib/client/schemas/collection.d.ts +42 -0
  42. package/lib/client/schemas/collection.js +98 -0
  43. package/lib/client/schemas/executions.d.ts +209 -0
  44. package/lib/client/schemas/executions.js +164 -0
  45. package/lib/client/schemas/workflows.d.ts +2 -0
  46. package/lib/client/schemas/workflows.js +328 -0
  47. package/lib/client/style.d.ts +12 -0
  48. package/lib/client/style.js +216 -0
  49. package/lib/client/triggers/collection.d.ts +88 -0
  50. package/lib/client/triggers/collection.js +225 -0
  51. package/lib/client/triggers/index.d.ts +26 -0
  52. package/lib/client/triggers/index.js +238 -0
  53. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
  54. package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
  55. package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
  56. package/lib/client/triggers/schedule/EndsByField.js +102 -0
  57. package/lib/client/triggers/schedule/OnField.d.ts +5 -0
  58. package/lib/client/triggers/schedule/OnField.js +128 -0
  59. package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
  60. package/lib/client/triggers/schedule/RepeatField.js +191 -0
  61. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
  62. package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
  63. package/lib/client/triggers/schedule/index.d.ts +25 -0
  64. package/lib/client/triggers/schedule/index.js +124 -0
  65. package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
  66. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
  67. package/lib/index.d.ts +1 -6
  68. package/lib/index.js +2 -73
  69. package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
  70. package/lib/{Plugin.js → server/Plugin.js} +0 -0
  71. package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
  72. package/lib/{Processor.js → server/Processor.js} +40 -24
  73. package/lib/{actions → server/actions}/index.d.ts +0 -0
  74. package/lib/{actions → server/actions}/index.js +0 -0
  75. package/lib/{actions → server/actions}/nodes.d.ts +0 -0
  76. package/lib/{actions → server/actions}/nodes.js +1 -0
  77. package/lib/{actions → server/actions}/workflows.d.ts +0 -0
  78. package/lib/{actions → server/actions}/workflows.js +10 -0
  79. package/lib/{calculators → server/calculators}/index.d.ts +0 -0
  80. package/lib/{calculators → server/calculators}/index.js +0 -0
  81. package/lib/{collections → server/collections}/executions.d.ts +0 -0
  82. package/lib/{collections → server/collections}/executions.js +0 -0
  83. package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
  84. package/lib/{collections → server/collections}/flow_nodes.js +0 -0
  85. package/lib/{collections → server/collections}/jobs.d.ts +0 -0
  86. package/lib/{collections → server/collections}/jobs.js +0 -0
  87. package/lib/{collections → server/collections}/workflows.d.ts +0 -0
  88. package/lib/{collections → server/collections}/workflows.js +0 -0
  89. package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
  90. package/lib/{constants.js → server/constants.js} +0 -0
  91. package/lib/server/index.d.ts +6 -0
  92. package/lib/server/index.js +86 -0
  93. package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
  94. package/lib/{instructions → server/instructions}/calculation.js +0 -0
  95. package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
  96. package/lib/{instructions → server/instructions}/condition.js +0 -0
  97. package/lib/{instructions → server/instructions}/create.d.ts +0 -0
  98. package/lib/{instructions → server/instructions}/create.js +0 -0
  99. package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
  100. package/lib/{instructions → server/instructions}/delay.js +12 -5
  101. package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
  102. package/lib/{instructions → server/instructions}/destroy.js +0 -0
  103. package/lib/{instructions → server/instructions}/index.d.ts +0 -0
  104. package/lib/{instructions → server/instructions}/index.js +0 -0
  105. package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
  106. package/lib/{instructions → server/instructions}/parallel.js +62 -20
  107. package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
  108. package/lib/{instructions → server/instructions}/prompt.js +0 -0
  109. package/lib/{instructions → server/instructions}/query.d.ts +0 -0
  110. package/lib/{instructions → server/instructions}/query.js +0 -0
  111. package/lib/{instructions → server/instructions}/update.d.ts +0 -0
  112. package/lib/{instructions → server/instructions}/update.js +0 -0
  113. package/lib/{models → server/models}/Execution.d.ts +0 -0
  114. package/lib/{models → server/models}/Execution.js +0 -0
  115. package/lib/{models → server/models}/FlowNode.d.ts +0 -0
  116. package/lib/{models → server/models}/FlowNode.js +0 -0
  117. package/lib/{models → server/models}/Job.d.ts +0 -0
  118. package/lib/{models → server/models}/Job.js +0 -0
  119. package/lib/{models → server/models}/Workflow.d.ts +0 -0
  120. package/lib/{models → server/models}/Workflow.js +0 -0
  121. package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
  122. package/lib/{triggers → server/triggers}/collection.js +0 -0
  123. package/lib/{triggers → server/triggers}/index.d.ts +0 -0
  124. package/lib/{triggers → server/triggers}/index.js +0 -0
  125. package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
  126. package/lib/{triggers → server/triggers}/schedule.js +2 -2
  127. package/package.json +10 -8
  128. package/server.d.ts +4 -0
  129. package/server.js +30 -0
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function (props: any): JSX.Element;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+
8
+ function _react() {
9
+ const data = _interopRequireDefault(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _antd() {
19
+ const data = require("antd");
20
+
21
+ _antd = function _antd() {
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
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
+
50
+ function _default(props) {
51
+ const collection = props.collection,
52
+ value = props.value,
53
+ onChange = props.onChange;
54
+
55
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
56
+ t = _useTranslation.t;
57
+
58
+ const compile = (0, _client().useCompile)();
59
+
60
+ const _useCollectionManager = (0, _client().useCollectionManager)(),
61
+ getCollectionFields = _useCollectionManager.getCollectionFields;
62
+
63
+ const fields = getCollectionFields(collection).filter(field => field.interface && (!field.target || field.type === 'belongsTo')).map(field => {
64
+ var _field$uiSchema, _field$uiSchema2;
65
+
66
+ return field.type === 'belongsTo' ? {
67
+ title: `${compile(((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) || field.name)} ID`,
68
+ name: field.foreignKey
69
+ } : {
70
+ title: compile(((_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) || field.name),
71
+ name: field.name
72
+ };
73
+ });
74
+ return _react().default.createElement(_antd().Select, {
75
+ placeholder: t('Fields'),
76
+ value: value,
77
+ onChange: onChange
78
+ }, fields.map(field => _react().default.createElement(_antd().Select.Option, {
79
+ key: field.name,
80
+ value: field.name
81
+ }, field.title)));
82
+ }
83
+
84
+ function SelectWithAssociations(props) {
85
+ const collection = props.collection,
86
+ value = props.value,
87
+ onChange = props.onChange;
88
+
89
+ const _useTranslation2 = (0, _reactI18next().useTranslation)(),
90
+ t = _useTranslation2.t;
91
+
92
+ const compile = (0, _client().useCompile)();
93
+ const fields = (0, _client().useCollectionFilterOptions)(collection);
94
+ return _react().default.createElement(_antd().Cascader, {
95
+ fieldNames: {
96
+ label: 'title',
97
+ value: 'name',
98
+ children: 'children'
99
+ },
100
+ changeOnSelect: false,
101
+ value: Array.isArray(value) ? value : value === null || value === void 0 ? void 0 : value.split('.'),
102
+ options: compile(fields),
103
+ onChange: onChange,
104
+ placeholder: t('Select Field')
105
+ });
106
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export default function ({ value, onChange }: {
3
+ value?: number;
4
+ onChange: any;
5
+ }): JSX.Element;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+
8
+ function _react() {
9
+ const data = _interopRequireDefault(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _antd() {
19
+ const data = require("antd");
20
+
21
+ _antd = function _antd() {
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 _css() {
39
+ const data = require("@emotion/css");
40
+
41
+ _css = function _css() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
+
50
+ const UnitOptions = [{
51
+ value: 1000,
52
+ label: 'Seconds'
53
+ }, {
54
+ value: 60000,
55
+ label: 'Minutes'
56
+ }, {
57
+ value: 3600000,
58
+ label: 'Hours'
59
+ }, {
60
+ value: 86400000,
61
+ label: 'Days'
62
+ }, {
63
+ value: 604800000,
64
+ label: 'Weeks'
65
+ }];
66
+
67
+ function getNumberOption(v) {
68
+ return UnitOptions.slice().reverse().find(item => !(v % item.value));
69
+ }
70
+
71
+ function _default({
72
+ value = 60000,
73
+ onChange: _onChange
74
+ }) {
75
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
76
+ t = _useTranslation.t;
77
+
78
+ const option = getNumberOption(value);
79
+ const quantity = Math.round(value / option.value);
80
+ return _react().default.createElement("fieldset", {
81
+ className: (0, _css().css)`
82
+ display: flex;
83
+ gap: .5em;
84
+ `
85
+ }, _react().default.createElement(_antd().InputNumber, {
86
+ min: 1,
87
+ value: quantity,
88
+ onChange: v => _onChange(Math.round(v * option.value))
89
+ }), _react().default.createElement(_antd().Select, {
90
+ value: option.value,
91
+ onChange: unit => _onChange(Math.round(quantity * unit))
92
+ }, UnitOptions.map(item => _react().default.createElement(_antd().Select.Option, {
93
+ key: item.value,
94
+ value: item.value
95
+ }, t(item.label)))));
96
+ }
@@ -0,0 +1,3 @@
1
+ export { triggers } from './triggers';
2
+ export * from './nodes';
3
+ export { WorkflowProvider as default } from './WorkflowProvider';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ triggers: true
8
+ };
9
+ Object.defineProperty(exports, "default", {
10
+ enumerable: true,
11
+ get: function get() {
12
+ return _WorkflowProvider.WorkflowProvider;
13
+ }
14
+ });
15
+ Object.defineProperty(exports, "triggers", {
16
+ enumerable: true,
17
+ get: function get() {
18
+ return _triggers.triggers;
19
+ }
20
+ });
21
+
22
+ var _triggers = require("./triggers");
23
+
24
+ var _nodes = require("./nodes");
25
+
26
+ Object.keys(_nodes).forEach(function (key) {
27
+ if (key === "default" || key === "__esModule") return;
28
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
+ if (key in exports && exports[key] === _nodes[key]) return;
30
+ Object.defineProperty(exports, key, {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _nodes[key];
34
+ }
35
+ });
36
+ });
37
+
38
+ var _WorkflowProvider = require("./WorkflowProvider");
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ title: string;
4
+ type: string;
5
+ group: string;
6
+ fieldset: {
7
+ 'config.calculation': {
8
+ type: string;
9
+ title: string;
10
+ name: string;
11
+ required: boolean;
12
+ 'x-decorator': string;
13
+ 'x-component': string;
14
+ };
15
+ };
16
+ view: {};
17
+ components: {
18
+ CalculationConfig({ value, onChange }: {
19
+ value: any;
20
+ onChange: any;
21
+ }): JSX.Element;
22
+ };
23
+ getter(): JSX.Element;
24
+ };
25
+ export default _default;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function _css() {
9
+ const data = require("@emotion/css");
10
+
11
+ _css = function _css() {
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
+ var _calculators = require("../calculators");
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
+
42
+ 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; }
43
+
44
+ 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; }
45
+
46
+ 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; }
47
+
48
+ var _default = {
49
+ title: '{{t("Calculation")}}',
50
+ type: 'calculation',
51
+ group: 'control',
52
+ fieldset: {
53
+ 'config.calculation': {
54
+ type: 'object',
55
+ title: '{{t("Configure calculation")}}',
56
+ name: 'config.calculation',
57
+ required: true,
58
+ 'x-decorator': 'FormItem',
59
+ 'x-component': 'CalculationConfig'
60
+ }
61
+ },
62
+ view: {},
63
+ components: {
64
+ CalculationConfig({
65
+ value,
66
+ onChange
67
+ }) {
68
+ return _react().default.createElement(_calculators.Calculation, _objectSpread(_objectSpread({}, value), {}, {
69
+ onChange: onChange
70
+ }));
71
+ }
72
+
73
+ },
74
+
75
+ getter() {
76
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
77
+ t = _useTranslation.t;
78
+
79
+ return _react().default.createElement("div", {
80
+ className: (0, _css().css)`flex-shrink: 0`
81
+ }, t('Calculation result'));
82
+ }
83
+
84
+ };
85
+ exports.default = _default;
@@ -0,0 +1,46 @@
1
+ /// <reference types="react" />
2
+ declare function CalculationConfig({ value, onChange }: {
3
+ value: any;
4
+ onChange: any;
5
+ }): JSX.Element;
6
+ declare const _default: {
7
+ title: string;
8
+ type: string;
9
+ group: string;
10
+ fieldset: {
11
+ 'config.rejectOnFalse': {
12
+ type: string;
13
+ name: string;
14
+ title: string;
15
+ 'x-decorator': string;
16
+ 'x-component': string;
17
+ 'x-component-props': {
18
+ disabled: boolean;
19
+ };
20
+ enum: {
21
+ value: boolean;
22
+ label: string;
23
+ }[];
24
+ };
25
+ 'config.calculation': {
26
+ type: string;
27
+ name: string;
28
+ title: string;
29
+ 'x-decorator': string;
30
+ 'x-component': string;
31
+ };
32
+ };
33
+ view: {};
34
+ options: {
35
+ label: string;
36
+ key: string;
37
+ value: {
38
+ rejectOnFalse: boolean;
39
+ };
40
+ }[];
41
+ render(data: any): JSX.Element;
42
+ components: {
43
+ CalculationConfig: typeof CalculationConfig;
44
+ };
45
+ };
46
+ export default _default;