@nocobase/plugin-workflow 0.20.0-alpha.9 → 0.21.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/ExecutionContextProvider.d.ts +7 -0
- package/dist/client/components/CollectionBlockInitializer.d.ts +1 -1
- package/dist/client/components/DetailsBlockProvider.d.ts +6 -0
- package/dist/client/components/SimpleDesigner.d.ts +2 -0
- package/dist/client/components/ValueBlock.d.ts +1 -0
- package/dist/client/components/index.d.ts +2 -0
- package/dist/client/hooks/index.d.ts +3 -0
- package/dist/client/hooks/useWorkflowExecuted.d.ts +2 -0
- package/dist/client/index.d.ts +12 -12
- package/dist/client/index.js +37 -37
- package/dist/client/nodes/calculation.d.ts +1 -0
- package/dist/client/nodes/create.d.ts +2 -5
- package/dist/client/nodes/destroy.d.ts +1 -4
- package/dist/client/nodes/query.d.ts +1 -4
- package/dist/client/nodes/update.d.ts +2 -5
- package/dist/client/schemas/collection.d.ts +1 -4
- package/dist/client/triggers/collection.d.ts +6 -3
- package/dist/client/triggers/schedule/OnField.d.ts +1 -1
- package/dist/client/utils.d.ts +2 -0
- package/dist/externalVersion.js +11 -10
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.d.ts +3 -1
- package/dist/server/Plugin.js +20 -8
- package/dist/server/collections/executions.js +1 -1
- package/dist/server/instructions/CreateInstruction.js +6 -3
- package/dist/server/instructions/DestroyInstruction.js +5 -3
- package/dist/server/instructions/QueryInstruction.js +5 -3
- package/dist/server/instructions/UpdateInstruction.js +5 -3
- package/dist/server/migrations/20230411034722-manual-multi-form.js +2 -2
- package/dist/server/migrations/20230612021134-manual-collection-block.js +1 -1
- package/dist/server/triggers/CollectionTrigger.js +30 -19
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +12 -6
- package/package.json +3 -3
- package/dist/client/constant.d.ts +0 -2
|
@@ -33,6 +33,7 @@ module.exports = __toCommonJS(DateFieldScheduleTrigger_exports);
|
|
|
33
33
|
var import_database = require("@nocobase/database");
|
|
34
34
|
var import_cron_parser = __toESM(require("cron-parser"));
|
|
35
35
|
var import_utils = require("./utils");
|
|
36
|
+
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
36
37
|
function getOnTimestampWithOffset({ field, offset = 0, unit = 1e3 }, now) {
|
|
37
38
|
if (!field) {
|
|
38
39
|
return null;
|
|
@@ -303,7 +304,9 @@ class ScheduleTrigger {
|
|
|
303
304
|
on(workflow) {
|
|
304
305
|
this.inspect([workflow]);
|
|
305
306
|
const { collection } = workflow.config;
|
|
306
|
-
const
|
|
307
|
+
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
308
|
+
const event = `${collectionName}.afterSaveWithAssociations`;
|
|
309
|
+
const eventKey = `${collection}.afterSaveWithAssociations`;
|
|
307
310
|
const name = getHookId(workflow, event);
|
|
308
311
|
if (this.events.has(name)) {
|
|
309
312
|
return;
|
|
@@ -313,7 +316,7 @@ class ScheduleTrigger {
|
|
|
313
316
|
return this.schedule(workflow, data, nextTime, Boolean(nextTime), { transaction });
|
|
314
317
|
};
|
|
315
318
|
this.events.set(name, listener);
|
|
316
|
-
this.workflow.app.db.on(event, listener);
|
|
319
|
+
this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.db.on(event, listener);
|
|
317
320
|
}
|
|
318
321
|
off(workflow) {
|
|
319
322
|
for (const [key, timer] of this.cache.entries()) {
|
|
@@ -323,12 +326,15 @@ class ScheduleTrigger {
|
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
328
|
const { collection } = workflow.config;
|
|
326
|
-
const
|
|
329
|
+
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
|
|
330
|
+
const event = `${collectionName}.afterSaveWithAssociations`;
|
|
331
|
+
const eventKey = `${collection}.afterSaveWithAssociations`;
|
|
327
332
|
const name = getHookId(workflow, event);
|
|
328
|
-
if (this.events.has(
|
|
333
|
+
if (this.events.has(eventKey)) {
|
|
329
334
|
const listener = this.events.get(name);
|
|
330
|
-
this.
|
|
331
|
-
|
|
335
|
+
const { db } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager;
|
|
336
|
+
db.off(event, listener);
|
|
337
|
+
this.events.delete(eventKey);
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
340
|
}
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
6
6
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.21.0-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
11
11
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/plugin-workflow-test": "0.
|
|
13
|
+
"@nocobase/plugin-workflow-test": "0.21.0-alpha.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nocobase/test": "0.x",
|
|
46
46
|
"@nocobase/utils": "0.x"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "afd2f3d1341b85ea9daa7b2667dd4ace1fafb7ff",
|
|
49
49
|
"keywords": [
|
|
50
50
|
"Workflow"
|
|
51
51
|
]
|