@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,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WorkflowProvider = void 0;
7
+
8
+ function _react() {
9
+ const data = _interopRequireWildcard(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _client() {
19
+ const data = require("@nocobase/client");
20
+
21
+ _client = function _client() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ var _WorkflowPage = require("./WorkflowPage");
29
+
30
+ var _WorkflowShortcut = require("./WorkflowShortcut");
31
+
32
+ const _excluded = ["routes", "components"];
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
38
+ 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; }
39
+
40
+ 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; }
41
+
42
+ 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; }
43
+
44
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
45
+
46
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
47
+
48
+ const WorkflowProvider = props => {
49
+ const ctx = (0, _react().useContext)(_client().PluginManagerContext);
50
+
51
+ const _useContext = (0, _react().useContext)(_client().RouteSwitchContext),
52
+ routes = _useContext.routes,
53
+ components = _useContext.components,
54
+ others = _objectWithoutProperties(_useContext, _excluded);
55
+
56
+ routes[1].routes.unshift({
57
+ type: 'route',
58
+ path: '/admin/plugins/workflows/:id',
59
+ component: 'WorkflowPage'
60
+ });
61
+ return _react().default.createElement(_client().PluginManagerContext.Provider, {
62
+ value: {
63
+ components: _objectSpread(_objectSpread({}, ctx === null || ctx === void 0 ? void 0 : ctx.components), {}, {
64
+ WorkflowShortcut: _WorkflowShortcut.WorkflowShortcut
65
+ })
66
+ }
67
+ }, _react().default.createElement(_client().RouteSwitchContext.Provider, {
68
+ value: _objectSpread(_objectSpread({
69
+ components: _objectSpread(_objectSpread({}, components), {}, {
70
+ WorkflowPage: _WorkflowPage.WorkflowPage
71
+ })
72
+ }, others), {}, {
73
+ routes
74
+ })
75
+ }, props.children));
76
+ };
77
+
78
+ exports.WorkflowProvider = WorkflowProvider;
@@ -0,0 +1 @@
1
+ export declare const WorkflowShortcut: () => JSX.Element;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WorkflowShortcut = void 0;
7
+
8
+ function _react() {
9
+ const data = _interopRequireWildcard(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _icons() {
19
+ const data = require("@ant-design/icons");
20
+
21
+ _icons = function _icons() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _shared() {
29
+ const data = require("@formily/shared");
30
+
31
+ _shared = function _shared() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _reactI18next() {
39
+ const data = require("react-i18next");
40
+
41
+ _reactI18next = function _reactI18next() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _client() {
49
+ const data = require("@nocobase/client");
50
+
51
+ _client = function _client() {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ var _workflows = require("./schemas/workflows");
59
+
60
+ var _WorkflowLink = require("./WorkflowLink");
61
+
62
+ var _ExecutionResourceProvider = require("./ExecutionResourceProvider");
63
+
64
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
65
+
66
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
67
+
68
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
69
+
70
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
71
+
72
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
73
+
74
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
75
+
76
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
77
+
78
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
79
+
80
+ const schema = {
81
+ type: 'object',
82
+ properties: {
83
+ [(0, _shared().uid)()]: {
84
+ 'x-component': 'Action.Drawer',
85
+ type: 'void',
86
+ title: '{{t("Workflow")}}',
87
+ properties: {
88
+ table: _workflows.workflowSchema
89
+ }
90
+ }
91
+ }
92
+ };
93
+
94
+ const WorkflowShortcut = () => {
95
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
96
+ t = _useTranslation.t;
97
+
98
+ const _useState = (0, _react().useState)(false),
99
+ _useState2 = _slicedToArray(_useState, 2),
100
+ visible = _useState2[0],
101
+ setVisible = _useState2[1];
102
+
103
+ return _react().default.createElement(_client().ActionContext.Provider, {
104
+ value: {
105
+ visible,
106
+ setVisible
107
+ }
108
+ }, _react().default.createElement(_client().PluginManager.Toolbar.Item, {
109
+ icon: _react().default.createElement(_icons().PartitionOutlined, null),
110
+ title: t('Workflow'),
111
+ onClick: () => {
112
+ setVisible(true);
113
+ }
114
+ }), _react().default.createElement(_client().SchemaComponent, {
115
+ schema: schema,
116
+ components: {
117
+ WorkflowLink: _WorkflowLink.WorkflowLink,
118
+ ExecutionResourceProvider: _ExecutionResourceProvider.ExecutionResourceProvider
119
+ }
120
+ }));
121
+ };
122
+
123
+ exports.WorkflowShortcut = WorkflowShortcut;
@@ -0,0 +1,101 @@
1
+ import React from "react";
2
+ declare function NullRender(): any;
3
+ export declare const calculators: {
4
+ value: string;
5
+ title: string;
6
+ children: {
7
+ value: string;
8
+ name: string;
9
+ }[];
10
+ }[];
11
+ export declare function parseStringValue(value: string, Types: any): {
12
+ type: string;
13
+ value: string;
14
+ options: {
15
+ type: string;
16
+ };
17
+ } | {
18
+ type: string;
19
+ options: any;
20
+ value?: undefined;
21
+ };
22
+ export declare const BaseTypeSet: Set<string>;
23
+ export declare const VariableTypes: {
24
+ constant: {
25
+ title: string;
26
+ value: string;
27
+ options: {
28
+ value: string;
29
+ label: string;
30
+ }[];
31
+ component({ options }: {
32
+ options?: {
33
+ type: string;
34
+ };
35
+ }): any;
36
+ appendTypeValue({ options }: {
37
+ options?: {
38
+ type: string;
39
+ };
40
+ }): string[];
41
+ onTypeChange(old: any, [type, optionsType]: [any, any], onChange: any): void;
42
+ parse(path: any): {
43
+ path: any;
44
+ };
45
+ };
46
+ $jobsMapByNodeId: {
47
+ title: string;
48
+ value: string;
49
+ options(): any[];
50
+ component({ options }: {
51
+ options: any;
52
+ }): typeof NullRender | ((node: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
53
+ appendTypeValue({ options }: {
54
+ type: string;
55
+ options: any;
56
+ }): number[];
57
+ onTypeChange(old: any, [type, nodeId]: [any, any], onChange: any): void;
58
+ parse([nodeId, ...path]: [any, ...any[]]): {
59
+ nodeId: any;
60
+ path: string;
61
+ };
62
+ stringify({ options }: {
63
+ options: any;
64
+ }): string;
65
+ };
66
+ $context: {
67
+ title: string;
68
+ value: string;
69
+ component(): ((node: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) | typeof NullRender;
70
+ parse([prefix, ...path]: [any, ...any[]]): {
71
+ path: string;
72
+ };
73
+ stringify({ options }: {
74
+ options: any;
75
+ }): string;
76
+ };
77
+ };
78
+ export declare const VariableTypesContext: React.Context<any>;
79
+ export declare function useVariableTypes(): any;
80
+ interface OperandProps {
81
+ value: {
82
+ type: string;
83
+ value?: any;
84
+ options?: any;
85
+ };
86
+ onChange(v: any): void;
87
+ children?: React.ReactNode;
88
+ }
89
+ export declare function Operand({ value: operand, onChange, children }: OperandProps): JSX.Element;
90
+ export declare function Calculation({ calculator, operands, onChange }: {
91
+ calculator: any;
92
+ operands?: any[];
93
+ onChange: any;
94
+ }): JSX.Element;
95
+ export declare function VariableComponent({ value, onChange, renderSchemaComponent }: {
96
+ value: any;
97
+ onChange: any;
98
+ renderSchemaComponent: any;
99
+ }): JSX.Element;
100
+ export declare const CollectionFieldset: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
101
+ export {};