@nocobase/plugin-workflow-mailer 1.9.0-beta.5 → 1.9.0-beta.6

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.
@@ -11,8 +11,8 @@ module.exports = {
11
11
  "@ant-design/icons": "5.6.1",
12
12
  "@formily/antd-v5": "1.2.3",
13
13
  "react": "18.2.0",
14
- "@nocobase/client": "1.9.0-beta.5",
15
- "@nocobase/plugin-workflow": "1.9.0-beta.5",
14
+ "@nocobase/client": "1.9.0-beta.6",
15
+ "@nocobase/plugin-workflow": "1.9.0-beta.6",
16
16
  "react-i18next": "11.18.6",
17
- "@nocobase/server": "1.9.0-beta.5"
17
+ "@nocobase/server": "1.9.0-beta.6"
18
18
  };
@@ -1 +1 @@
1
- {"name":"nodemailer","version":"6.9.13","description":"Easy as cake e-mail sending from your Node.js applications","main":"lib/nodemailer.js","scripts":{"test":"node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js","test:coverage":"c8 node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js","lint":"eslint .","update":"rm -rf node_modules/ package-lock.json && ncu -u && npm install"},"repository":{"type":"git","url":"https://github.com/nodemailer/nodemailer.git"},"keywords":["Nodemailer"],"author":"Andris Reinman","license":"MIT-0","bugs":{"url":"https://github.com/nodemailer/nodemailer/issues"},"homepage":"https://nodemailer.com/","devDependencies":{"@aws-sdk/client-ses":"3.529.1","bunyan":"1.8.15","c8":"9.1.0","eslint":"8.57.0","eslint-config-nodemailer":"1.2.0","eslint-config-prettier":"9.1.0","libbase64":"1.3.0","libmime":"5.3.4","libqp":"2.1.0","nodemailer-ntlm-auth":"1.0.4","proxy":"1.0.2","proxy-test-server":"1.0.0","smtp-server":"3.13.3"},"engines":{"node":">=6.0.0"},"_lastModified":"2025-07-24T15:20:22.896Z"}
1
+ {"name":"nodemailer","version":"6.9.13","description":"Easy as cake e-mail sending from your Node.js applications","main":"lib/nodemailer.js","scripts":{"test":"node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js","test:coverage":"c8 node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js","lint":"eslint .","update":"rm -rf node_modules/ package-lock.json && ncu -u && npm install"},"repository":{"type":"git","url":"https://github.com/nodemailer/nodemailer.git"},"keywords":["Nodemailer"],"author":"Andris Reinman","license":"MIT-0","bugs":{"url":"https://github.com/nodemailer/nodemailer/issues"},"homepage":"https://nodemailer.com/","devDependencies":{"@aws-sdk/client-ses":"3.529.1","bunyan":"1.8.15","c8":"9.1.0","eslint":"8.57.0","eslint-config-nodemailer":"1.2.0","eslint-config-prettier":"9.1.0","libbase64":"1.3.0","libmime":"5.3.4","libqp":"2.1.0","nodemailer-ntlm-auth":"1.0.4","proxy":"1.0.2","proxy-test-server":"1.0.0","smtp-server":"3.13.3"},"engines":{"node":">=6.0.0"},"_lastModified":"2025-08-22T09:53:43.257Z"}
@@ -8,6 +8,9 @@
8
8
  */
9
9
  import { FlowNodeModel, Instruction, Processor } from '@nocobase/plugin-workflow';
10
10
  export default class extends Instruction {
11
- run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<any>;
11
+ run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
12
+ status: 1 | -1;
13
+ result: any;
14
+ }>;
12
15
  resume(node: FlowNodeModel, job: any, processor: Processor): Promise<any>;
13
16
  }
@@ -82,32 +82,31 @@ class MailerInstruction_default extends import_plugin_workflow.Instruction {
82
82
  };
83
83
  }
84
84
  }
85
- const job = processor.saveJob({
85
+ const { id } = processor.saveJob({
86
86
  status: import_plugin_workflow.JOB_STATUS.PENDING,
87
87
  nodeId: node.id,
88
88
  nodeKey: node.key,
89
89
  upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
90
90
  });
91
- send(payload).then((response) => {
91
+ await processor.exit();
92
+ const jobDone = { status: import_plugin_workflow.JOB_STATUS.PENDING };
93
+ try {
94
+ const response = await send(payload);
92
95
  processor.logger.info(`smtp-mailer (#${node.id}) sent successfully.`);
93
- job.set({
94
- status: import_plugin_workflow.JOB_STATUS.RESOLVED,
95
- result: response
96
- });
97
- }).catch((error) => {
96
+ jobDone.status = import_plugin_workflow.JOB_STATUS.RESOLVED;
97
+ jobDone.result = response;
98
+ } catch (error) {
98
99
  processor.logger.warn(`smtp-mailer (#${node.id}) sent failed: ${error.message}`);
99
- job.set({
100
- status: import_plugin_workflow.JOB_STATUS.FAILED,
101
- result: error
102
- });
103
- }).finally(() => {
100
+ jobDone.status = import_plugin_workflow.JOB_STATUS.FAILED;
101
+ jobDone.result = error;
102
+ } finally {
104
103
  processor.logger.debug(`smtp-mailer (#${node.id}) sending ended, resume workflow...`);
105
- setImmediate(() => {
106
- this.workflow.resume(job);
104
+ const job = await this.workflow.app.db.getRepository("jobs").findOne({
105
+ filterByTk: id
107
106
  });
108
- });
109
- processor.logger.info(`smtp-mailer (#${node.id}) sent, waiting for response...`);
110
- return processor.exit();
107
+ job.set(jobDone);
108
+ this.workflow.resume(job);
109
+ }
111
110
  }
112
111
  async resume(node, job, processor) {
113
112
  const { ignoreFail } = node.config;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:邮件发送节点",
5
5
  "description": "Send email in workflow.",
6
6
  "description.zh-CN": "可用于在工作流中发送电子邮件。",
7
- "version": "1.9.0-beta.5",
7
+ "version": "1.9.0-beta.6",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-smtp-mailer",
@@ -21,7 +21,7 @@
21
21
  "@nocobase/server": "1.x",
22
22
  "@nocobase/test": "1.x"
23
23
  },
24
- "gitHead": "9a61c60dd3db5af64244e82447309b0cb17aabb6",
24
+ "gitHead": "ada5e359a91135cb9baf605c04c5c380f067a046",
25
25
  "keywords": [
26
26
  "NocoBase",
27
27
  "Workflow",