@hz-9/a5-mail 0.2.0-alpha.41 → 0.2.0-alpha.42

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/all.d.ts CHANGED
@@ -7,8 +7,12 @@
7
7
 
8
8
  import { ConfigurableModuleCls } from '@nestjs/common';
9
9
  import { createTransport } from 'nodemailer';
10
- import type { Transport } from 'nodemailer';
11
- import type { TransportOptions } from 'nodemailer';
10
+ import type JSONTransport from 'nodemailer/lib/json-transport';
11
+ import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
12
+ import type SESTransport from 'nodemailer/lib/ses-transport';
13
+ import type SMTPPool from 'nodemailer/lib/smtp-pool';
14
+ import type SMTPTransport from 'nodemailer/lib/smtp-transport';
15
+ import type StreamTransport from 'nodemailer/lib/stream-transport';
12
16
 
13
17
  /**
14
18
  * @public
@@ -60,7 +64,31 @@ isGlobal: boolean;
60
64
  *
61
65
  * @public
62
66
  */
63
- export declare type A5MailConstructorOptions = TransportOptions | Transport;
67
+ export declare type A5MailConstructorOptions = {
68
+ type: 'smtppool';
69
+ transport: SMTPPool.Options;
70
+ defaults?: SMTPPool.Options;
71
+ } | {
72
+ type: 'sendmail';
73
+ transport: SendmailTransport.Options;
74
+ defaults?: SendmailTransport.Options;
75
+ } | {
76
+ type: 'stream';
77
+ transport: StreamTransport.Options;
78
+ defaults?: StreamTransport.Options;
79
+ } | {
80
+ type: 'json';
81
+ transport: JSONTransport.Options;
82
+ defaults?: JSONTransport.Options;
83
+ } | {
84
+ type: 'ses';
85
+ transport: SESTransport.Options;
86
+ defaults?: SESTransport.Options;
87
+ } | {
88
+ type: 'smtp';
89
+ transport: SMTPTransport.Options;
90
+ defaults?: SMTPTransport.Options;
91
+ };
64
92
 
65
93
  /**
66
94
  * A5 邮件传输实例接口
@@ -8,10 +8,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.A5Mail = void 0;
13
16
  const common_1 = require("@nestjs/common");
14
17
  const nodemailer_1 = require("nodemailer");
18
+ const module_definition_1 = require("./module-definition");
15
19
  /**
16
20
  * A5 邮件服务类
17
21
  *
@@ -21,7 +25,9 @@ const nodemailer_1 = require("nodemailer");
21
25
  */
22
26
  let A5Mail = class A5Mail {
23
27
  constructor(options) {
24
- this.instance = (0, nodemailer_1.createTransport)(options);
28
+ this.instance = options.defaults
29
+ ? (0, nodemailer_1.createTransport)(options.transport, options.defaults)
30
+ : (0, nodemailer_1.createTransport)(options.transport);
25
31
  }
26
32
  /**
27
33
  * 发送邮件
@@ -52,6 +58,7 @@ let A5Mail = class A5Mail {
52
58
  exports.A5Mail = A5Mail;
53
59
  exports.A5Mail = A5Mail = __decorate([
54
60
  (0, common_1.Injectable)(),
61
+ __param(0, (0, common_1.Inject)(module_definition_1.A5_MAIL_MODULE_OPTIONS)),
55
62
  __metadata("design:paramtypes", [Object])
56
63
  ], A5Mail);
57
64
  //# sourceMappingURL=a5-mail.js.map
@@ -1,5 +1,10 @@
1
1
  /// <reference types="node" />
2
- import type { Transport, TransportOptions } from 'nodemailer';
2
+ import type JSONTransport from 'nodemailer/lib/json-transport';
3
+ import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
4
+ import type SESTransport from 'nodemailer/lib/ses-transport';
5
+ import type SMTPPool from 'nodemailer/lib/smtp-pool';
6
+ import type SMTPTransport from 'nodemailer/lib/smtp-transport';
7
+ import type StreamTransport from 'nodemailer/lib/stream-transport';
3
8
  /**
4
9
  * A5 邮件模块构造选项接口
5
10
  *
@@ -7,7 +12,31 @@ import type { Transport, TransportOptions } from 'nodemailer';
7
12
  *
8
13
  * @public
9
14
  */
10
- export type A5MailConstructorOptions = TransportOptions | Transport;
15
+ export type A5MailConstructorOptions = {
16
+ type: 'smtppool';
17
+ transport: SMTPPool.Options;
18
+ defaults?: SMTPPool.Options;
19
+ } | {
20
+ type: 'sendmail';
21
+ transport: SendmailTransport.Options;
22
+ defaults?: SendmailTransport.Options;
23
+ } | {
24
+ type: 'stream';
25
+ transport: StreamTransport.Options;
26
+ defaults?: StreamTransport.Options;
27
+ } | {
28
+ type: 'json';
29
+ transport: JSONTransport.Options;
30
+ defaults?: JSONTransport.Options;
31
+ } | {
32
+ type: 'ses';
33
+ transport: SESTransport.Options;
34
+ defaults?: SESTransport.Options;
35
+ } | {
36
+ type: 'smtp';
37
+ transport: SMTPTransport.Options;
38
+ defaults?: SMTPTransport.Options;
39
+ };
11
40
  /**
12
41
  * A5 邮件传输实例接口
13
42
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hz-9/a5-mail",
3
- "version": "0.2.0-alpha.41",
3
+ "version": "0.2.0-alpha.42",
4
4
  "description": "Mail module for the @hz-9/a5-* series of repositories, based on nodemailer.",
5
5
  "keywords": [
6
6
  "nest",
@@ -53,7 +53,7 @@
53
53
  "rxjs": "^7.8.1",
54
54
  "ts-node": "^10.9.1",
55
55
  "typescript": ">=5.0.0 <5.4.0",
56
- "@hz-9/a5-core": "0.2.0-alpha.41",
56
+ "@hz-9/a5-core": "0.2.0-alpha.42",
57
57
  "@hz-9/heft-nest-rig": "0.1.2"
58
58
  },
59
59
  "peerDependencies": {
@@ -61,7 +61,7 @@
61
61
  "@nestjs/core": "^10.0.0",
62
62
  "reflect-metadata": "^0.1.13",
63
63
  "rxjs": "^7.8.1",
64
- "@hz-9/a5-core": "0.2.0-alpha.41"
64
+ "@hz-9/a5-core": "0.2.0-alpha.42"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"