@nocobase/plugin-workflow 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +3 -3
- package/dist/client/AddButton.d.ts +0 -16
- package/dist/client/Branch.d.ts +0 -17
- package/dist/client/CanvasContent.d.ts +0 -12
- package/dist/client/ExecutionCanvas.d.ts +0 -10
- package/dist/client/ExecutionContextProvider.d.ts +0 -15
- package/dist/client/ExecutionLink.d.ts +0 -10
- package/dist/client/ExecutionPage.d.ts +0 -10
- package/dist/client/ExecutionResourceProvider.d.ts +0 -14
- package/dist/client/FlowContext.d.ts +0 -11
- package/dist/client/WorkflowCanvas.d.ts +0 -10
- package/dist/client/WorkflowLink.d.ts +0 -10
- package/dist/client/WorkflowPage.d.ts +0 -10
- package/dist/client/WorkflowPane.d.ts +0 -10
- package/dist/client/components/AssignedFieldsFormSchemaConfig.d.ts +0 -10
- package/dist/client/components/CheckboxGroupWithTooltip.d.ts +0 -15
- package/dist/client/components/CollectionBlockInitializer.d.ts +0 -10
- package/dist/client/components/CollectionFieldset.d.ts +0 -14
- package/dist/client/components/DetailsBlockProvider.d.ts +0 -14
- package/dist/client/components/DrawerDescription.d.ts +0 -10
- package/dist/client/components/DrawerForm.d.ts +0 -13
- package/dist/client/components/ExecutionStatus.d.ts +0 -13
- package/dist/client/components/FieldsSelect.d.ts +0 -10
- package/dist/client/components/FilterDynamicComponent.d.ts +0 -14
- package/dist/client/components/OpenDrawer.d.ts +0 -14
- package/dist/client/components/RadioWithTooltip.d.ts +0 -15
- package/dist/client/components/SimpleDesigner.d.ts +0 -10
- package/dist/client/components/StatusButton.d.ts +0 -10
- package/dist/client/components/TriggerOptionRender.d.ts +0 -12
- package/dist/client/components/ValueBlock.d.ts +0 -14
- package/dist/client/components/index.d.ts +0 -16
- package/dist/client/components/renderEngineReference.d.ts +0 -10
- package/dist/client/constants.d.ts +0 -45
- package/dist/client/hooks/index.d.ts +0 -11
- package/dist/client/hooks/useGetAriaLabelOfAddButton.d.ts +0 -14
- package/dist/client/hooks/useRefreshActionProps.d.ts +0 -11
- package/dist/client/hooks/useTriggerWorkflowActionProps.d.ts +0 -20
- package/dist/client/hooks/useWorkflowExecuted.d.ts +0 -10
- package/dist/client/index.d.ts +0 -43
- package/dist/client/index.js +0 -569
- package/dist/client/locale/index.d.ts +0 -11
- package/dist/client/nodes/calculation.d.ts +0 -80
- package/dist/client/nodes/condition.d.ts +0 -108
- package/dist/client/nodes/create.d.ts +0 -110
- package/dist/client/nodes/destroy.d.ts +0 -54
- package/dist/client/nodes/end.d.ts +0 -30
- package/dist/client/nodes/index.d.ts +0 -76
- package/dist/client/nodes/query.d.ts +0 -236
- package/dist/client/nodes/update.d.ts +0 -114
- package/dist/client/schemas/collection.d.ts +0 -170
- package/dist/client/schemas/executions.d.ts +0 -282
- package/dist/client/schemas/workflows.d.ts +0 -10
- package/dist/client/settings/customizeSubmitToWorkflowActionSettings.d.ts +0 -10
- package/dist/client/style.d.ts +0 -30
- package/dist/client/triggers/collection.d.ts +0 -124
- package/dist/client/triggers/index.d.ts +0 -36
- package/dist/client/triggers/schedule/EndsByField.d.ts +0 -13
- package/dist/client/triggers/schedule/OnField.d.ts +0 -13
- package/dist/client/triggers/schedule/RepeatField.d.ts +0 -13
- package/dist/client/triggers/schedule/ScheduleConfig.d.ts +0 -10
- package/dist/client/triggers/schedule/constants.d.ts +0 -12
- package/dist/client/triggers/schedule/index.d.ts +0 -33
- package/dist/client/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -42
- package/dist/client/utils.d.ts +0 -12
- package/dist/client/variable.d.ts +0 -93
- package/dist/externalVersion.js +0 -34
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/en-US.json +0 -98
- package/dist/locale/es-ES.json +0 -98
- package/dist/locale/fr-FR.json +0 -98
- package/dist/locale/ja-JP.json +0 -82
- package/dist/locale/ko_KR.json +0 -168
- package/dist/locale/pt-BR.json +0 -98
- package/dist/locale/ru-RU.json +0 -82
- package/dist/locale/tr-TR.json +0 -82
- package/dist/locale/zh-CN.json +0 -205
- package/dist/node_modules/cron-parser/.eslintrc.json +0 -15
- package/dist/node_modules/cron-parser/.travis.yml +0 -7
- package/dist/node_modules/cron-parser/LICENSE +0 -21
- package/dist/node_modules/cron-parser/component.json +0 -11
- package/dist/node_modules/cron-parser/index.d.ts +0 -1
- package/dist/node_modules/cron-parser/lib/date.js +0 -252
- package/dist/node_modules/cron-parser/lib/expression.js +0 -983
- package/dist/node_modules/cron-parser/lib/field_compactor.js +0 -70
- package/dist/node_modules/cron-parser/lib/field_stringify.js +0 -38
- package/dist/node_modules/cron-parser/lib/parser.js +0 -1
- package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +0 -8489
- package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +0 -8487
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +0 -8490
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +0 -1
- package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +0 -7522
- package/dist/node_modules/cron-parser/node_modules/luxon/package.json +0 -96
- package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +0 -2169
- package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +0 -880
- package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +0 -61
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +0 -157
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +0 -80
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +0 -76
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +0 -233
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +0 -191
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +0 -386
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +0 -14
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +0 -482
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +0 -335
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +0 -424
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +0 -292
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +0 -36
- package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +0 -193
- package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +0 -602
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +0 -26
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +0 -13
- package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +0 -137
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +0 -88
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +0 -191
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +0 -94
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +0 -53
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +0 -63
- package/dist/node_modules/cron-parser/package.json +0 -1
- package/dist/node_modules/cron-parser/test/31_of_month.js +0 -17
- package/dist/node_modules/cron-parser/test/bug.js +0 -29
- package/dist/node_modules/cron-parser/test/crondate.js +0 -16
- package/dist/node_modules/cron-parser/test/crontab.example +0 -7
- package/dist/node_modules/cron-parser/test/empty_around_comma.js +0 -22
- package/dist/node_modules/cron-parser/test/expression.js +0 -1489
- package/dist/node_modules/cron-parser/test/field_compactor.js +0 -250
- package/dist/node_modules/cron-parser/test/field_stringify.js +0 -84
- package/dist/node_modules/cron-parser/test/fields.js +0 -32
- package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +0 -22
- package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +0 -133
- package/dist/node_modules/cron-parser/test/index.test-d.ts +0 -138
- package/dist/node_modules/cron-parser/test/leap_year.js +0 -17
- package/dist/node_modules/cron-parser/test/parser.js +0 -46
- package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +0 -145
- package/dist/node_modules/cron-parser/test/parser_day_of_month.js +0 -169
- package/dist/node_modules/cron-parser/test/prev_date.js +0 -32
- package/dist/node_modules/cron-parser/test/stringify.js +0 -402
- package/dist/node_modules/cron-parser/test/timezone.js +0 -422
- package/dist/node_modules/cron-parser/types/common.d.ts +0 -131
- package/dist/node_modules/cron-parser/types/index.d.ts +0 -45
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +0 -28
- 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.js +0 -1334
- package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/cjs/package.json +0 -3
- package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/mjs/index.js +0 -1330
- package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/mjs/package.json +0 -3
- package/dist/node_modules/lru-cache/package.json +0 -1
- package/dist/server/Plugin.d.ts +0 -84
- package/dist/server/Plugin.js +0 -503
- package/dist/server/Processor.d.ts +0 -115
- package/dist/server/Processor.js +0 -363
- package/dist/server/actions/executions.d.ts +0 -11
- package/dist/server/actions/executions.js +0 -96
- package/dist/server/actions/index.d.ts +0 -11
- package/dist/server/actions/index.js +0 -66
- package/dist/server/actions/nodes.d.ts +0 -12
- package/dist/server/actions/nodes.js +0 -217
- package/dist/server/actions/workflows.d.ts +0 -14
- package/dist/server/actions/workflows.js +0 -184
- package/dist/server/collections/executions.d.ts +0 -11
- package/dist/server/collections/executions.js +0 -66
- package/dist/server/collections/flow_nodes.d.ts +0 -11
- package/dist/server/collections/flow_nodes.js +0 -87
- package/dist/server/collections/jobs.d.ts +0 -11
- package/dist/server/collections/jobs.js +0 -66
- package/dist/server/collections/workflows.d.ts +0 -10
- package/dist/server/collections/workflows.js +0 -126
- package/dist/server/constants.d.ts +0 -29
- package/dist/server/constants.js +0 -58
- package/dist/server/functions/index.d.ts +0 -17
- package/dist/server/functions/index.js +0 -40
- package/dist/server/index.d.ts +0 -15
- package/dist/server/index.js +0 -60
- package/dist/server/instructions/CalculationInstruction.d.ts +0 -25
- package/dist/server/instructions/CalculationInstruction.js +0 -59
- package/dist/server/instructions/ConditionInstruction.d.ts +0 -36
- package/dist/server/instructions/ConditionInstruction.js +0 -167
- package/dist/server/instructions/CreateInstruction.d.ts +0 -18
- package/dist/server/instructions/CreateInstruction.js +0 -75
- package/dist/server/instructions/DestroyInstruction.d.ts +0 -18
- package/dist/server/instructions/DestroyInstruction.js +0 -59
- package/dist/server/instructions/EndInstruction.d.ts +0 -14
- package/dist/server/instructions/EndInstruction.js +0 -55
- package/dist/server/instructions/QueryInstruction.d.ts +0 -21
- package/dist/server/instructions/QueryInstruction.js +0 -82
- package/dist/server/instructions/UpdateInstruction.d.ts +0 -18
- package/dist/server/instructions/UpdateInstruction.js +0 -59
- package/dist/server/instructions/index.d.ts +0 -31
- package/dist/server/instructions/index.js +0 -42
- package/dist/server/migrations/20221129153547-calculation-variables.d.ts +0 -14
- package/dist/server/migrations/20221129153547-calculation-variables.js +0 -92
- package/dist/server/migrations/20230221032941-change-request-body-type.d.ts +0 -14
- package/dist/server/migrations/20230221032941-change-request-body-type.js +0 -102
- package/dist/server/migrations/20230221071831-calculation-expression.d.ts +0 -13
- package/dist/server/migrations/20230221071831-calculation-expression.js +0 -121
- package/dist/server/migrations/20230221121203-condition-calculation.d.ts +0 -13
- package/dist/server/migrations/20230221121203-condition-calculation.js +0 -106
- package/dist/server/migrations/20230221162902-jsonb-to-json.d.ts +0 -13
- package/dist/server/migrations/20230221162902-jsonb-to-json.js +0 -63
- package/dist/server/migrations/20230411034722-manual-multi-form.d.ts +0 -13
- package/dist/server/migrations/20230411034722-manual-multi-form.js +0 -283
- package/dist/server/migrations/20230612021134-manual-collection-block.d.ts +0 -13
- package/dist/server/migrations/20230612021134-manual-collection-block.js +0 -152
- package/dist/server/migrations/20230710115902-manual-action-values.d.ts +0 -13
- package/dist/server/migrations/20230710115902-manual-action-values.js +0 -101
- package/dist/server/migrations/20230809113132-workflow-options.d.ts +0 -13
- package/dist/server/migrations/20230809113132-workflow-options.js +0 -64
- package/dist/server/migrations/20231024172342-add-node-key.d.ts +0 -13
- package/dist/server/migrations/20231024172342-add-node-key.js +0 -90
- package/dist/server/migrations/20231122143143-split-to-plugins.d.ts +0 -13
- package/dist/server/migrations/20231122143143-split-to-plugins.js +0 -67
- package/dist/server/migrations/20240115220721-add-node-key-to-job.d.ts +0 -14
- package/dist/server/migrations/20240115220721-add-node-key-to-job.js +0 -63
- package/dist/server/migrations/20240613222612-fix-assign-field-config.d.ts +0 -13
- package/dist/server/migrations/20240613222612-fix-assign-field-config.js +0 -62
- package/dist/server/triggers/CollectionTrigger.d.ts +0 -22
- package/dist/server/triggers/CollectionTrigger.js +0 -184
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +0 -39
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +0 -356
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.d.ts +0 -21
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.js +0 -152
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +0 -18
- package/dist/server/triggers/ScheduleTrigger/index.js +0 -84
- package/dist/server/triggers/ScheduleTrigger/utils.d.ts +0 -13
- package/dist/server/triggers/ScheduleTrigger/utils.js +0 -44
- package/dist/server/triggers/index.d.ts +0 -21
- package/dist/server/triggers/index.js +0 -46
- package/dist/server/types/Execution.d.ts +0 -25
- package/dist/server/types/Execution.js +0 -34
- package/dist/server/types/FlowNode.d.ts +0 -24
- package/dist/server/types/FlowNode.js +0 -34
- package/dist/server/types/Job.d.ts +0 -22
- package/dist/server/types/Job.js +0 -34
- package/dist/server/types/Workflow.d.ts +0 -35
- package/dist/server/types/Workflow.js +0 -34
- package/dist/server/types/index.d.ts +0 -12
- package/dist/server/types/index.js +0 -24
- package/dist/server/utils.d.ts +0 -9
- package/dist/server/utils.js +0 -51
- package/dist/swagger/index.d.ts +0 -762
- package/dist/swagger/index.js +0 -807
|
@@ -1,90 +0,0 @@
|
|
|
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 add_node_key_exports = {};
|
|
28
|
-
__export(add_node_key_exports, {
|
|
29
|
-
default: () => add_node_key_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(add_node_key_exports);
|
|
32
|
-
var import_server = require("@nocobase/server");
|
|
33
|
-
var import_utils = require("@nocobase/utils");
|
|
34
|
-
var import_sequelize = require("sequelize");
|
|
35
|
-
function migrateNodeConfig(config = {}, nodesMap) {
|
|
36
|
-
Object.keys(config).forEach((key) => {
|
|
37
|
-
const valueType = typeof config[key];
|
|
38
|
-
if (valueType === "string") {
|
|
39
|
-
config[key] = config[key].replace(/{{\s*\$jobsMapByNodeId\.(\d+)(\.[^}]+)?\s*}}/g, (matched, id, path) => {
|
|
40
|
-
return `{{$jobsMapByNodeKey.${nodesMap[id].key}${path || ""}}}`;
|
|
41
|
-
}).replace(/{{\s*\$scopes\.(\d+)(\.[^}]+)?\s*}}/g, (matched, id, path) => {
|
|
42
|
-
return `{{$scopes.${nodesMap[id].key}${path || ""}}}`;
|
|
43
|
-
});
|
|
44
|
-
} else if (valueType === "object" && config[key]) {
|
|
45
|
-
migrateNodeConfig(config[key], nodesMap);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return config;
|
|
49
|
-
}
|
|
50
|
-
class add_node_key_default extends import_server.Migration {
|
|
51
|
-
appVersion = "<0.14.0-alpha.8";
|
|
52
|
-
async up() {
|
|
53
|
-
const match = await this.app.version.satisfies("<0.14.0-alpha.8");
|
|
54
|
-
if (!match) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const { db } = this.context;
|
|
58
|
-
const NodeCollection = db.getCollection("flow_nodes");
|
|
59
|
-
const NodeRepo = NodeCollection.repository;
|
|
60
|
-
const tableName = NodeCollection.getTableNameWithSchema();
|
|
61
|
-
await db.sequelize.transaction(async (transaction) => {
|
|
62
|
-
if (!await NodeCollection.getField("key").existsInDb()) {
|
|
63
|
-
await this.queryInterface.addColumn(tableName, "key", import_sequelize.DataTypes.STRING, {
|
|
64
|
-
transaction
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const nodes = await NodeRepo.find({
|
|
68
|
-
transaction
|
|
69
|
-
});
|
|
70
|
-
const nodesMap = nodes.reduce((map, node) => {
|
|
71
|
-
map[node.id] = node;
|
|
72
|
-
if (!node.get("key")) {
|
|
73
|
-
node.set("key", (0, import_utils.uid)());
|
|
74
|
-
}
|
|
75
|
-
return map;
|
|
76
|
-
}, {});
|
|
77
|
-
await nodes.reduce(
|
|
78
|
-
(promise, node) => promise.then(() => {
|
|
79
|
-
node.set("config", migrateNodeConfig(node.config, nodesMap));
|
|
80
|
-
node.changed("config", true);
|
|
81
|
-
return node.save({
|
|
82
|
-
silent: true,
|
|
83
|
-
transaction
|
|
84
|
-
});
|
|
85
|
-
}),
|
|
86
|
-
Promise.resolve()
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
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 split_to_plugins_exports = {};
|
|
28
|
-
__export(split_to_plugins_exports, {
|
|
29
|
-
default: () => split_to_plugins_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(split_to_plugins_exports);
|
|
32
|
-
var import_server = require("@nocobase/server");
|
|
33
|
-
class split_to_plugins_default extends import_server.Migration {
|
|
34
|
-
appVersion = "<0.17.0-alpha.4";
|
|
35
|
-
async up() {
|
|
36
|
-
const match = await this.app.version.satisfies("<0.17.0-alpha.4");
|
|
37
|
-
if (!match) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const { db } = this.context;
|
|
41
|
-
const NodeRepo = db.getRepository("flow_nodes");
|
|
42
|
-
await db.sequelize.transaction(async (transaction) => {
|
|
43
|
-
const nodes = await NodeRepo.find({
|
|
44
|
-
transaction
|
|
45
|
-
});
|
|
46
|
-
await nodes.reduce(
|
|
47
|
-
(promise, node) => promise.then(() => {
|
|
48
|
-
if (node.type === "calculation" && node.config.dynamic) {
|
|
49
|
-
node.set({
|
|
50
|
-
type: "dynamic-calculation",
|
|
51
|
-
config: {
|
|
52
|
-
expression: node.config.dynamic,
|
|
53
|
-
scope: node.config.scope
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
node.changed("config", true);
|
|
57
|
-
}
|
|
58
|
-
return node.save({
|
|
59
|
-
silent: true,
|
|
60
|
-
transaction
|
|
61
|
-
});
|
|
62
|
-
}),
|
|
63
|
-
Promise.resolve()
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
on: string;
|
|
13
|
-
up(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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 add_node_key_to_job_exports = {};
|
|
28
|
-
__export(add_node_key_to_job_exports, {
|
|
29
|
-
default: () => add_node_key_to_job_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(add_node_key_to_job_exports);
|
|
32
|
-
var import_server = require("@nocobase/server");
|
|
33
|
-
class add_node_key_to_job_default extends import_server.Migration {
|
|
34
|
-
appVersion = "<0.19.0-alpha.4";
|
|
35
|
-
on = "afterSync";
|
|
36
|
-
async up() {
|
|
37
|
-
const { db } = this.context;
|
|
38
|
-
const JobRepo = db.getRepository("jobs");
|
|
39
|
-
await db.sequelize.transaction(async (transaction) => {
|
|
40
|
-
const jobs = await JobRepo.find({
|
|
41
|
-
appends: ["node.key"]
|
|
42
|
-
});
|
|
43
|
-
await jobs.reduce(
|
|
44
|
-
(promise, job) => promise.then(() => {
|
|
45
|
-
var _a;
|
|
46
|
-
if (job.nodeKey) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
return job.update(
|
|
50
|
-
{
|
|
51
|
-
nodeKey: (_a = job.node) == null ? void 0 : _a.key
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
silent: true,
|
|
55
|
-
transaction
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}),
|
|
59
|
-
Promise.resolve()
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
on: string;
|
|
12
|
-
up(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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 fix_assign_field_config_exports = {};
|
|
28
|
-
__export(fix_assign_field_config_exports, {
|
|
29
|
-
default: () => fix_assign_field_config_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(fix_assign_field_config_exports);
|
|
32
|
-
var import_database = require("@nocobase/database");
|
|
33
|
-
var import_server = require("@nocobase/server");
|
|
34
|
-
class fix_assign_field_config_default extends import_server.Migration {
|
|
35
|
-
on = "afterSync";
|
|
36
|
-
async up() {
|
|
37
|
-
const { db } = this.context;
|
|
38
|
-
const NodeRepo = db.getRepository("flow_nodes");
|
|
39
|
-
await db.sequelize.transaction(async (transaction) => {
|
|
40
|
-
const nodes = await NodeRepo.find({
|
|
41
|
-
filter: {
|
|
42
|
-
type: {
|
|
43
|
-
[import_database.Op.or]: ["create", "update"]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
for (const node of nodes) {
|
|
48
|
-
if (node.usingAssignFormSchema || !node.assignFormSchema) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
node.set({
|
|
52
|
-
config: { ...node.config, usingAssignFormSchema: true }
|
|
53
|
-
});
|
|
54
|
-
node.changed("config");
|
|
55
|
-
await node.save({
|
|
56
|
-
silent: true,
|
|
57
|
-
transaction
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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 { Transactionable } from '@nocobase/database';
|
|
10
|
-
import Trigger from '.';
|
|
11
|
-
import type { WorkflowModel } from '../types';
|
|
12
|
-
export interface CollectionChangeTriggerConfig {
|
|
13
|
-
collection: string;
|
|
14
|
-
mode: number;
|
|
15
|
-
condition: any;
|
|
16
|
-
}
|
|
17
|
-
export default class CollectionTrigger extends Trigger {
|
|
18
|
-
events: Map<any, any>;
|
|
19
|
-
on(workflow: WorkflowModel): void;
|
|
20
|
-
off(workflow: WorkflowModel): void;
|
|
21
|
-
validateEvent(workflow: WorkflowModel, context: any, options: Transactionable): Promise<boolean>;
|
|
22
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
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 __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
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
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var CollectionTrigger_exports = {};
|
|
38
|
-
__export(CollectionTrigger_exports, {
|
|
39
|
-
default: () => CollectionTrigger
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(CollectionTrigger_exports);
|
|
42
|
-
var import__ = __toESM(require("."));
|
|
43
|
-
var import_utils = require("../utils");
|
|
44
|
-
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
45
|
-
const MODE_BITMAP = {
|
|
46
|
-
CREATE: 1,
|
|
47
|
-
UPDATE: 2,
|
|
48
|
-
DESTROY: 4
|
|
49
|
-
};
|
|
50
|
-
const MODE_BITMAP_EVENTS = /* @__PURE__ */ new Map();
|
|
51
|
-
MODE_BITMAP_EVENTS.set(MODE_BITMAP.CREATE, "afterCreateWithAssociations");
|
|
52
|
-
MODE_BITMAP_EVENTS.set(MODE_BITMAP.UPDATE, "afterUpdateWithAssociations");
|
|
53
|
-
MODE_BITMAP_EVENTS.set(MODE_BITMAP.DESTROY, "afterDestroy");
|
|
54
|
-
function getHookId(workflow, type) {
|
|
55
|
-
return `${type}#${workflow.id}`;
|
|
56
|
-
}
|
|
57
|
-
function getFieldRawName(collection, name) {
|
|
58
|
-
const field = collection.getField(name);
|
|
59
|
-
if (field && field.options.type === "belongsTo") {
|
|
60
|
-
return field.options.foreignKey;
|
|
61
|
-
}
|
|
62
|
-
return name;
|
|
63
|
-
}
|
|
64
|
-
async function handler(workflow, data, options) {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
const { condition, changed, mode, appends } = workflow.config;
|
|
67
|
-
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(workflow.config.collection);
|
|
68
|
-
const collection = (_a = this.workflow.app.dataSourceManager) == null ? void 0 : _a.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
69
|
-
const { transaction, context } = options;
|
|
70
|
-
const { repository, filterTargetKey } = collection;
|
|
71
|
-
if (changed && changed.length && changed.filter(
|
|
72
|
-
(name) => !["linkTo", "hasOne", "hasMany", "belongsToMany"].includes(collection.getField(name).options.type)
|
|
73
|
-
).every((name) => !data.changedWithAssociations(getFieldRawName(collection, name)))) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (condition && ((_b = condition.$and) == null ? void 0 : _b.length)) {
|
|
77
|
-
const count = await repository.count({
|
|
78
|
-
filter: {
|
|
79
|
-
$and: [condition, { [filterTargetKey]: data[filterTargetKey] }]
|
|
80
|
-
},
|
|
81
|
-
context,
|
|
82
|
-
transaction
|
|
83
|
-
});
|
|
84
|
-
if (!count) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
let result = data;
|
|
89
|
-
if ((appends == null ? void 0 : appends.length) && !(mode & MODE_BITMAP.DESTROY)) {
|
|
90
|
-
const includeFields = appends.reduce((set, field) => {
|
|
91
|
-
set.add(field.split(".")[0]);
|
|
92
|
-
set.add(field);
|
|
93
|
-
return set;
|
|
94
|
-
}, /* @__PURE__ */ new Set());
|
|
95
|
-
result = await repository.findOne({
|
|
96
|
-
filterByTk: data[filterTargetKey],
|
|
97
|
-
appends: Array.from(includeFields),
|
|
98
|
-
transaction
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
const json = (0, import_utils.toJSON)(result);
|
|
102
|
-
if (workflow.sync) {
|
|
103
|
-
await this.workflow.trigger(
|
|
104
|
-
workflow,
|
|
105
|
-
{ data: json, stack: context == null ? void 0 : context.stack },
|
|
106
|
-
{
|
|
107
|
-
transaction: this.workflow.useDataSourceTransaction(dataSourceName, transaction)
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
} else {
|
|
111
|
-
this.workflow.trigger(workflow, { data: json, stack: context == null ? void 0 : context.stack });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
class CollectionTrigger extends import__.default {
|
|
115
|
-
events = /* @__PURE__ */ new Map();
|
|
116
|
-
on(workflow) {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
const { collection, mode } = workflow.config;
|
|
119
|
-
if (!collection) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
123
|
-
const { db } = ((_b = (_a = this.workflow.app.dataSourceManager) == null ? void 0 : _a.dataSources.get(dataSourceName)) == null ? void 0 : _b.collectionManager) ?? {};
|
|
124
|
-
if (!db || !db.getCollection(collectionName)) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
for (const [key, type] of MODE_BITMAP_EVENTS.entries()) {
|
|
128
|
-
const event = `${collectionName}.${type}`;
|
|
129
|
-
const name = getHookId(workflow, `${collection}.${type}`);
|
|
130
|
-
if (mode & key) {
|
|
131
|
-
if (!this.events.has(name)) {
|
|
132
|
-
const listener = handler.bind(this, workflow);
|
|
133
|
-
this.events.set(name, listener);
|
|
134
|
-
db.on(event, listener);
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
const listener = this.events.get(name);
|
|
138
|
-
if (listener) {
|
|
139
|
-
db.off(event, listener);
|
|
140
|
-
this.events.delete(name);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
off(workflow) {
|
|
146
|
-
var _a;
|
|
147
|
-
const { collection, mode } = workflow.config;
|
|
148
|
-
if (!collection) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
152
|
-
const { db } = ((_a = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName)) == null ? void 0 : _a.collectionManager) ?? {};
|
|
153
|
-
if (!db || !db.getCollection(collectionName)) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
for (const [key, type] of MODE_BITMAP_EVENTS.entries()) {
|
|
157
|
-
const name = getHookId(workflow, `${collection}.${type}`);
|
|
158
|
-
if (mode & key) {
|
|
159
|
-
const listener = this.events.get(name);
|
|
160
|
-
if (listener) {
|
|
161
|
-
db.off(`${collectionName}.${type}`, listener);
|
|
162
|
-
this.events.delete(name);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
async validateEvent(workflow, context, options) {
|
|
168
|
-
if (context.stack) {
|
|
169
|
-
const existed = await workflow.countExecutions({
|
|
170
|
-
where: {
|
|
171
|
-
id: context.stack
|
|
172
|
-
},
|
|
173
|
-
transaction: options.transaction
|
|
174
|
-
});
|
|
175
|
-
if (existed) {
|
|
176
|
-
this.workflow.getLogger(workflow.id).warn(
|
|
177
|
-
`workflow ${workflow.id} has already been triggered in stack executions (${context.stack}), and newly triggering will be skipped.`
|
|
178
|
-
);
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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 { Transactionable } from '@nocobase/database';
|
|
10
|
-
import type Plugin from '../../Plugin';
|
|
11
|
-
import type { WorkflowModel } from '../../types';
|
|
12
|
-
export type ScheduleOnField = {
|
|
13
|
-
field: string;
|
|
14
|
-
offset?: number;
|
|
15
|
-
unit?: 1000 | 60000 | 3600000 | 86400000;
|
|
16
|
-
};
|
|
17
|
-
export interface ScheduleTriggerConfig {
|
|
18
|
-
mode: number;
|
|
19
|
-
repeat?: string | number | null;
|
|
20
|
-
limit?: number;
|
|
21
|
-
startsOn?: ScheduleOnField;
|
|
22
|
-
endsOn?: string | ScheduleOnField;
|
|
23
|
-
}
|
|
24
|
-
export default class ScheduleTrigger {
|
|
25
|
-
workflow: Plugin;
|
|
26
|
-
events: Map<any, any>;
|
|
27
|
-
private timer;
|
|
28
|
-
private cache;
|
|
29
|
-
cacheCycle: number;
|
|
30
|
-
constructor(workflow: Plugin);
|
|
31
|
-
reload(): Promise<void>;
|
|
32
|
-
inspect(workflows: WorkflowModel[]): void;
|
|
33
|
-
loadRecordsToSchedule({ config: { collection, limit, startsOn, repeat, endsOn }, allExecuted }: WorkflowModel, currentDate: Date): Promise<import("@nocobase/database").Model<any, any>[]>;
|
|
34
|
-
getRecordNextTime(workflow: WorkflowModel, record: any, nextSecond?: boolean): any;
|
|
35
|
-
schedule(workflow: WorkflowModel, record: any, nextTime: any, toggle?: boolean, options?: {}): Promise<void>;
|
|
36
|
-
trigger(workflow: WorkflowModel, record: any, nextTime: any, { transaction }?: Transactionable): Promise<void>;
|
|
37
|
-
on(workflow: WorkflowModel): void;
|
|
38
|
-
off(workflow: WorkflowModel): void;
|
|
39
|
-
}
|