@nocobase/plugin-workflow 0.9.1-alpha.1 → 0.9.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.
- package/lib/client/AddButton.js +50 -86
- package/lib/client/Branch.js +0 -13
- package/lib/client/ExecutionCanvas.js +16 -63
- package/lib/client/ExecutionLink.js +3 -21
- package/lib/client/ExecutionPage.js +1 -19
- package/lib/client/ExecutionResourceProvider.js +6 -23
- package/lib/client/FlowContext.js +0 -8
- package/lib/client/WorkflowCanvas.js +57 -129
- package/lib/client/WorkflowLink.js +3 -21
- package/lib/client/WorkflowPage.js +1 -19
- package/lib/client/WorkflowProvider.js +24 -47
- package/lib/client/WorkflowShortcut.js +0 -16
- package/lib/client/components/CollectionBlockInitializer.js +12 -22
- package/lib/client/components/CollectionFieldInitializers.js +5 -24
- package/lib/client/components/CollectionFieldset.js +33 -85
- package/lib/client/components/Duration.js +0 -14
- package/lib/client/components/DynamicExpression.d.ts +4 -0
- package/lib/client/components/DynamicExpression.js +102 -0
- package/lib/client/components/FieldsSelect.d.ts +2 -0
- package/lib/client/components/FieldsSelect.js +66 -0
- package/lib/client/components/FilterDynamicComponent.js +1 -10
- package/lib/client/components/NullRender.js +0 -1
- package/lib/client/components/OpenDrawer.js +10 -35
- package/lib/client/components/RadioWithTooltip.js +5 -27
- package/lib/client/components/renderEngineReference.d.ts +1 -0
- package/lib/client/components/renderEngineReference.js +55 -0
- package/lib/client/constants.js +0 -9
- package/lib/client/index.js +0 -6
- package/lib/client/interfaces/expression.d.ts +3 -0
- package/lib/client/interfaces/expression.js +37 -0
- package/lib/client/locale/index.js +5 -15
- package/lib/client/locale/pt-BR.d.ts +130 -0
- package/lib/client/locale/pt-BR.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +16 -1
- package/lib/client/locale/zh-CN.js +17 -2
- package/lib/client/nodes/calculation.d.ts +56 -7
- package/lib/client/nodes/calculation.js +141 -74
- package/lib/client/nodes/condition.d.ts +5 -9
- package/lib/client/nodes/condition.js +30 -93
- package/lib/client/nodes/create.d.ts +36 -12
- package/lib/client/nodes/create.js +14 -28
- package/lib/client/nodes/delay.d.ts +3 -7
- package/lib/client/nodes/delay.js +5 -14
- package/lib/client/nodes/destroy.d.ts +3 -11
- package/lib/client/nodes/destroy.js +14 -12
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +181 -222
- package/lib/client/nodes/manual/AssigneesSelect.js +8 -18
- package/lib/client/nodes/manual/ModeConfig.js +0 -27
- package/lib/client/nodes/manual/SchemaConfig.js +87 -449
- package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
- package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
- package/lib/client/nodes/manual/forms/customForm.js +411 -0
- package/lib/client/nodes/manual/index.d.ts +15 -6
- package/lib/client/nodes/manual/index.js +58 -54
- package/lib/client/nodes/parallel.d.ts +1 -2
- package/lib/client/nodes/parallel.js +16 -45
- package/lib/client/nodes/query.d.ts +30 -12
- package/lib/client/nodes/query.js +17 -25
- package/lib/client/nodes/request.d.ts +9 -17
- package/lib/client/nodes/request.js +13 -37
- package/lib/client/nodes/update.d.ts +27 -28
- package/lib/client/nodes/update.js +17 -18
- package/lib/client/schemas/collection.d.ts +20 -7
- package/lib/client/schemas/collection.js +27 -28
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +75 -26
- package/lib/client/triggers/collection.d.ts +47 -18
- package/lib/client/triggers/collection.js +65 -123
- package/lib/client/triggers/index.d.ts +3 -6
- package/lib/client/triggers/index.js +146 -146
- package/lib/client/triggers/schedule/DateFieldsSelect.js +7 -32
- package/lib/client/triggers/schedule/EndsByField.js +1 -18
- package/lib/client/triggers/schedule/OnField.js +10 -38
- package/lib/client/triggers/schedule/RepeatField.js +4 -32
- package/lib/client/triggers/schedule/ScheduleConfig.js +25 -68
- package/lib/client/triggers/schedule/index.d.ts +21 -1
- package/lib/client/triggers/schedule/index.js +22 -24
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +31 -10
- package/lib/client/variable.d.ts +7 -6
- package/lib/client/variable.js +132 -71
- package/lib/index.js +0 -2
- package/lib/server/Plugin.d.ts +7 -7
- package/lib/server/Plugin.js +76 -111
- package/lib/server/Processor.d.ts +2 -0
- package/lib/server/Processor.js +62 -125
- package/lib/server/actions/index.js +3 -10
- package/lib/server/actions/nodes.js +34 -87
- package/lib/server/actions/workflows.js +46 -96
- package/lib/server/collections/executions.js +1 -1
- package/lib/server/collections/flow_nodes.js +7 -4
- package/lib/server/collections/jobs.js +1 -1
- package/lib/server/collections/workflows.js +3 -4
- package/lib/server/fields/expression-field.d.ts +8 -0
- package/lib/server/fields/expression-field.js +26 -0
- package/lib/server/fields/index.d.ts +1 -0
- package/lib/server/fields/index.js +12 -0
- package/lib/server/functions/index.js +3 -14
- package/lib/server/index.js +0 -6
- package/lib/server/instructions/calculation.js +22 -17
- package/lib/server/instructions/condition.js +8 -52
- package/lib/server/instructions/create.js +31 -15
- package/lib/server/instructions/delay.js +4 -32
- package/lib/server/instructions/destroy.js +6 -12
- package/lib/server/instructions/index.js +6 -23
- package/lib/server/instructions/manual/actions.js +22 -31
- package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
- package/lib/server/instructions/manual/index.d.ts +13 -12
- package/lib/server/instructions/manual/index.js +9 -47
- package/lib/server/instructions/parallel.js +9 -36
- package/lib/server/instructions/query.js +17 -15
- package/lib/server/instructions/request.js +7 -30
- package/lib/server/instructions/update.js +8 -14
- package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
- package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
- package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
- package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
- package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
- package/lib/server/models/Execution.js +0 -5
- package/lib/server/models/FlowNode.js +0 -5
- package/lib/server/models/Job.js +0 -5
- package/lib/server/models/Workflow.js +0 -5
- package/lib/server/triggers/collection.js +39 -61
- package/lib/server/triggers/index.js +3 -22
- package/lib/server/triggers/schedule.js +72 -194
- package/package.json +14 -11
|
@@ -4,53 +4,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _axios() {
|
|
9
8
|
const data = _interopRequireDefault(require("axios"));
|
|
10
|
-
|
|
11
9
|
_axios = function _axios() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
var _constants = require("../constants");
|
|
19
|
-
|
|
20
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
|
-
|
|
24
17
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
25
|
-
|
|
26
18
|
function request(_x) {
|
|
27
19
|
return _request.apply(this, arguments);
|
|
28
20
|
}
|
|
29
|
-
|
|
30
21
|
function _request() {
|
|
31
22
|
_request = _asyncToGenerator(function* (config) {
|
|
32
23
|
var _config$headers, _config$params;
|
|
33
|
-
|
|
34
24
|
// default headers
|
|
35
25
|
const url = config.url,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
_config$method = config.method,
|
|
27
|
+
method = _config$method === void 0 ? 'POST' : _config$method,
|
|
28
|
+
data = config.data,
|
|
29
|
+
_config$timeout = config.timeout,
|
|
30
|
+
timeout = _config$timeout === void 0 ? 5000 : _config$timeout;
|
|
41
31
|
const headers = ((_config$headers = config.headers) !== null && _config$headers !== void 0 ? _config$headers : []).reduce((result, header) => {
|
|
42
32
|
if (header.name.toLowerCase() === 'content-type') {
|
|
43
33
|
return result;
|
|
44
34
|
}
|
|
45
|
-
|
|
46
35
|
return Object.assign(result, {
|
|
47
36
|
[header.name]: header.value
|
|
48
37
|
});
|
|
49
38
|
}, {});
|
|
50
39
|
const params = ((_config$params = config.params) !== null && _config$params !== void 0 ? _config$params : []).reduce((result, param) => Object.assign(result, {
|
|
51
40
|
[param.name]: param.value
|
|
52
|
-
}), {});
|
|
53
|
-
|
|
41
|
+
}), {});
|
|
42
|
+
// TODO(feat): only support JSON type for now, should support others in future
|
|
54
43
|
headers['Content-Type'] = 'application/json';
|
|
55
44
|
return _axios().default.request({
|
|
56
45
|
url,
|
|
@@ -63,18 +52,14 @@ function _request() {
|
|
|
63
52
|
});
|
|
64
53
|
return _request.apply(this, arguments);
|
|
65
54
|
}
|
|
66
|
-
|
|
67
55
|
;
|
|
68
|
-
|
|
69
56
|
class _default {
|
|
70
57
|
constructor(plugin) {
|
|
71
58
|
this.plugin = void 0;
|
|
72
59
|
this.plugin = plugin;
|
|
73
60
|
}
|
|
74
|
-
|
|
75
61
|
run(node, input, processor) {
|
|
76
62
|
var _this = this;
|
|
77
|
-
|
|
78
63
|
return _asyncToGenerator(function* () {
|
|
79
64
|
const job = yield processor.saveJob({
|
|
80
65
|
status: _constants.JOB_STATUS.PENDING,
|
|
@@ -93,28 +78,20 @@ class _default {
|
|
|
93
78
|
});
|
|
94
79
|
}).finally(() => {
|
|
95
80
|
_this.plugin.app.logger.info(`[Workflow] request (#${node.id}) response received, status: ${job.get('status')}`);
|
|
96
|
-
|
|
97
81
|
_this.plugin.resume(job);
|
|
98
82
|
});
|
|
99
|
-
|
|
100
83
|
_this.plugin.app.logger.info(`[Workflow] request (#${node.id}) sent to "${config.url}", waiting for response...`);
|
|
101
|
-
|
|
102
84
|
return job;
|
|
103
85
|
})();
|
|
104
86
|
}
|
|
105
|
-
|
|
106
87
|
resume(node, job, processor) {
|
|
107
88
|
return _asyncToGenerator(function* () {
|
|
108
89
|
const ignoreFail = node.config.ignoreFail;
|
|
109
|
-
|
|
110
90
|
if (ignoreFail) {
|
|
111
91
|
job.set('status', _constants.JOB_STATUS.RESOLVED);
|
|
112
92
|
}
|
|
113
|
-
|
|
114
93
|
return job;
|
|
115
94
|
})();
|
|
116
95
|
}
|
|
117
|
-
|
|
118
96
|
}
|
|
119
|
-
|
|
120
97
|
exports.default = _default;
|
|
@@ -4,28 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _constants = require("../constants");
|
|
9
|
-
|
|
10
8
|
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; }
|
|
11
|
-
|
|
12
9
|
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; }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
17
|
-
|
|
18
14
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
19
|
-
|
|
20
15
|
var _default = {
|
|
21
16
|
run(node, input, processor) {
|
|
22
17
|
return _asyncToGenerator(function* () {
|
|
23
18
|
const _node$config = node.config,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
collection = _node$config.collection,
|
|
20
|
+
_node$config$multiple = _node$config.multiple,
|
|
21
|
+
multiple = _node$config$multiple === void 0 ? false : _node$config$multiple,
|
|
22
|
+
_node$config$params = _node$config.params,
|
|
23
|
+
params = _node$config$params === void 0 ? {} : _node$config$params;
|
|
29
24
|
const repo = node.constructor.database.getRepository(collection);
|
|
30
25
|
const options = processor.getParsedValue(params);
|
|
31
26
|
const result = yield repo.update(_objectSpread(_objectSpread({}, options), {}, {
|
|
@@ -40,6 +35,5 @@ var _default = {
|
|
|
40
35
|
};
|
|
41
36
|
})();
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
};
|
|
45
39
|
exports.default = _default;
|
|
@@ -4,82 +4,62 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
19
|
-
|
|
20
15
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21
|
-
|
|
22
16
|
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; }
|
|
23
|
-
|
|
24
17
|
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; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
21
|
const VTypes = {
|
|
29
22
|
constant(operand) {
|
|
30
23
|
return operand.value;
|
|
31
24
|
},
|
|
32
|
-
|
|
33
25
|
$jobsMapByNodeId({
|
|
34
26
|
options
|
|
35
27
|
}) {
|
|
36
28
|
const paths = [options.nodeId, options.path].filter(Boolean);
|
|
37
29
|
return paths ? `{{$jobsMapByNodeId.${paths.join('.')}}}` : null;
|
|
38
30
|
},
|
|
39
|
-
|
|
40
31
|
$context({
|
|
41
32
|
options
|
|
42
33
|
}) {
|
|
43
34
|
return `{{$context.${options.path}}}`;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
36
|
};
|
|
47
|
-
|
|
48
37
|
function migrateConfig(config) {
|
|
49
38
|
if (Array.isArray(config)) {
|
|
50
39
|
return config.map(item => migrateConfig(item));
|
|
51
40
|
}
|
|
52
|
-
|
|
53
41
|
if (typeof config !== 'object') {
|
|
54
42
|
return config;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
44
|
if (!config) {
|
|
58
45
|
return config;
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
if (config.type && VTypes[config.type] && (config.options || config.value)) {
|
|
62
48
|
return VTypes[config.type](config);
|
|
63
49
|
}
|
|
64
|
-
|
|
65
50
|
return Object.keys(config).reduce((memo, key) => _objectSpread(_objectSpread({}, memo), {}, {
|
|
66
51
|
[key]: migrateConfig(config[key])
|
|
67
52
|
}), {});
|
|
68
53
|
}
|
|
69
|
-
|
|
70
54
|
class _default extends _server().Migration {
|
|
71
55
|
up() {
|
|
72
56
|
var _this = this;
|
|
73
|
-
|
|
74
57
|
return _asyncToGenerator(function* () {
|
|
75
58
|
const match = yield _this.app.version.satisfies('<=0.8.0-alpha.13');
|
|
76
|
-
|
|
77
59
|
if (!match) {
|
|
78
60
|
return;
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
const NodeRepo = _this.context.db.getRepository('flow_nodes');
|
|
82
|
-
|
|
83
63
|
yield _this.context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
84
64
|
var _ref = _asyncToGenerator(function* (transaction) {
|
|
85
65
|
const nodes = yield NodeRepo.find({
|
|
@@ -99,18 +79,14 @@ class _default extends _server().Migration {
|
|
|
99
79
|
});
|
|
100
80
|
}, Promise.resolve());
|
|
101
81
|
});
|
|
102
|
-
|
|
103
82
|
return function (_x) {
|
|
104
83
|
return _ref.apply(this, arguments);
|
|
105
84
|
};
|
|
106
85
|
}());
|
|
107
86
|
})();
|
|
108
87
|
}
|
|
109
|
-
|
|
110
88
|
down() {
|
|
111
89
|
return _asyncToGenerator(function* () {})();
|
|
112
90
|
}
|
|
113
|
-
|
|
114
91
|
}
|
|
115
|
-
|
|
116
92
|
exports.default = _default;
|
|
@@ -4,38 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
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; }
|
|
19
|
-
|
|
20
15
|
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; }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
-
|
|
26
20
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27
|
-
|
|
28
21
|
const EJS_RE = /"?<%=\s*(ctx|node)([\w\.\[\]-]+)\s*.*%>"?/;
|
|
29
|
-
|
|
30
22
|
function migrateData(input) {
|
|
31
23
|
if (typeof input !== 'string') {
|
|
32
24
|
return input;
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
if (!input) {
|
|
36
27
|
return null;
|
|
37
28
|
}
|
|
38
|
-
|
|
39
29
|
const typeMap = {
|
|
40
30
|
ctx: '$context',
|
|
41
31
|
node: '$jobsMapByNodeId'
|
|
@@ -44,28 +34,21 @@ function migrateData(input) {
|
|
|
44
34
|
if (type === 'ctx') {
|
|
45
35
|
return `"{{$context${path}}}"`;
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
if (type === 'node') {
|
|
49
38
|
return `"{{$jobsMapByNodeId${path.replace('[', '.').replace(']', '.').replace(/\.$/, '')}}}"`;
|
|
50
39
|
}
|
|
51
|
-
|
|
52
40
|
return _;
|
|
53
41
|
});
|
|
54
42
|
}
|
|
55
|
-
|
|
56
43
|
class _default extends _server().Migration {
|
|
57
44
|
up() {
|
|
58
45
|
var _this = this;
|
|
59
|
-
|
|
60
46
|
return _asyncToGenerator(function* () {
|
|
61
47
|
const match = yield _this.app.version.satisfies('<0.9.0-alpha.3');
|
|
62
|
-
|
|
63
48
|
if (!match) {
|
|
64
49
|
return;
|
|
65
50
|
}
|
|
66
|
-
|
|
67
51
|
const NodeRepo = _this.context.db.getRepository('flow_nodes');
|
|
68
|
-
|
|
69
52
|
yield _this.context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
70
53
|
var _ref = _asyncToGenerator(function* (transaction) {
|
|
71
54
|
const nodes = yield NodeRepo.find({
|
|
@@ -79,9 +62,7 @@ class _default extends _server().Migration {
|
|
|
79
62
|
if (typeof node.config.data !== 'string') {
|
|
80
63
|
return;
|
|
81
64
|
}
|
|
82
|
-
|
|
83
65
|
let data = migrateData(node.config.data);
|
|
84
|
-
|
|
85
66
|
try {
|
|
86
67
|
data = JSON.parse(node.config.data);
|
|
87
68
|
return node.update({
|
|
@@ -96,18 +77,14 @@ class _default extends _server().Migration {
|
|
|
96
77
|
}
|
|
97
78
|
})), Promise.resolve());
|
|
98
79
|
});
|
|
99
|
-
|
|
100
80
|
return function (_x) {
|
|
101
81
|
return _ref.apply(this, arguments);
|
|
102
82
|
};
|
|
103
83
|
}());
|
|
104
84
|
})();
|
|
105
85
|
}
|
|
106
|
-
|
|
107
86
|
down() {
|
|
108
87
|
return _asyncToGenerator(function* () {})();
|
|
109
88
|
}
|
|
110
|
-
|
|
111
89
|
}
|
|
112
|
-
|
|
113
90
|
exports.default = _default;
|
|
@@ -4,39 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const _excluded = ["calculation"];
|
|
19
|
-
|
|
20
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
-
|
|
22
16
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
23
|
-
|
|
24
17
|
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; }
|
|
25
|
-
|
|
26
18
|
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; }
|
|
27
|
-
|
|
28
19
|
function addQuote(v) {
|
|
29
20
|
if (typeof v !== 'string') {
|
|
30
21
|
return v;
|
|
31
22
|
}
|
|
32
|
-
|
|
33
23
|
if (v.match(/^{{\s*([^{}]+)\s*}}$/)) {
|
|
34
24
|
return v;
|
|
35
25
|
}
|
|
36
|
-
|
|
37
26
|
return `'${v}'`;
|
|
38
27
|
}
|
|
39
|
-
|
|
40
28
|
const calculatorsMap = {
|
|
41
29
|
'equal': '==',
|
|
42
30
|
'===': '==',
|
|
@@ -51,47 +39,35 @@ const calculatorsMap = {
|
|
|
51
39
|
'multiple': '*',
|
|
52
40
|
'divide': '/',
|
|
53
41
|
'mod': '%',
|
|
54
|
-
|
|
55
42
|
includes(a, b) {
|
|
56
43
|
return `SEARCH(${b}, ${a}) >= 0`;
|
|
57
44
|
},
|
|
58
|
-
|
|
59
45
|
notIncludes(a, b) {
|
|
60
46
|
return `SEARCH(${b}, ${a}) < 0`;
|
|
61
47
|
},
|
|
62
|
-
|
|
63
48
|
startsWith(a, b) {
|
|
64
49
|
return `SEARCH(${b}, ${a}) == 0`;
|
|
65
50
|
},
|
|
66
|
-
|
|
67
51
|
endsWith(a, b) {
|
|
68
52
|
return `RIGHT(${a}, LEN(${b})) == ${b}`;
|
|
69
53
|
},
|
|
70
|
-
|
|
71
54
|
notStartsWith(a, b) {
|
|
72
55
|
return `SEARCH(${b}, ${a}) != 0`;
|
|
73
56
|
},
|
|
74
|
-
|
|
75
57
|
notEndsWith(a, b) {
|
|
76
58
|
return `RIGHT(${a}, LEN(${b})) != ${b}`;
|
|
77
59
|
},
|
|
78
|
-
|
|
79
60
|
concat(a, b) {
|
|
80
61
|
return `CONCATENATE(${a}, ${b})`;
|
|
81
62
|
}
|
|
82
|
-
|
|
83
63
|
};
|
|
84
|
-
|
|
85
64
|
function migrateConfig(_ref = {}) {
|
|
86
65
|
var _calculation$operands, _calculator$operands;
|
|
87
|
-
|
|
88
66
|
let calculation = _ref.calculation,
|
|
89
|
-
|
|
90
|
-
|
|
67
|
+
config = _objectWithoutProperties(_ref, _excluded);
|
|
91
68
|
if (!(calculation === null || calculation === void 0 ? void 0 : calculation.calculator) || !(calculation === null || calculation === void 0 ? void 0 : (_calculation$operands = calculation.operands) === null || _calculation$operands === void 0 ? void 0 : _calculation$operands.length)) {
|
|
92
69
|
return config;
|
|
93
70
|
}
|
|
94
|
-
|
|
95
71
|
const calculator = calculatorsMap[calculation.calculator];
|
|
96
72
|
const operands = ((_calculator$operands = calculator.operands) !== null && _calculator$operands !== void 0 ? _calculator$operands : []).map(operand => addQuote(operand));
|
|
97
73
|
return {
|
|
@@ -99,20 +75,15 @@ function migrateConfig(_ref = {}) {
|
|
|
99
75
|
expression: typeof calculator === 'function' ? calculator(...operands) : operands.join(` ${calculator !== null && calculator !== void 0 ? calculator : calculation.calculator} `)
|
|
100
76
|
};
|
|
101
77
|
}
|
|
102
|
-
|
|
103
78
|
class _default extends _server().Migration {
|
|
104
79
|
up() {
|
|
105
80
|
var _this = this;
|
|
106
|
-
|
|
107
81
|
return _asyncToGenerator(function* () {
|
|
108
82
|
const match = yield _this.app.version.satisfies('<0.9.0-alpha.3');
|
|
109
|
-
|
|
110
83
|
if (!match) {
|
|
111
84
|
return;
|
|
112
85
|
}
|
|
113
|
-
|
|
114
86
|
const NodeRepo = _this.context.db.getRepository('flow_nodes');
|
|
115
|
-
|
|
116
87
|
yield _this.context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
117
88
|
var _ref2 = _asyncToGenerator(function* (transaction) {
|
|
118
89
|
const nodes = yield NodeRepo.find({
|
|
@@ -130,14 +101,11 @@ class _default extends _server().Migration {
|
|
|
130
101
|
});
|
|
131
102
|
}), Promise.resolve());
|
|
132
103
|
});
|
|
133
|
-
|
|
134
104
|
return function (_x) {
|
|
135
105
|
return _ref2.apply(this, arguments);
|
|
136
106
|
};
|
|
137
107
|
}());
|
|
138
108
|
})();
|
|
139
109
|
}
|
|
140
|
-
|
|
141
110
|
}
|
|
142
|
-
|
|
143
111
|
exports.default = _default;
|
|
@@ -4,27 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
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; }
|
|
19
|
-
|
|
20
15
|
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; }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
-
|
|
26
20
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27
|
-
|
|
28
21
|
const calculatorsMap = {
|
|
29
22
|
'equal': '==',
|
|
30
23
|
'===': '==',
|
|
@@ -34,33 +27,25 @@ const calculatorsMap = {
|
|
|
34
27
|
'gte': '>=',
|
|
35
28
|
'lt': '<',
|
|
36
29
|
'lte': '<=',
|
|
37
|
-
|
|
38
30
|
includes(a, b) {
|
|
39
31
|
return `SEARCH('${b}', '${a}') >= 0`;
|
|
40
32
|
},
|
|
41
|
-
|
|
42
33
|
notIncludes(a, b) {
|
|
43
34
|
return `SEARCH('${b}', '${a}') < 0`;
|
|
44
35
|
},
|
|
45
|
-
|
|
46
36
|
startsWith(a, b) {
|
|
47
37
|
return `SEARCH('${b}', '${a}') == 0`;
|
|
48
38
|
},
|
|
49
|
-
|
|
50
39
|
endsWith(a, b) {
|
|
51
40
|
return `RIGHT('${a}', LEN('${b}')) == '${b}'`;
|
|
52
41
|
},
|
|
53
|
-
|
|
54
42
|
notStartsWith(a, b) {
|
|
55
43
|
return `SEARCH('${b}', '${a}') != 0`;
|
|
56
44
|
},
|
|
57
|
-
|
|
58
45
|
notEndsWith(a, b) {
|
|
59
46
|
return `RIGHT('${a}', LEN('${b}')) != '${b}'`;
|
|
60
47
|
}
|
|
61
|
-
|
|
62
48
|
};
|
|
63
|
-
|
|
64
49
|
function migrateConfig({
|
|
65
50
|
group: {
|
|
66
51
|
type = 'and',
|
|
@@ -79,20 +64,15 @@ function migrateConfig({
|
|
|
79
64
|
}
|
|
80
65
|
};
|
|
81
66
|
}
|
|
82
|
-
|
|
83
67
|
class _default extends _server().Migration {
|
|
84
68
|
up() {
|
|
85
69
|
var _this = this;
|
|
86
|
-
|
|
87
70
|
return _asyncToGenerator(function* () {
|
|
88
71
|
const match = yield _this.app.version.satisfies('<0.9.0-alpha.3');
|
|
89
|
-
|
|
90
72
|
if (!match) {
|
|
91
73
|
return;
|
|
92
74
|
}
|
|
93
|
-
|
|
94
75
|
const NodeRepo = _this.context.db.getRepository('flow_nodes');
|
|
95
|
-
|
|
96
76
|
yield _this.context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
97
77
|
var _ref = _asyncToGenerator(function* (transaction) {
|
|
98
78
|
const nodes = yield NodeRepo.find({
|
|
@@ -105,22 +85,19 @@ class _default extends _server().Migration {
|
|
|
105
85
|
yield nodes.reduce((promise, node) => promise.then(() => {
|
|
106
86
|
return node.update({
|
|
107
87
|
config: _objectSpread(_objectSpread({}, node.config), {}, {
|
|
108
|
-
engine: 'basic'
|
|
109
|
-
|
|
88
|
+
engine: 'basic'
|
|
89
|
+
// calculation: migrateConfig(node.config.calculation)
|
|
110
90
|
})
|
|
111
91
|
}, {
|
|
112
92
|
transaction
|
|
113
93
|
});
|
|
114
94
|
}), Promise.resolve());
|
|
115
95
|
});
|
|
116
|
-
|
|
117
96
|
return function (_x) {
|
|
118
97
|
return _ref.apply(this, arguments);
|
|
119
98
|
};
|
|
120
99
|
}());
|
|
121
100
|
})();
|
|
122
101
|
}
|
|
123
|
-
|
|
124
102
|
}
|
|
125
|
-
|
|
126
103
|
exports.default = _default;
|
|
@@ -4,46 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _sequelize() {
|
|
9
8
|
const data = require("sequelize");
|
|
10
|
-
|
|
11
9
|
_sequelize = function _sequelize() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _server() {
|
|
19
15
|
const data = require("@nocobase/server");
|
|
20
|
-
|
|
21
16
|
_server = function _server() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
29
|
-
|
|
30
22
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
31
|
-
|
|
32
23
|
class _default extends _server().Migration {
|
|
33
24
|
up() {
|
|
34
25
|
var _arguments = arguments,
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
_this = this;
|
|
37
27
|
return _asyncToGenerator(function* () {
|
|
38
28
|
const match = yield _this.app.version.satisfies('<0.9.0-alpha.3');
|
|
39
|
-
|
|
40
29
|
if (!match) {
|
|
41
30
|
return;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
const _arguments$0$context = _arguments[0].context,
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
sequelize = _arguments$0$context.sequelize,
|
|
34
|
+
queryInterface = _arguments$0$context.queryInterface;
|
|
47
35
|
const db = _this.app.db;
|
|
48
36
|
yield sequelize.transaction( /*#__PURE__*/function () {
|
|
49
37
|
var _ref = _asyncToGenerator(function* (transaction) {
|
|
@@ -68,14 +56,11 @@ class _default extends _server().Migration {
|
|
|
68
56
|
transaction
|
|
69
57
|
});
|
|
70
58
|
});
|
|
71
|
-
|
|
72
59
|
return function (_x) {
|
|
73
60
|
return _ref.apply(this, arguments);
|
|
74
61
|
};
|
|
75
62
|
}());
|
|
76
63
|
})();
|
|
77
64
|
}
|
|
78
|
-
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
exports.default = _default;
|