@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.
Files changed (35) hide show
  1. package/dist/client/ExecutionContextProvider.d.ts +7 -0
  2. package/dist/client/components/CollectionBlockInitializer.d.ts +1 -1
  3. package/dist/client/components/DetailsBlockProvider.d.ts +6 -0
  4. package/dist/client/components/SimpleDesigner.d.ts +2 -0
  5. package/dist/client/components/ValueBlock.d.ts +1 -0
  6. package/dist/client/components/index.d.ts +2 -0
  7. package/dist/client/hooks/index.d.ts +3 -0
  8. package/dist/client/hooks/useWorkflowExecuted.d.ts +2 -0
  9. package/dist/client/index.d.ts +12 -12
  10. package/dist/client/index.js +37 -37
  11. package/dist/client/nodes/calculation.d.ts +1 -0
  12. package/dist/client/nodes/create.d.ts +2 -5
  13. package/dist/client/nodes/destroy.d.ts +1 -4
  14. package/dist/client/nodes/query.d.ts +1 -4
  15. package/dist/client/nodes/update.d.ts +2 -5
  16. package/dist/client/schemas/collection.d.ts +1 -4
  17. package/dist/client/triggers/collection.d.ts +6 -3
  18. package/dist/client/triggers/schedule/OnField.d.ts +1 -1
  19. package/dist/client/utils.d.ts +2 -0
  20. package/dist/externalVersion.js +11 -10
  21. package/dist/node_modules/cron-parser/package.json +1 -1
  22. package/dist/node_modules/lru-cache/package.json +1 -1
  23. package/dist/server/Plugin.d.ts +3 -1
  24. package/dist/server/Plugin.js +20 -8
  25. package/dist/server/collections/executions.js +1 -1
  26. package/dist/server/instructions/CreateInstruction.js +6 -3
  27. package/dist/server/instructions/DestroyInstruction.js +5 -3
  28. package/dist/server/instructions/QueryInstruction.js +5 -3
  29. package/dist/server/instructions/UpdateInstruction.js +5 -3
  30. package/dist/server/migrations/20230411034722-manual-multi-form.js +2 -2
  31. package/dist/server/migrations/20230612021134-manual-collection-block.js +1 -1
  32. package/dist/server/triggers/CollectionTrigger.js +30 -19
  33. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +12 -6
  34. package/package.json +3 -3
  35. 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 event = `${collection}.afterSaveWithAssociations`;
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 event = `${collection}.afterSave`;
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(name)) {
333
+ if (this.events.has(eventKey)) {
329
334
  const listener = this.events.get(name);
330
- this.events.delete(name);
331
- this.workflow.app.db.off(event, listener);
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.20.0-alpha.9",
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.20.0-alpha.9"
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": "5473d9039cfdb649a8c8c625edefc9a3ac464be5",
48
+ "gitHead": "afd2f3d1341b85ea9daa7b2667dd4ace1fafb7ff",
49
49
  "keywords": [
50
50
  "Workflow"
51
51
  ]
@@ -1,2 +0,0 @@
1
- export declare const getWorkflowDetailPath: (id: string | number) => string;
2
- export declare const getWorkflowExecutionsPath: (id: string | number) => string;