@nocobase/plugin-workflow 1.6.0-beta.8 → 1.6.0

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/4d75ef32f02d7285.js +10 -0
  2. package/dist/client/{4a2b78cd09ce676a.js → 56ce448358002e64.js} +1 -1
  3. package/dist/client/{70fbbe8694f73dd3.js → 58bb427e05b600de.js} +1 -1
  4. package/dist/client/WorkflowTasks.d.ts +4 -3
  5. package/dist/client/{settings/customizeSubmitToWorkflowActionSettings.d.ts → components/WorkflowTitle.d.ts} +1 -2
  6. package/dist/client/components/index.d.ts +1 -0
  7. package/dist/client/index.d.ts +17 -7
  8. package/dist/client/index.js +1 -1
  9. package/dist/client/settings/BindWorkflowConfig.d.ts +10 -0
  10. package/dist/externalVersion.js +13 -13
  11. package/dist/locale/it-IT.json +100 -0
  12. package/dist/locale/zh-CN.json +4 -1
  13. package/dist/node_modules/cron-parser/package.json +1 -1
  14. package/dist/node_modules/lru-cache/package.json +1 -1
  15. package/dist/server/Plugin.d.ts +5 -1
  16. package/dist/server/Plugin.js +41 -2
  17. package/dist/server/Processor.js +1 -1
  18. package/dist/server/actions/index.js +3 -1
  19. package/dist/server/actions/workflowTasks.d.ts +10 -0
  20. package/dist/server/actions/workflowTasks.js +45 -0
  21. package/dist/server/actions/workflows.d.ts +0 -1
  22. package/dist/server/actions/workflows.js +0 -5
  23. package/dist/server/collections/workflowTasks.d.ts +10 -0
  24. package/dist/server/collections/workflowTasks.js +64 -0
  25. package/dist/server/collections/workflows.js +7 -1
  26. package/dist/server/repositories/WorkflowTasksRepository.d.ts +12 -0
  27. package/dist/server/repositories/WorkflowTasksRepository.js +42 -0
  28. package/dist/server/triggers/CollectionTrigger.js +4 -1
  29. package/dist/server/types/WorkflowTask.d.ts +14 -0
  30. package/dist/server/types/WorkflowTask.js +24 -0
  31. package/dist/server/types/index.d.ts +1 -0
  32. package/dist/swagger/index.d.ts +3 -3
  33. package/dist/swagger/index.js +6 -6
  34. package/package.json +3 -3
  35. package/dist/client/4147131201cde30c.js +0 -10
@@ -0,0 +1,10 @@
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 React from 'react';
10
+ export declare function BindWorkflowConfig(): React.JSX.Element;
@@ -11,24 +11,24 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.0",
13
13
  "@formily/react": "2.3.0",
14
- "@nocobase/client": "1.6.0-beta.8",
15
- "@nocobase/utils": "1.6.0-beta.8",
14
+ "@nocobase/client": "1.6.0",
15
+ "@nocobase/utils": "1.6.0",
16
16
  "antd": "5.12.8",
17
- "@ant-design/icons": "5.2.6",
18
- "react-router-dom": "6.21.0",
17
+ "@ant-design/icons": "5.6.1",
18
+ "react-router-dom": "6.28.1",
19
19
  "react-i18next": "11.18.6",
20
- "@formily/shared": "2.3.2",
21
20
  "lodash": "4.17.21",
22
21
  "sequelize": "6.35.2",
23
- "@nocobase/database": "1.6.0-beta.8",
24
- "@nocobase/server": "1.6.0-beta.8",
25
- "@nocobase/logger": "1.6.0-beta.8",
26
- "@nocobase/actions": "1.6.0-beta.8",
27
- "@nocobase/data-source-manager": "1.6.0-beta.8",
28
- "@nocobase/evaluators": "1.6.0-beta.8",
22
+ "@nocobase/database": "1.6.0",
23
+ "@nocobase/server": "1.6.0",
24
+ "@nocobase/data-source-manager": "1.6.0",
25
+ "@nocobase/logger": "1.6.0",
26
+ "@nocobase/evaluators": "1.6.0",
29
27
  "@formily/antd-v5": "1.1.9",
30
28
  "@formily/reactive": "2.3.0",
29
+ "@formily/shared": "2.3.2",
30
+ "@nocobase/actions": "1.6.0",
31
31
  "dayjs": "1.11.10",
32
- "@nocobase/plugin-workflow-test": "1.6.0-beta.8",
33
- "@nocobase/test": "1.6.0-beta.8"
32
+ "@nocobase/plugin-workflow-test": "1.6.0",
33
+ "@nocobase/test": "1.6.0"
34
34
  };
@@ -0,0 +1,100 @@
1
+ {
2
+ "Workflow": "Workflow",
3
+ "Execution history": "Cronologia esecuzioni",
4
+ "Executed": "Eseguito",
5
+ "Trigger type": "Tipo di trigger",
6
+ "Status": "Stato",
7
+ "On": "Attivo",
8
+ "Off": "Disattivo",
9
+ "Version": "Versione",
10
+ "Copy to new version": "Copia in nuova versione",
11
+ "Duplicate": "Duplica",
12
+ "Loading": "Caricamento",
13
+ "Load failed": "Caricamento fallito",
14
+ "Trigger": "Trigger",
15
+ "Trigger variables": "Variabili trigger",
16
+ "Trigger data": "Dati trigger",
17
+ "Trigger time": "Ora trigger",
18
+ "Triggered at": "Attivato alle",
19
+ "Collection event": "Evento raccolta",
20
+ "Trigger on": "Attiva su",
21
+ "After record added": "Dopo record aggiunto",
22
+ "After record updated": "Dopo record aggiornato",
23
+ "After record added or updated": "Dopo record aggiunto o aggiornato",
24
+ "After record deleted": "Dopo record eliminato",
25
+ "Changed fields": "Campi modificati",
26
+ "Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.": "Attivato solo se uno dei campi selezionati cambia. Se deselezionato, significa che verrà attivato quando qualsiasi campo cambia. Quando il record viene aggiunto o eliminato, qualsiasi campo è considerato cambiato.",
27
+ "Only triggers when match conditions": "Attiva solo quando le condizioni corrispondono",
28
+ "Schedule event": "Evento pianificato",
29
+ "Trigger mode": "Modalità trigger",
30
+ "Based on certain date": "Basato su una certa data",
31
+ "Based on date field of collection": "Basato sul campo data della raccolta",
32
+ "Starts on": "Inizia il",
33
+ "Ends on": "Termina il",
34
+ "No end": "Nessuna fine",
35
+ "Exactly at": "Esattamente alle",
36
+ "Repeat mode": "Modalità ripetizione",
37
+ "Repeat limit": "Limite ripetizione",
38
+ "No limit": "Nessun limite",
39
+ "Seconds": "Secondi",
40
+ "Minutes": "Minuti",
41
+ "Hours": "Ore",
42
+ "Days": "Giorni",
43
+ "Weeks": "Settimane",
44
+ "Months": "Mesi",
45
+ "No repeat": "Nessuna ripetizione",
46
+ "Every": "Ogni",
47
+ "By minute": "Per minuto",
48
+ "By hour": "Per ora",
49
+ "By day": "Per giorno",
50
+ "By week": "Per settimana",
51
+ "By month": "Per mese",
52
+ "By field": "Per campo",
53
+ "By custom date": "Per data personalizzata",
54
+ "Advanced": "Avanzato",
55
+ "End": "Fine",
56
+ "Node result": "Risultato nodo",
57
+ "Constant": "Costante",
58
+ "Null": "Null",
59
+ "Boolean": "Booleano",
60
+ "String": "Stringa",
61
+ "Operator": "Operatore",
62
+ "Arithmetic calculation": "Calcolo aritmetico",
63
+ "String operation": "Operazione stringa",
64
+ "Executed at": "Eseguito alle",
65
+ "Queueing": "In coda",
66
+ "On going": "In corso",
67
+ "Succeeded": "Riuscito",
68
+ "Failed": "Fallito",
69
+ "Pending": "In attesa",
70
+ "Canceled": "Annullato",
71
+ "This node contains branches, deleting will also be preformed to them, are you sure?": "Questo nodo contiene rami, l'eliminazione verrà eseguita anche su di essi, sei sicuro?",
72
+ "Control": "Controllo",
73
+ "Collection operations": "Operazioni raccolta",
74
+ "Extended types": "Tipi estesi",
75
+ "Node type": "Tipo nodo",
76
+ "Calculation": "Calcolo",
77
+ "Configure calculation": "Configura calcolo",
78
+ "Calculation result": "Risultato calcolo",
79
+ "True": "Vero",
80
+ "False": "Falso",
81
+ "concat": "concatena",
82
+ "Condition": "Condizione",
83
+ "Mode": "Modalità",
84
+ "Continue when \"Yes\"": "Continua quando \"Yes\"",
85
+ "Branch into \"Yes\" and \"No\"": "Dirama in \"Yes\" e \"No\"",
86
+ "Conditions": "Condizioni",
87
+ "Create record": "Crea record",
88
+ "Update record": "Aggiorna record",
89
+ "Query record": "Interroga record",
90
+ "Multiple records": "Record multipli",
91
+ "Please select collection first": "Seleziona prima la raccolta",
92
+ "Only update records matching conditions": "Aggiorna solo i record che corrispondono alle condizioni",
93
+ "Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.": "I campi a cui non è assegnato un valore verranno impostati sul valore predefinito, e quelli che non hanno un valore predefinito verranno impostati su null.",
94
+ "Trigger in executed workflow cannot be modified": "Il trigger nel workflow eseguito non può essere modificato",
95
+ "Node in executed workflow cannot be modified": "Il nodo nel workflow eseguito non può essere modificato",
96
+ "Can not delete": "Impossibile eliminare",
97
+ "The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.": "Il risultato di questo nodo è stato referenziato da altri nodi ({{nodes}}), rimuovi l'utilizzo prima di eliminare.",
98
+ "Maximum number of loop calls": "Numero massimo di chiamate ciclo",
99
+ "If the number of loop calls is too large, there will be performance issues.": "Se il numero di chiamate ciclo è troppo grande, ci saranno problemi di prestazioni."
100
+ }
@@ -133,6 +133,8 @@
133
133
  "Canceled": "已取消",
134
134
  "Rejected": "已拒绝",
135
135
  "Retry needed": "需重试",
136
+ "Completed": "已完成",
137
+ "All": "全部",
136
138
  "View result": "查看结果",
137
139
 
138
140
  "Triggered but still waiting in queue to execute.": "已触发但仍在队列中等待执行。",
@@ -231,5 +233,6 @@
231
233
  "After end of branches": "分支结束后",
232
234
  "Inside of branch": "分支内",
233
235
 
234
- "Workflow todos": "流程待办"
236
+ "Workflow todos": "流程待办",
237
+ "New version enabled": "已启用新版本"
235
238
  }
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-02-14T16:52:22.220Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-03-11T05:47:02.713Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-02-14T16:52:21.810Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-03-11T05:47:02.350Z"}
@@ -14,7 +14,7 @@ import Processor from './Processor';
14
14
  import { CustomFunction } from './functions';
15
15
  import Trigger from './triggers';
16
16
  import { InstructionInterface } from './instructions';
17
- import type { ExecutionModel, WorkflowModel } from './types';
17
+ import type { ExecutionModel, WorkflowModel, WorkflowTaskModel } from './types';
18
18
  type ID = number | string;
19
19
  export type EventOptions = {
20
20
  eventKey?: string;
@@ -88,5 +88,9 @@ export default class PluginWorkflowServer extends Plugin {
88
88
  * @returns {Trasaction}
89
89
  */
90
90
  useDataSourceTransaction(dataSourceName: string, transaction: any, create?: boolean): any;
91
+ /**
92
+ * @experimental
93
+ */
94
+ toggleTaskStatus(task: WorkflowTaskModel, done: boolean, { transaction }: Transactionable): Promise<void>;
91
95
  }
92
96
  export {};
@@ -60,6 +60,7 @@ var import_DestroyInstruction = __toESM(require("./instructions/DestroyInstructi
60
60
  var import_QueryInstruction = __toESM(require("./instructions/QueryInstruction"));
61
61
  var import_UpdateInstruction = __toESM(require("./instructions/UpdateInstruction"));
62
62
  var import_WorkflowRepository = __toESM(require("./repositories/WorkflowRepository"));
63
+ var import_WorkflowTasksRepository = __toESM(require("./repositories/WorkflowTasksRepository"));
63
64
  class PluginWorkflowServer extends import_server.Plugin {
64
65
  instructions = new import_utils.Registry();
65
66
  triggers = new import_utils.Registry();
@@ -192,7 +193,8 @@ class PluginWorkflowServer extends import_server.Plugin {
192
193
  }
193
194
  async beforeLoad() {
194
195
  this.db.registerRepositories({
195
- WorkflowRepository: import_WorkflowRepository.default
196
+ WorkflowRepository: import_WorkflowRepository.default,
197
+ WorkflowTasksRepository: import_WorkflowTasksRepository.default
196
198
  });
197
199
  }
198
200
  /**
@@ -227,13 +229,15 @@ class PluginWorkflowServer extends import_server.Plugin {
227
229
  "executions:destroy",
228
230
  "flow_nodes:update",
229
231
  "flow_nodes:destroy",
230
- "flow_nodes:test"
232
+ "flow_nodes:test",
233
+ "jobs:get"
231
234
  ]
232
235
  });
233
236
  this.app.acl.registerSnippet({
234
237
  name: "ui.workflows",
235
238
  actions: ["workflows:list"]
236
239
  });
240
+ this.app.acl.allow("workflowTasks", "countMine", "loggedIn");
237
241
  this.app.acl.allow("*", ["trigger"], "loggedIn");
238
242
  this.db.addMigrations({
239
243
  namespace: this.name,
@@ -625,4 +629,39 @@ class PluginWorkflowServer extends import_server.Plugin {
625
629
  return db.sequelize.transaction();
626
630
  }
627
631
  }
632
+ /**
633
+ * @experimental
634
+ */
635
+ async toggleTaskStatus(task, done, { transaction }) {
636
+ const { db } = this.app;
637
+ const repository = db.getRepository("workflowTasks");
638
+ if (done) {
639
+ await repository.destroy({
640
+ filter: {
641
+ type: task.type,
642
+ key: `${task.key}`
643
+ },
644
+ transaction
645
+ });
646
+ } else {
647
+ await repository.updateOrCreate({
648
+ filterKeys: ["key", "type"],
649
+ values: task,
650
+ transaction
651
+ });
652
+ }
653
+ if (task.userId) {
654
+ const counts = await repository.countAll({
655
+ where: {
656
+ userId: task.userId
657
+ },
658
+ transaction
659
+ }) || [];
660
+ this.app.emit("ws:sendToTag", {
661
+ tagKey: "userId",
662
+ tagValue: `${task.userId}`,
663
+ message: { type: "workflow:tasks:updated", payload: counts }
664
+ });
665
+ }
666
+ }
628
667
  }
@@ -212,7 +212,7 @@ class Processor {
212
212
  if (parentNode) {
213
213
  this.logger.debug(`not on main, recall to parent entry node (${node.id})})`);
214
214
  await this.recall(parentNode, job);
215
- return job;
215
+ return null;
216
216
  }
217
217
  return this.exit(job.status);
218
218
  }
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(actions_exports);
42
42
  var workflows = __toESM(require("./workflows"));
43
43
  var nodes = __toESM(require("./nodes"));
44
44
  var executions = __toESM(require("./executions"));
45
+ var workflowTasks = __toESM(require("./workflowTasks"));
45
46
  function make(name, mod) {
46
47
  return Object.keys(mod).reduce(
47
48
  (result, key) => ({
@@ -62,6 +63,7 @@ function actions_default({ app }) {
62
63
  destroy: nodes.destroy,
63
64
  test: nodes.test
64
65
  }),
65
- ...make("executions", executions)
66
+ ...make("executions", executions),
67
+ ...make("workflowTasks", workflowTasks)
66
68
  });
67
69
  }
@@ -0,0 +1,10 @@
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 { Context } from '@nocobase/actions';
10
+ export declare function countMine(context: Context, next: any): Promise<void>;
@@ -0,0 +1,45 @@
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 workflowTasks_exports = {};
28
+ __export(workflowTasks_exports, {
29
+ countMine: () => countMine
30
+ });
31
+ module.exports = __toCommonJS(workflowTasks_exports);
32
+ var import_actions = require("@nocobase/actions");
33
+ async function countMine(context, next) {
34
+ const repository = import_actions.utils.getRepositoryFromParams(context);
35
+ context.body = await repository.countAll({
36
+ where: {
37
+ userId: context.state.currentUser.id
38
+ }
39
+ }) || [];
40
+ next();
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ countMine
45
+ });
@@ -15,5 +15,4 @@ export declare function sync(context: Context, next: any): Promise<void>;
15
15
  * @deprecated
16
16
  * Keep for action trigger compatibility
17
17
  */
18
- export declare function trigger(context: Context, next: any): Promise<any>;
19
18
  export declare function execute(context: Context, next: any): Promise<any>;
@@ -40,7 +40,6 @@ __export(workflows_exports, {
40
40
  execute: () => execute,
41
41
  revision: () => revision,
42
42
  sync: () => sync,
43
- trigger: () => trigger,
44
43
  update: () => update
45
44
  });
46
45
  module.exports = __toCommonJS(workflows_exports);
@@ -116,9 +115,6 @@ async function sync(context, next) {
116
115
  context.status = 204;
117
116
  await next();
118
117
  }
119
- async function trigger(context, next) {
120
- return next();
121
- }
122
118
  async function execute(context, next) {
123
119
  const plugin = context.app.pm.get(import_Plugin.default);
124
120
  const { filterByTk, values, autoRevision } = context.action.params;
@@ -177,6 +173,5 @@ async function execute(context, next) {
177
173
  execute,
178
174
  revision,
179
175
  sync,
180
- trigger,
181
176
  update
182
177
  });
@@ -0,0 +1,10 @@
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 { CollectionOptions } from '@nocobase/database';
10
+ export default function (): CollectionOptions;
@@ -0,0 +1,64 @@
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 workflowTasks_exports = {};
28
+ __export(workflowTasks_exports, {
29
+ default: () => workflowTasks_default
30
+ });
31
+ module.exports = __toCommonJS(workflowTasks_exports);
32
+ function workflowTasks_default() {
33
+ return {
34
+ dumpRules: "required",
35
+ migrationRules: ["overwrite", "schema-only"],
36
+ name: "workflowTasks",
37
+ shared: true,
38
+ repository: "WorkflowTasksRepository",
39
+ fields: [
40
+ {
41
+ name: "user",
42
+ type: "belongsTo"
43
+ },
44
+ {
45
+ name: "workflow",
46
+ type: "belongsTo"
47
+ },
48
+ {
49
+ type: "string",
50
+ name: "type"
51
+ },
52
+ {
53
+ type: "string",
54
+ name: "key"
55
+ }
56
+ ],
57
+ indexes: [
58
+ {
59
+ unique: true,
60
+ fields: ["type", "key"]
61
+ }
62
+ ]
63
+ };
64
+ }
@@ -44,7 +44,13 @@ function workflows_default() {
44
44
  {
45
45
  type: "string",
46
46
  name: "title",
47
- required: true
47
+ interface: "input",
48
+ uiSchema: {
49
+ title: '{{t("Name")}}',
50
+ type: "string",
51
+ "x-component": "Input",
52
+ required: true
53
+ }
48
54
  },
49
55
  {
50
56
  type: "boolean",
@@ -0,0 +1,12 @@
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 { Repository } from '@nocobase/database';
10
+ export default class WorkflowTasksRepository extends Repository {
11
+ countAll(options: any): Promise<import("@nocobase/database").Model<any, any>[]>;
12
+ }
@@ -0,0 +1,42 @@
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 WorkflowTasksRepository_exports = {};
28
+ __export(WorkflowTasksRepository_exports, {
29
+ default: () => WorkflowTasksRepository
30
+ });
31
+ module.exports = __toCommonJS(WorkflowTasksRepository_exports);
32
+ var import_database = require("@nocobase/database");
33
+ class WorkflowTasksRepository extends import_database.Repository {
34
+ async countAll(options) {
35
+ const db = this.database;
36
+ return this.collection.model.findAll({
37
+ ...options,
38
+ attributes: ["type", [db.sequelize.fn("COUNT", db.sequelize.col("type")), "count"]],
39
+ group: ["type"]
40
+ });
41
+ }
42
+ }
@@ -68,13 +68,16 @@ class CollectionTrigger extends import__.default {
68
68
  events = /* @__PURE__ */ new Map();
69
69
  // async function, should return promise
70
70
  static async handler(workflow, data, options) {
71
+ const { skipWorkflow = false, stack } = options.context ?? {};
72
+ if (skipWorkflow) {
73
+ return;
74
+ }
71
75
  const [dataSourceName] = (0, import_data_source_manager.parseCollectionName)(workflow.config.collection);
72
76
  const transaction = this.workflow.useDataSourceTransaction(dataSourceName, options.transaction);
73
77
  const ctx = await this.prepare(workflow, data, { ...options, transaction });
74
78
  if (!ctx) {
75
79
  return;
76
80
  }
77
- const { stack } = options.context ?? {};
78
81
  if (workflow.sync) {
79
82
  await this.workflow.trigger(workflow, ctx, {
80
83
  transaction,
@@ -0,0 +1,14 @@
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
+ export default interface WorkflowTaskModel {
10
+ type: string;
11
+ key: string;
12
+ userId: number;
13
+ workflowId: number;
14
+ }
@@ -0,0 +1,24 @@
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 __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var WorkflowTask_exports = {};
24
+ module.exports = __toCommonJS(WorkflowTask_exports);
@@ -10,3 +10,4 @@ export type { default as WorkflowModel } from './Workflow';
10
10
  export type { default as FlowNodeModel } from './FlowNode';
11
11
  export type { default as ExecutionModel } from './Execution';
12
12
  export type { default as JobModel } from './Job';
13
+ export type { default as WorkflowTaskModel } from './WorkflowTask';