@nocobase/plugin-workflow 0.13.0-alpha.4 → 0.13.0-alpha.6
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/dist/client/index.js +132 -9332
- package/dist/index.js +37 -16
- package/dist/locale/en-US.js +22 -4
- package/dist/locale/es-ES.js +22 -4
- package/dist/locale/fr-FR.js +22 -4
- package/dist/locale/ja-JP.js +22 -4
- package/dist/locale/pt-BR.js +22 -4
- package/dist/locale/ru-RU.js +22 -4
- package/dist/locale/tr-TR.js +22 -4
- package/dist/locale/zh-CN.js +22 -4
- package/dist/node_modules/cron-parser/lib/parser.js +1 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/index-cjs.js +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.js +70 -55
- package/dist/server/Processor.js +42 -25
- package/dist/server/actions/executions.js +41 -14
- package/dist/server/actions/index.js +39 -34
- package/dist/server/actions/nodes.js +48 -28
- package/dist/server/actions/workflows.js +50 -20
- package/dist/server/collections/executions.js +22 -4
- package/dist/server/collections/flow_nodes.js +22 -4
- package/dist/server/collections/jobs.js +22 -4
- package/dist/server/collections/workflows.js +22 -4
- package/dist/server/constants.js +30 -6
- package/dist/server/fields/expression-field.js +29 -8
- package/dist/server/fields/index.js +24 -7
- package/dist/server/functions/index.js +22 -4
- package/dist/server/index.js +45 -39
- package/dist/server/instructions/aggregate.js +30 -13
- package/dist/server/instructions/calculation.js +30 -13
- package/dist/server/instructions/condition.js +36 -17
- package/dist/server/instructions/create.js +26 -9
- package/dist/server/instructions/delay.js +27 -10
- package/dist/server/instructions/destroy.js +24 -7
- package/dist/server/instructions/index.js +35 -12
- package/dist/server/instructions/loop.js +27 -10
- package/dist/server/instructions/manual/actions.js +31 -10
- package/dist/server/instructions/manual/collecions/jobs.js +22 -4
- package/dist/server/instructions/manual/collecions/users.js +22 -4
- package/dist/server/instructions/manual/collecions/users_jobs.js +22 -4
- package/dist/server/instructions/manual/forms/create.js +22 -4
- package/dist/server/instructions/manual/forms/index.js +36 -14
- package/dist/server/instructions/manual/forms/update.js +22 -4
- package/dist/server/instructions/manual/index.js +60 -41
- package/dist/server/instructions/parallel.js +47 -28
- package/dist/server/instructions/query.js +31 -14
- package/dist/server/instructions/request.js +39 -16
- package/dist/server/instructions/sql.js +25 -8
- package/dist/server/instructions/update.js +24 -7
- package/dist/server/migrations/20221129153547-calculation-variables.js +24 -7
- package/dist/server/migrations/20230221032941-change-request-body-type.js +28 -7
- package/dist/server/migrations/20230221071831-calculation-expression.js +24 -7
- package/dist/server/migrations/20230221121203-condition-calculation.js +62 -7
- package/dist/server/migrations/20230221162902-jsonb-to-json.js +29 -12
- package/dist/server/migrations/20230411034722-manual-multi-form.js +38 -15
- package/dist/server/migrations/20230612021134-manual-collection-block.js +26 -9
- package/dist/server/migrations/20230710115902-manual-action-values.js +24 -7
- package/dist/server/migrations/20230809113132-workflow-options.js +24 -7
- package/dist/server/triggers/collection.js +26 -9
- package/dist/server/triggers/form.js +28 -11
- package/dist/server/triggers/index.js +42 -17
- package/dist/server/triggers/schedule.js +56 -31
- package/dist/server/types/Execution.js +24 -7
- package/dist/server/types/FlowNode.js +24 -7
- package/dist/server/types/Job.js +24 -7
- package/dist/server/types/Workflow.js +24 -7
- package/dist/server/types/index.js +15 -2
- package/dist/server/utils.js +26 -4
- package/dist/swagger/index.d.ts +103 -53
- package/dist/swagger/index.js +144 -71
- package/package.json +2 -2
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var calculation_expression_exports = {};
|
|
19
|
+
__export(calculation_expression_exports, {
|
|
20
|
+
default: () => calculation_expression_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(calculation_expression_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
5
24
|
function addQuote(v) {
|
|
6
25
|
if (typeof v !== "string") {
|
|
7
26
|
return v;
|
|
@@ -59,7 +78,7 @@ function migrateConfig({ calculation, ...config } = {}) {
|
|
|
59
78
|
expression: typeof calculator === "function" ? calculator(...operands) : operands.join(` ${calculator ?? calculation.calculator} `)
|
|
60
79
|
};
|
|
61
80
|
}
|
|
62
|
-
class calculation_expression_default extends
|
|
81
|
+
class calculation_expression_default extends import_server.Migration {
|
|
63
82
|
async up() {
|
|
64
83
|
const match = await this.app.version.satisfies("<0.9.0-alpha.3");
|
|
65
84
|
if (!match) {
|
|
@@ -90,5 +109,3 @@ class calculation_expression_default extends server.Migration {
|
|
|
90
109
|
});
|
|
91
110
|
}
|
|
92
111
|
}
|
|
93
|
-
|
|
94
|
-
module.exports = calculation_expression_default;
|
|
@@ -1,8 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var condition_calculation_exports = {};
|
|
19
|
+
__export(condition_calculation_exports, {
|
|
20
|
+
default: () => condition_calculation_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(condition_calculation_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
24
|
+
const calculatorsMap = {
|
|
25
|
+
equal: "==",
|
|
26
|
+
"===": "==",
|
|
27
|
+
notEqual: "!=",
|
|
28
|
+
"!==": "!=",
|
|
29
|
+
gt: ">",
|
|
30
|
+
gte: ">=",
|
|
31
|
+
lt: "<",
|
|
32
|
+
lte: "<=",
|
|
33
|
+
includes(a, b) {
|
|
34
|
+
return `SEARCH('${b}', '${a}') >= 0`;
|
|
35
|
+
},
|
|
36
|
+
notIncludes(a, b) {
|
|
37
|
+
return `SEARCH('${b}', '${a}') < 0`;
|
|
38
|
+
},
|
|
39
|
+
startsWith(a, b) {
|
|
40
|
+
return `SEARCH('${b}', '${a}') == 0`;
|
|
41
|
+
},
|
|
42
|
+
endsWith(a, b) {
|
|
43
|
+
return `RIGHT('${a}', LEN('${b}')) == '${b}'`;
|
|
44
|
+
},
|
|
45
|
+
notStartsWith(a, b) {
|
|
46
|
+
return `SEARCH('${b}', '${a}') != 0`;
|
|
47
|
+
},
|
|
48
|
+
notEndsWith(a, b) {
|
|
49
|
+
return `RIGHT('${a}', LEN('${b}')) != '${b}'`;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function migrateConfig({ group: { type = "and", calculations = [] } }) {
|
|
53
|
+
return {
|
|
54
|
+
group: {
|
|
55
|
+
type,
|
|
56
|
+
calculations: calculations.map(({ calculator = "===", operands = [] }) => {
|
|
57
|
+
return `(${operands.map((operand) => (operand == null ? void 0 : operand.group) ? migrateConfig(operand) : operand).join(` ${calculatorsMap[calculator]} `)})`;
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
class condition_calculation_default extends import_server.Migration {
|
|
6
63
|
async up() {
|
|
7
64
|
const match = await this.app.version.satisfies("<0.9.0-alpha.3");
|
|
8
65
|
if (!match) {
|
|
@@ -37,5 +94,3 @@ class condition_calculation_default extends server.Migration {
|
|
|
37
94
|
});
|
|
38
95
|
}
|
|
39
96
|
}
|
|
40
|
-
|
|
41
|
-
module.exports = condition_calculation_default;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var jsonb_to_json_exports = {};
|
|
19
|
+
__export(jsonb_to_json_exports, {
|
|
20
|
+
default: () => jsonb_to_json_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(jsonb_to_json_exports);
|
|
23
|
+
var import_database = require("@nocobase/database");
|
|
24
|
+
var import_server = require("@nocobase/server");
|
|
25
|
+
class jsonb_to_json_default extends import_server.Migration {
|
|
7
26
|
async up() {
|
|
8
27
|
const match = await this.app.version.satisfies("<0.9.0-alpha.3");
|
|
9
28
|
if (!match) {
|
|
@@ -17,7 +36,7 @@ class jsonb_to_json_default extends server.Migration {
|
|
|
17
36
|
db.getCollection("workflows").model.getTableName(),
|
|
18
37
|
"config",
|
|
19
38
|
{
|
|
20
|
-
type:
|
|
39
|
+
type: import_database.DataTypes.JSON
|
|
21
40
|
},
|
|
22
41
|
{ transaction }
|
|
23
42
|
);
|
|
@@ -25,7 +44,7 @@ class jsonb_to_json_default extends server.Migration {
|
|
|
25
44
|
db.getCollection("flow_nodes").model.getTableName(),
|
|
26
45
|
"config",
|
|
27
46
|
{
|
|
28
|
-
type:
|
|
47
|
+
type: import_database.DataTypes.JSON
|
|
29
48
|
},
|
|
30
49
|
{ transaction }
|
|
31
50
|
);
|
|
@@ -33,7 +52,7 @@ class jsonb_to_json_default extends server.Migration {
|
|
|
33
52
|
db.getCollection("executions").model.getTableName(),
|
|
34
53
|
"context",
|
|
35
54
|
{
|
|
36
|
-
type:
|
|
55
|
+
type: import_database.DataTypes.JSON
|
|
37
56
|
},
|
|
38
57
|
{ transaction }
|
|
39
58
|
);
|
|
@@ -41,12 +60,10 @@ class jsonb_to_json_default extends server.Migration {
|
|
|
41
60
|
db.getCollection("jobs").model.getTableName(),
|
|
42
61
|
"result",
|
|
43
62
|
{
|
|
44
|
-
type:
|
|
63
|
+
type: import_database.DataTypes.JSON
|
|
45
64
|
},
|
|
46
65
|
{ transaction }
|
|
47
66
|
);
|
|
48
67
|
});
|
|
49
68
|
}
|
|
50
69
|
}
|
|
51
|
-
|
|
52
|
-
module.exports = jsonb_to_json_default;
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var manual_multi_form_exports = {};
|
|
29
|
+
__export(manual_multi_form_exports, {
|
|
30
|
+
default: () => manual_multi_form_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(manual_multi_form_exports);
|
|
33
|
+
var import_server = require("@nocobase/server");
|
|
34
|
+
var import_utils = require("@nocobase/utils");
|
|
35
|
+
var import_lodash = __toESM(require("lodash"));
|
|
11
36
|
function findSchema(root, filter, onlyLeaf = false) {
|
|
12
37
|
const result = [];
|
|
13
38
|
if (!root) {
|
|
@@ -82,7 +107,7 @@ function migrateConfig({ schema = {}, actions = [] }) {
|
|
|
82
107
|
type: "customForm"
|
|
83
108
|
}
|
|
84
109
|
});
|
|
85
|
-
const formId =
|
|
110
|
+
const formId = (0, import_utils.uid)();
|
|
86
111
|
const newFormBlock = {
|
|
87
112
|
[formId]: {
|
|
88
113
|
type: "void",
|
|
@@ -141,7 +166,7 @@ function migrateUsedConfig(config, manualForms) {
|
|
|
141
166
|
});
|
|
142
167
|
return config;
|
|
143
168
|
}
|
|
144
|
-
class manual_multi_form_default extends
|
|
169
|
+
class manual_multi_form_default extends import_server.Migration {
|
|
145
170
|
async up() {
|
|
146
171
|
const match = await this.app.version.satisfies("<0.9.1-alpha.3");
|
|
147
172
|
if (!match) {
|
|
@@ -235,7 +260,7 @@ class manual_multi_form_default extends server.Migration {
|
|
|
235
260
|
(promise, node) => promise.then(async () => {
|
|
236
261
|
await node.update(
|
|
237
262
|
{
|
|
238
|
-
config: migrateUsedConfig(
|
|
263
|
+
config: migrateUsedConfig(import_lodash.default.cloneDeep(node.config ?? {}), nodeForms)
|
|
239
264
|
},
|
|
240
265
|
{
|
|
241
266
|
silent: true,
|
|
@@ -248,5 +273,3 @@ class manual_multi_form_default extends server.Migration {
|
|
|
248
273
|
});
|
|
249
274
|
}
|
|
250
275
|
}
|
|
251
|
-
|
|
252
|
-
module.exports = manual_multi_form_default;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var manual_collection_block_exports = {};
|
|
19
|
+
__export(manual_collection_block_exports, {
|
|
20
|
+
default: () => manual_collection_block_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(manual_collection_block_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
24
|
+
var import_utils = require("@nocobase/utils");
|
|
6
25
|
function findSchema(root, filter, onlyLeaf = false) {
|
|
7
26
|
const result = [];
|
|
8
27
|
if (!root) {
|
|
@@ -25,7 +44,7 @@ function migrateSchema(schema = {}) {
|
|
|
25
44
|
return item["x-component"] === "CardItem" && item["x-designer"] === "SimpleDesigner" && item["x-decorator"] === "CollectionProvider";
|
|
26
45
|
});
|
|
27
46
|
collectionBlocks.forEach((block) => {
|
|
28
|
-
const id =
|
|
47
|
+
const id = (0, import_utils.uid)();
|
|
29
48
|
const { grid } = block.properties;
|
|
30
49
|
delete block.properties.grid;
|
|
31
50
|
const fields = findSchema(grid, (item) => {
|
|
@@ -86,7 +105,7 @@ function migrateSchema(schema = {}) {
|
|
|
86
105
|
});
|
|
87
106
|
return schema;
|
|
88
107
|
}
|
|
89
|
-
class manual_collection_block_default extends
|
|
108
|
+
class manual_collection_block_default extends import_server.Migration {
|
|
90
109
|
async up() {
|
|
91
110
|
const match = await this.app.version.satisfies("<0.9.4-alpha.3");
|
|
92
111
|
if (!match) {
|
|
@@ -122,5 +141,3 @@ class manual_collection_block_default extends server.Migration {
|
|
|
122
141
|
});
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
|
-
|
|
126
|
-
module.exports = manual_collection_block_default;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var manual_action_values_exports = {};
|
|
19
|
+
__export(manual_action_values_exports, {
|
|
20
|
+
default: () => manual_action_values_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(manual_action_values_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
5
24
|
function findSchema(root, filter, onlyLeaf = false) {
|
|
6
25
|
const result = [];
|
|
7
26
|
if (!root) {
|
|
@@ -38,7 +57,7 @@ function migrateConfig(config) {
|
|
|
38
57
|
});
|
|
39
58
|
return config;
|
|
40
59
|
}
|
|
41
|
-
class manual_action_values_default extends
|
|
60
|
+
class manual_action_values_default extends import_server.Migration {
|
|
42
61
|
async up() {
|
|
43
62
|
const match = await this.app.version.satisfies("<0.11.0-alpha.2");
|
|
44
63
|
if (!match) {
|
|
@@ -70,5 +89,3 @@ class manual_action_values_default extends server.Migration {
|
|
|
70
89
|
});
|
|
71
90
|
}
|
|
72
91
|
}
|
|
73
|
-
|
|
74
|
-
module.exports = manual_action_values_default;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var workflow_options_exports = {};
|
|
19
|
+
__export(workflow_options_exports, {
|
|
20
|
+
default: () => workflow_options_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(workflow_options_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
24
|
+
class workflow_options_default extends import_server.Migration {
|
|
6
25
|
async up() {
|
|
7
26
|
const match = await this.app.version.satisfies("<0.11.0-alpha.2");
|
|
8
27
|
if (!match) {
|
|
@@ -30,5 +49,3 @@ class workflow_options_default extends server.Migration {
|
|
|
30
49
|
});
|
|
31
50
|
}
|
|
32
51
|
}
|
|
33
|
-
|
|
34
|
-
module.exports = workflow_options_default;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var collection_exports = {};
|
|
19
|
+
__export(collection_exports, {
|
|
20
|
+
default: () => CollectionTrigger
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(collection_exports);
|
|
23
|
+
var import__ = require("..");
|
|
24
|
+
var import_utils = require("../utils");
|
|
6
25
|
const MODE_BITMAP = {
|
|
7
26
|
CREATE: 1,
|
|
8
27
|
UPDATE: 2,
|
|
@@ -56,7 +75,7 @@ async function handler(workflow, data, options) {
|
|
|
56
75
|
transaction
|
|
57
76
|
});
|
|
58
77
|
}
|
|
59
|
-
const json =
|
|
78
|
+
const json = (0, import_utils.toJSON)(result);
|
|
60
79
|
this.plugin.trigger(
|
|
61
80
|
workflow,
|
|
62
81
|
{ data: json },
|
|
@@ -65,7 +84,7 @@ async function handler(workflow, data, options) {
|
|
|
65
84
|
}
|
|
66
85
|
);
|
|
67
86
|
}
|
|
68
|
-
class CollectionTrigger extends
|
|
87
|
+
class CollectionTrigger extends import__.Trigger {
|
|
69
88
|
events = /* @__PURE__ */ new Map();
|
|
70
89
|
on(workflow) {
|
|
71
90
|
const { db } = this.plugin.app;
|
|
@@ -112,5 +131,3 @@ class CollectionTrigger extends __.Trigger {
|
|
|
112
131
|
}
|
|
113
132
|
}
|
|
114
133
|
}
|
|
115
|
-
|
|
116
|
-
module.exports = CollectionTrigger;
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var form_exports = {};
|
|
19
|
+
__export(form_exports, {
|
|
20
|
+
default: () => FormTrigger
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(form_exports);
|
|
23
|
+
var import_lodash = require("lodash");
|
|
24
|
+
var import__ = require(".");
|
|
25
|
+
var import_database = require("@nocobase/database");
|
|
26
|
+
class FormTrigger extends import__.Trigger {
|
|
8
27
|
constructor(plugin) {
|
|
9
28
|
super(plugin);
|
|
10
29
|
plugin.app.resourcer.use(this.middleware);
|
|
@@ -58,7 +77,7 @@ class FormTrigger extends _.Trigger {
|
|
|
58
77
|
if (payload.get(field)) {
|
|
59
78
|
payload = payload.get(field);
|
|
60
79
|
} else {
|
|
61
|
-
const association =
|
|
80
|
+
const association = (0, import_database.modelAssociationByKey)(payload, field);
|
|
62
81
|
payload = await payload[association.accessors.get]();
|
|
63
82
|
}
|
|
64
83
|
}
|
|
@@ -77,7 +96,7 @@ class FormTrigger extends _.Trigger {
|
|
|
77
96
|
this.plugin.trigger(workflow, { data: payload, user: currentUser });
|
|
78
97
|
});
|
|
79
98
|
} else {
|
|
80
|
-
const data = trigger[1] ?
|
|
99
|
+
const data = trigger[1] ? (0, import_lodash.get)(values, trigger[1]) : values;
|
|
81
100
|
this.plugin.trigger(workflow, {
|
|
82
101
|
data,
|
|
83
102
|
user: currentUser
|
|
@@ -90,5 +109,3 @@ class FormTrigger extends _.Trigger {
|
|
|
90
109
|
off(workflow) {
|
|
91
110
|
}
|
|
92
111
|
}
|
|
93
|
-
|
|
94
|
-
module.exports = FormTrigger;
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var triggers_exports = {};
|
|
29
|
+
__export(triggers_exports, {
|
|
30
|
+
Trigger: () => Trigger,
|
|
31
|
+
default: () => triggers_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(triggers_exports);
|
|
34
|
+
var import_utils = require("@nocobase/utils");
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
12
36
|
class Trigger {
|
|
13
37
|
constructor(plugin) {
|
|
14
38
|
this.plugin = plugin;
|
|
@@ -16,13 +40,14 @@ class Trigger {
|
|
|
16
40
|
}
|
|
17
41
|
function triggers_default(plugin, more = {}) {
|
|
18
42
|
const { triggers } = plugin;
|
|
19
|
-
triggers.register("collection", new (
|
|
20
|
-
triggers.register("form", new (
|
|
21
|
-
triggers.register("schedule", new (
|
|
43
|
+
triggers.register("collection", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "collection")))(plugin));
|
|
44
|
+
triggers.register("form", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "form")))(plugin));
|
|
45
|
+
triggers.register("schedule", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "schedule")))(plugin));
|
|
22
46
|
for (const [name, TClass] of Object.entries(more)) {
|
|
23
47
|
triggers.register(name, new TClass(plugin));
|
|
24
48
|
}
|
|
25
49
|
}
|
|
26
|
-
|
|
27
|
-
exports
|
|
28
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
Trigger
|
|
53
|
+
});
|