@nocobase/plugin-workflow 2.1.0-alpha.3 → 2.1.0-alpha.31
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/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/214.7e602cfe7a8251b8.js +10 -0
- package/dist/client/261.7722d7400942730e.js +10 -0
- package/dist/client/67.0fc4959e87c6b4da.js +10 -0
- package/dist/client/964.6251d37b35710747.js +10 -0
- package/dist/client/hooks/{useWorkflowFilterActionProps.d.ts → useResourceFilterActionProps.d.ts} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/nodes/create.d.ts +10 -0
- package/dist/client/nodes/destroy.d.ts +10 -0
- package/dist/client/nodes/index.d.ts +3 -0
- package/dist/client/nodes/query.d.ts +18 -2
- package/dist/client/nodes/update.d.ts +10 -0
- package/dist/client/schemas/collection.d.ts +8 -2
- package/dist/client/schemas/executions.d.ts +41 -23
- package/dist/client/triggers/collection.d.ts +14 -1
- package/dist/client/triggers/index.d.ts +4 -0
- package/dist/client/triggers/schedule/constants.d.ts +4 -0
- package/dist/client/triggers/schedule/index.d.ts +15 -0
- package/dist/common/collections/executions.d.ts +22 -22
- package/dist/common/collections/executions.js +12 -0
- package/dist/common/collections/jobs.js +7 -0
- package/dist/common/collections/workflows.d.ts +59 -9
- package/dist/common/collections/workflows.js +31 -1
- package/dist/externalVersion.js +15 -13
- package/dist/locale/zh-CN.json +4 -1
- 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/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +178 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1067 -0
- package/dist/node_modules/joi/lib/types/link.js +168 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +1692 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{mjs → esm/browser}/index.js +537 -179
- package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/dist/node_modules/lru-cache/dist/esm/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{cjs → esm}/index.js +538 -184
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Dispatcher.d.ts +3 -2
- package/dist/server/Dispatcher.js +74 -61
- package/dist/server/Plugin.d.ts +1 -0
- package/dist/server/Plugin.js +28 -3
- package/dist/server/actions/nodes.d.ts +5 -0
- package/dist/server/actions/nodes.js +38 -5
- package/dist/server/actions/workflows.d.ts +6 -0
- package/dist/server/actions/workflows.js +38 -0
- package/dist/server/instructions/ConditionInstruction.d.ts +2 -0
- package/dist/server/instructions/ConditionInstruction.js +17 -0
- package/dist/server/instructions/CreateInstruction.d.ts +3 -0
- package/dist/server/instructions/CreateInstruction.js +25 -0
- package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
- package/dist/server/instructions/DestroyInstruction.js +25 -0
- package/dist/server/instructions/EndInstruction.d.ts +2 -0
- package/dist/server/instructions/EndInstruction.js +4 -0
- package/dist/server/instructions/MultiConditionsInstruction.d.ts +2 -0
- package/dist/server/instructions/MultiConditionsInstruction.js +23 -0
- package/dist/server/instructions/OutputInstruction.d.ts +2 -0
- package/dist/server/instructions/OutputInstruction.js +14 -0
- package/dist/server/instructions/QueryInstruction.d.ts +3 -0
- package/dist/server/instructions/QueryInstruction.js +32 -7
- package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
- package/dist/server/instructions/UpdateInstruction.js +27 -0
- package/dist/server/instructions/index.d.ts +15 -2
- package/dist/server/instructions/index.js +18 -0
- package/dist/server/migrations/20260423225800-fill-workflow-created-updated-by.d.ts +13 -0
- package/dist/server/migrations/20260423225800-fill-workflow-created-updated-by.js +57 -0
- package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
- package/dist/server/triggers/CollectionTrigger.js +28 -0
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
- package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
- package/dist/server/triggers/index.d.ts +3 -0
- package/dist/server/triggers/index.js +18 -0
- package/dist/server/utils.d.ts +17 -0
- package/dist/server/utils.js +51 -2
- package/dist/swagger/index.d.ts +830 -109
- package/dist/swagger/index.js +947 -208
- package/package.json +6 -5
- package/dist/client/27bd65abee87cafa.js +0 -10
- package/dist/client/478692c1637f2742.js +0 -10
- package/dist/client/c1347b9d21f864d9.js +0 -10
- package/dist/client/f39e94207f92e352.js +0 -10
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
- package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
- /package/dist/node_modules/lru-cache/dist/{cjs → commonjs}/package.json +0 -0
- /package/dist/node_modules/lru-cache/dist/{mjs → esm}/package.json +0 -0
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var ConditionInstruction_exports = {};
|
|
28
38
|
__export(ConditionInstruction_exports, {
|
|
@@ -31,6 +41,7 @@ __export(ConditionInstruction_exports, {
|
|
|
31
41
|
default: () => ConditionInstruction_default
|
|
32
42
|
});
|
|
33
43
|
module.exports = __toCommonJS(ConditionInstruction_exports);
|
|
44
|
+
var import_joi = __toESM(require("joi"));
|
|
34
45
|
var import_evaluators = require("@nocobase/evaluators");
|
|
35
46
|
var import__ = require(".");
|
|
36
47
|
var import_constants = require("../constants");
|
|
@@ -41,6 +52,12 @@ const BRANCH_INDEX = {
|
|
|
41
52
|
ON_FALSE: 0
|
|
42
53
|
};
|
|
43
54
|
class ConditionInstruction extends import__.Instruction {
|
|
55
|
+
configSchema = import_joi.default.object({
|
|
56
|
+
rejectOnFalse: import_joi.default.boolean().required(),
|
|
57
|
+
engine: import_joi.default.string().valid("basic", "math.js", "formula.js"),
|
|
58
|
+
calculation: import_joi.default.object(),
|
|
59
|
+
expression: import_joi.default.string()
|
|
60
|
+
});
|
|
44
61
|
async run(node, prevJob, processor) {
|
|
45
62
|
const { engine, calculation, expression, rejectOnFalse } = node.config || {};
|
|
46
63
|
const evaluator = import_evaluators.evaluators.get(engine);
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import type Processor from '../Processor';
|
|
10
11
|
import type { FlowNodeModel } from '../types';
|
|
11
12
|
import { Instruction } from '.';
|
|
12
13
|
export declare class CreateInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
15
|
+
validateConfig(config: Record<string, any>): Record<string, string>;
|
|
13
16
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
14
17
|
result: any;
|
|
15
18
|
status: 1;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var CreateInstruction_exports = {};
|
|
28
38
|
__export(CreateInstruction_exports, {
|
|
@@ -30,11 +40,26 @@ __export(CreateInstruction_exports, {
|
|
|
30
40
|
default: () => CreateInstruction_default
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(CreateInstruction_exports);
|
|
43
|
+
var import_joi = __toESM(require("joi"));
|
|
33
44
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
34
45
|
var import_constants = require("../constants");
|
|
35
46
|
var import_utils = require("../utils");
|
|
36
47
|
var import__ = require(".");
|
|
37
48
|
class CreateInstruction extends import__.Instruction {
|
|
49
|
+
configSchema = import_joi.default.object({
|
|
50
|
+
collection: import_joi.default.string().required().messages({ "any.required": "Collection is not configured" }),
|
|
51
|
+
params: import_joi.default.object({
|
|
52
|
+
values: import_joi.default.object(),
|
|
53
|
+
appends: import_joi.default.array().items(import_joi.default.string())
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
validateConfig(config) {
|
|
57
|
+
const errors = super.validateConfig(config);
|
|
58
|
+
if (errors) {
|
|
59
|
+
return errors;
|
|
60
|
+
}
|
|
61
|
+
return (0, import_utils.validateCollectionField)(config.collection, this.workflow.app.dataSourceManager);
|
|
62
|
+
}
|
|
38
63
|
async run(node, input, processor) {
|
|
39
64
|
const { collection, params: { appends = [], ...params } = {} } = node.config;
|
|
40
65
|
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import { Instruction } from '.';
|
|
10
11
|
import type Processor from '../Processor';
|
|
11
12
|
import type { FlowNodeModel } from '../types';
|
|
12
13
|
export declare class DestroyInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
15
|
+
validateConfig(config: Record<string, any>): Record<string, string>;
|
|
13
16
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
14
17
|
result: any;
|
|
15
18
|
status: 1;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var DestroyInstruction_exports = {};
|
|
28
38
|
__export(DestroyInstruction_exports, {
|
|
@@ -30,10 +40,25 @@ __export(DestroyInstruction_exports, {
|
|
|
30
40
|
default: () => DestroyInstruction_default
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(DestroyInstruction_exports);
|
|
43
|
+
var import_joi = __toESM(require("joi"));
|
|
33
44
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
34
45
|
var import__ = require(".");
|
|
35
46
|
var import_constants = require("../constants");
|
|
47
|
+
var import_utils = require("../utils");
|
|
36
48
|
class DestroyInstruction extends import__.Instruction {
|
|
49
|
+
configSchema = import_joi.default.object({
|
|
50
|
+
collection: import_joi.default.string().required().messages({ "any.required": "Collection is not configured" }),
|
|
51
|
+
params: import_joi.default.object({
|
|
52
|
+
filter: import_joi.default.object()
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
validateConfig(config) {
|
|
56
|
+
const errors = super.validateConfig(config);
|
|
57
|
+
if (errors) {
|
|
58
|
+
return errors;
|
|
59
|
+
}
|
|
60
|
+
return (0, import_utils.validateCollectionField)(config.collection, this.workflow.app.dataSourceManager);
|
|
61
|
+
}
|
|
37
62
|
async run(node, input, processor) {
|
|
38
63
|
const { collection, params = {} } = node.config;
|
|
39
64
|
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import Instruction from '.';
|
|
10
11
|
import Processor from '../Processor';
|
|
11
12
|
import { FlowNodeModel } from '../types';
|
|
12
13
|
export default class extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
13
15
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<any>;
|
|
14
16
|
}
|
|
@@ -39,9 +39,13 @@ __export(EndInstruction_exports, {
|
|
|
39
39
|
default: () => EndInstruction_default
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(EndInstruction_exports);
|
|
42
|
+
var import_joi = __toESM(require("joi"));
|
|
42
43
|
var import__ = __toESM(require("."));
|
|
43
44
|
var import_constants = require("../constants");
|
|
44
45
|
class EndInstruction_default extends import__.default {
|
|
46
|
+
configSchema = import_joi.default.object({
|
|
47
|
+
endStatus: import_joi.default.number().valid(import_constants.JOB_STATUS.RESOLVED, import_constants.JOB_STATUS.FAILED)
|
|
48
|
+
});
|
|
45
49
|
async run(node, prevJob, processor) {
|
|
46
50
|
const { endStatus = import_constants.JOB_STATUS.RESOLVED } = node.config;
|
|
47
51
|
processor.saveJob({
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import { Instruction } from '.';
|
|
10
11
|
import type Processor from '../Processor';
|
|
11
12
|
import type { FlowNodeModel, JobModel } from '../types';
|
|
12
13
|
export declare class MultiConditionsInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
13
15
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<JobModel>;
|
|
14
16
|
resume(node: FlowNodeModel, branchJob: JobModel, processor: Processor): Promise<any>;
|
|
15
17
|
private evaluateCondition;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var MultiConditionsInstruction_exports = {};
|
|
28
38
|
__export(MultiConditionsInstruction_exports, {
|
|
@@ -30,11 +40,24 @@ __export(MultiConditionsInstruction_exports, {
|
|
|
30
40
|
default: () => MultiConditionsInstruction_default
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(MultiConditionsInstruction_exports);
|
|
43
|
+
var import_joi = __toESM(require("joi"));
|
|
33
44
|
var import_evaluators = require("@nocobase/evaluators");
|
|
34
45
|
var import__ = require(".");
|
|
35
46
|
var import_constants = require("../constants");
|
|
36
47
|
var import_logicCalculate = require("../logicCalculate");
|
|
37
48
|
class MultiConditionsInstruction extends import__.Instruction {
|
|
49
|
+
configSchema = import_joi.default.object({
|
|
50
|
+
conditions: import_joi.default.array().items(
|
|
51
|
+
import_joi.default.object({
|
|
52
|
+
uid: import_joi.default.string(),
|
|
53
|
+
title: import_joi.default.string(),
|
|
54
|
+
engine: import_joi.default.string(),
|
|
55
|
+
calculation: import_joi.default.any(),
|
|
56
|
+
expression: import_joi.default.string()
|
|
57
|
+
})
|
|
58
|
+
),
|
|
59
|
+
continueOnNoMatch: import_joi.default.boolean()
|
|
60
|
+
});
|
|
38
61
|
async run(node, prevJob, processor) {
|
|
39
62
|
const { conditions = [], continueOnNoMatch = false } = node.config || {};
|
|
40
63
|
const meta = { conditions: [] };
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import { Instruction } from '.';
|
|
10
11
|
import Processor from '../Processor';
|
|
11
12
|
import { FlowNodeModel } from '../types';
|
|
12
13
|
export default class ExecutionResultInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
13
15
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
|
|
14
16
|
result: any;
|
|
15
17
|
status: -1;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,15 +25,27 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var OutputInstruction_exports = {};
|
|
28
38
|
__export(OutputInstruction_exports, {
|
|
29
39
|
default: () => ExecutionResultInstruction
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(OutputInstruction_exports);
|
|
42
|
+
var import_joi = __toESM(require("joi"));
|
|
32
43
|
var import__ = require(".");
|
|
33
44
|
var import_constants = require("../constants");
|
|
34
45
|
class ExecutionResultInstruction extends import__.Instruction {
|
|
46
|
+
configSchema = import_joi.default.object({
|
|
47
|
+
value: import_joi.default.any()
|
|
48
|
+
});
|
|
35
49
|
async run(node, prevJob, processor) {
|
|
36
50
|
const { value } = node.config;
|
|
37
51
|
const output = processor.getParsedValue(value, node.id);
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import type Processor from '../Processor';
|
|
10
11
|
import type { FlowNodeModel } from '../types';
|
|
11
12
|
import { Instruction } from '.';
|
|
12
13
|
export declare class QueryInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
15
|
+
validateConfig(config: Record<string, any>): Record<string, string>;
|
|
13
16
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
14
17
|
result: any;
|
|
15
18
|
status: -1;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var QueryInstruction_exports = {};
|
|
28
38
|
__export(QueryInstruction_exports, {
|
|
@@ -30,22 +40,37 @@ __export(QueryInstruction_exports, {
|
|
|
30
40
|
default: () => QueryInstruction_default
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(QueryInstruction_exports);
|
|
43
|
+
var import_joi = __toESM(require("joi"));
|
|
33
44
|
var import_actions = require("@nocobase/actions");
|
|
34
45
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
35
46
|
var import_constants = require("../constants");
|
|
36
47
|
var import_utils = require("../utils");
|
|
37
48
|
var import__ = require(".");
|
|
38
49
|
class QueryInstruction extends import__.Instruction {
|
|
50
|
+
configSchema = import_joi.default.object({
|
|
51
|
+
collection: import_joi.default.string().required().messages({ "any.required": "Collection is not configured" }),
|
|
52
|
+
multiple: import_joi.default.boolean(),
|
|
53
|
+
params: import_joi.default.object({
|
|
54
|
+
filter: import_joi.default.object(),
|
|
55
|
+
appends: import_joi.default.array().items(import_joi.default.string()),
|
|
56
|
+
page: import_joi.default.alternatives(import_joi.default.number(), import_joi.default.string()),
|
|
57
|
+
pageSize: import_joi.default.alternatives(import_joi.default.number(), import_joi.default.string()),
|
|
58
|
+
sort: import_joi.default.array().items(import_joi.default.object({ field: import_joi.default.string(), direction: import_joi.default.string().allow("asc", "desc") }))
|
|
59
|
+
}),
|
|
60
|
+
failOnEmpty: import_joi.default.boolean()
|
|
61
|
+
});
|
|
62
|
+
validateConfig(config) {
|
|
63
|
+
const errors = super.validateConfig(config);
|
|
64
|
+
if (errors) {
|
|
65
|
+
return errors;
|
|
66
|
+
}
|
|
67
|
+
return (0, import_utils.validateCollectionField)(config.collection, this.workflow.app.dataSourceManager);
|
|
68
|
+
}
|
|
39
69
|
async run(node, input, processor) {
|
|
40
70
|
const { collection, multiple, params = {}, failOnEmpty = false } = node.config;
|
|
41
71
|
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
42
72
|
const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
43
|
-
const {
|
|
44
|
-
page = import_actions.DEFAULT_PAGE,
|
|
45
|
-
pageSize = import_actions.DEFAULT_PER_PAGE,
|
|
46
|
-
sort = [],
|
|
47
|
-
...options
|
|
48
|
-
} = processor.getParsedValue(params, node.id);
|
|
73
|
+
const { page, pageSize, sort = [], ...options } = processor.getParsedValue(params, node.id);
|
|
49
74
|
const appends = options.appends ? Array.from(
|
|
50
75
|
options.appends.reduce((set, field) => {
|
|
51
76
|
set.add(field.split(".")[0]);
|
|
@@ -55,7 +80,7 @@ class QueryInstruction extends import__.Instruction {
|
|
|
55
80
|
) : options.appends;
|
|
56
81
|
const result = await (multiple ? repository.find : repository.findOne).call(repository, {
|
|
57
82
|
...options,
|
|
58
|
-
...import_actions.utils.pageArgsToLimitArgs(page, pageSize),
|
|
83
|
+
...import_actions.utils.pageArgsToLimitArgs(page ?? import_actions.DEFAULT_PAGE, pageSize ?? import_actions.DEFAULT_PER_PAGE),
|
|
59
84
|
sort: sort.filter((item) => item.field).map((item) => {
|
|
60
85
|
var _a;
|
|
61
86
|
return `${((_a = item.direction) == null ? void 0 : _a.toLowerCase()) === "desc" ? "-" : ""}${item.field}`;
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import type Processor from '../Processor';
|
|
10
11
|
import type { FlowNodeModel } from '../types';
|
|
11
12
|
import { Instruction } from '.';
|
|
12
13
|
export declare class UpdateInstruction extends Instruction {
|
|
14
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
15
|
+
validateConfig(config: Record<string, any>): Record<string, string>;
|
|
13
16
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
14
17
|
result: any;
|
|
15
18
|
status: 1;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var UpdateInstruction_exports = {};
|
|
28
38
|
__export(UpdateInstruction_exports, {
|
|
@@ -30,10 +40,27 @@ __export(UpdateInstruction_exports, {
|
|
|
30
40
|
default: () => UpdateInstruction_default
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(UpdateInstruction_exports);
|
|
43
|
+
var import_joi = __toESM(require("joi"));
|
|
33
44
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
34
45
|
var import_constants = require("../constants");
|
|
46
|
+
var import_utils = require("../utils");
|
|
35
47
|
var import__ = require(".");
|
|
36
48
|
class UpdateInstruction extends import__.Instruction {
|
|
49
|
+
configSchema = import_joi.default.object({
|
|
50
|
+
collection: import_joi.default.string().required().messages({ "any.required": "Collection is not configured" }),
|
|
51
|
+
params: import_joi.default.object({
|
|
52
|
+
individualHooks: import_joi.default.boolean(),
|
|
53
|
+
filter: import_joi.default.object(),
|
|
54
|
+
values: import_joi.default.object()
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
validateConfig(config) {
|
|
58
|
+
const errors = super.validateConfig(config);
|
|
59
|
+
if (errors) {
|
|
60
|
+
return errors;
|
|
61
|
+
}
|
|
62
|
+
return (0, import_utils.validateCollectionField)(config.collection, this.workflow.app.dataSourceManager);
|
|
63
|
+
}
|
|
37
64
|
async run(node, input, processor) {
|
|
38
65
|
const { collection, params = {} } = node.config;
|
|
39
66
|
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
@@ -6,16 +6,25 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import { Transactionable } from '@nocobase/database';
|
|
10
11
|
import type Plugin from '../Plugin';
|
|
11
12
|
import type Processor from '../Processor';
|
|
12
|
-
import type { FlowNodeModel } from '../types';
|
|
13
|
+
import type { FlowNodeModel, WorkflowModel } from '../types';
|
|
13
14
|
export interface IJob {
|
|
14
15
|
status: number;
|
|
15
16
|
result?: unknown;
|
|
16
17
|
[key: string]: unknown;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The result of an instruction execution.
|
|
21
|
+
*
|
|
22
|
+
* Different type of result will cause according behavior in the workflow engine:
|
|
23
|
+
* 1. IJob | Promise<IJob>: processor will continue default processing by checking the status.
|
|
24
|
+
* 2. `null` | Promise<null>: processor will do exit process.
|
|
25
|
+
* 3. `void` | Promise<void>: processor will do nothing, and terminate the current execution without any action.
|
|
26
|
+
*/
|
|
27
|
+
export type InstructionResult = IJob | Promise<IJob> | Promise<void> | Promise<null> | null | void;
|
|
19
28
|
export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult;
|
|
20
29
|
export type InstructionInterface = {
|
|
21
30
|
run: Runner;
|
|
@@ -24,11 +33,15 @@ export type InstructionInterface = {
|
|
|
24
33
|
duplicateConfig?: (node: FlowNodeModel, options: Transactionable & {
|
|
25
34
|
origin?: FlowNodeModel;
|
|
26
35
|
}) => object | Promise<object>;
|
|
36
|
+
validateConfig?: (config: Record<string, any>) => Record<string, string> | null;
|
|
37
|
+
isAvailable?: (workflow: WorkflowModel, node: FlowNodeModel) => boolean;
|
|
27
38
|
test?: (config: Record<string, any>) => IJob | Promise<IJob>;
|
|
28
39
|
};
|
|
29
40
|
export declare abstract class Instruction implements InstructionInterface {
|
|
30
41
|
workflow: Plugin;
|
|
42
|
+
configSchema?: Joi.ObjectSchema;
|
|
31
43
|
constructor(workflow: Plugin);
|
|
44
|
+
validateConfig(config: Record<string, any>): Record<string, string> | null;
|
|
32
45
|
abstract run(node: FlowNodeModel, input: any, processor: Processor): InstructionResult;
|
|
33
46
|
}
|
|
34
47
|
export default Instruction;
|
|
@@ -34,6 +34,24 @@ class Instruction {
|
|
|
34
34
|
constructor(workflow) {
|
|
35
35
|
this.workflow = workflow;
|
|
36
36
|
}
|
|
37
|
+
configSchema;
|
|
38
|
+
validateConfig(config) {
|
|
39
|
+
if (!this.configSchema) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const { error } = this.configSchema.validate(config, { abortEarly: false, allowUnknown: true });
|
|
43
|
+
if (!error) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const errors = {};
|
|
47
|
+
for (const detail of error.details) {
|
|
48
|
+
const key = detail.path.join(".");
|
|
49
|
+
if (!errors[key]) {
|
|
50
|
+
errors[key] = detail.message;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return errors;
|
|
54
|
+
}
|
|
37
55
|
}
|
|
38
56
|
var instructions_default = Instruction;
|
|
39
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
appVersion: string;
|
|
12
|
+
up(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var fill_workflow_created_updated_by_exports = {};
|
|
28
|
+
__export(fill_workflow_created_updated_by_exports, {
|
|
29
|
+
default: () => fill_workflow_created_updated_by_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(fill_workflow_created_updated_by_exports);
|
|
32
|
+
var import_sequelize = require("sequelize");
|
|
33
|
+
var import_server = require("@nocobase/server");
|
|
34
|
+
class fill_workflow_created_updated_by_default extends import_server.Migration {
|
|
35
|
+
appVersion = "<2.1.0-beta.23";
|
|
36
|
+
async up() {
|
|
37
|
+
const { db } = this.context;
|
|
38
|
+
const WorkflowModel = db.getModel("workflows");
|
|
39
|
+
await db.sequelize.transaction(async (transaction) => {
|
|
40
|
+
await WorkflowModel.update(
|
|
41
|
+
{
|
|
42
|
+
createdById: 1,
|
|
43
|
+
updatedById: 1
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
where: {
|
|
47
|
+
createdById: {
|
|
48
|
+
[import_sequelize.Op.is]: null
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
silent: true,
|
|
52
|
+
transaction
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import Joi from 'joi';
|
|
9
10
|
import { Model } from '@nocobase/database';
|
|
10
11
|
import Trigger from '.';
|
|
11
12
|
import type { WorkflowModel } from '../types';
|
|
@@ -18,6 +19,8 @@ export interface CollectionChangeTriggerConfig {
|
|
|
18
19
|
}
|
|
19
20
|
export default class CollectionTrigger extends Trigger {
|
|
20
21
|
readonly workflow: PluginWorkflowServer;
|
|
22
|
+
configSchema: Joi.ObjectSchema<any>;
|
|
23
|
+
validateConfig(config: Record<string, any>): Record<string, string>;
|
|
21
24
|
events: Map<any, any>;
|
|
22
25
|
constructor(workflow: PluginWorkflowServer);
|
|
23
26
|
private static handler;
|