@types/nodemailer 6.1.1 → 6.4.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.
nodemailer/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
  > `npm install --save @types/nodemailer`
3
3
 
4
4
  # Summary
5
- This package contains type definitions for Nodemailer ( https://github.com/nodemailer/nodemailer ).
5
+ This package contains type definitions for Nodemailer (https://github.com/nodemailer/nodemailer).
6
6
 
7
7
  # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer.
9
9
 
10
- Additional Details
11
- * Last updated: Fri, 24 May 2019 16:40:13 GMT
12
- * Dependencies: @types/node
10
+ ### Additional Details
11
+ * Last updated: Wed, 18 Dec 2019 16:21:54 GMT
12
+ * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
13
13
  * Global values: none
14
14
 
15
15
  # Credits
16
- These definitions were written by Rogier Schouten <https://github.com/rogierschouten>, Piotr Roszatycki <https://github.com/dex4er>, Daniel Chao <https://github.com/bioball>.
16
+ These definitions were written by Rogier Schouten (https://github.com/rogierschouten), Piotr Roszatycki (https://github.com/dex4er), and Daniel Chao (https://github.com/bioball).
nodemailer/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- // Type definitions for Nodemailer 6.1
1
+ // Type definitions for Nodemailer 6.4
2
2
  // Project: https://github.com/nodemailer/nodemailer, https://nodemailer.com
3
3
  // Definitions by: Rogier Schouten <https://github.com/rogierschouten>
4
4
  // Piotr Roszatycki <https://github.com/dex4er>
5
5
  // Daniel Chao <https://github.com/bioball>
6
6
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
- // TypeScript Version: 2.3
7
+ // TypeScript Version: 3.3
8
8
 
9
9
  /// <reference types="node" />
10
10
 
@@ -3,6 +3,13 @@ declare namespace addressparser {
3
3
  name: string;
4
4
  address: string;
5
5
  }
6
+
7
+ interface Group {
8
+ name: string;
9
+ group: AddressOrGroup[];
10
+ }
11
+
12
+ type AddressOrGroup = Address | Group;
6
13
  }
7
14
 
8
15
  /**
@@ -18,6 +25,7 @@ declare namespace addressparser {
18
25
  *
19
26
  * @return An array of address objects
20
27
  */
21
- declare function addressparser(address: string): addressparser.Address[];
28
+ declare function addressparser(address: string, options: { flatten: true }): addressparser.Address[];
29
+ declare function addressparser(address: string, options?: { flatten: false }): addressparser.AddressOrGroup[];
22
30
 
23
31
  export = addressparser;
@@ -87,8 +87,9 @@ declare class MimeNode {
87
87
  */
88
88
  setContent(content: string | Buffer | Readable): this;
89
89
 
90
- /** Generate the message and return it with a callback */
90
+ /** Generate the message and return it with a callback or promise */
91
91
  build(callback: (err: Error | null, buf: Buffer) => void): void;
92
+ build(): Promise<Buffer>;
92
93
 
93
94
  getTransferEncoding(): string;
94
95
 
@@ -12,8 +12,57 @@ import MimeNode = require('./mime-node');
12
12
 
13
13
  declare namespace SESTransport {
14
14
  interface MailOptions extends Mail.Options {
15
- /** All keys are added to the SendRawEmail method options */
16
- ses?: object;
15
+ /** list of keys that SendRawEmail method can take */
16
+ ses?: MailSesOptions;
17
+ }
18
+
19
+ interface MailSesOptions {
20
+ /**
21
+ * The identity's email address. If you do not provide a value for this parameter, you must specify a "From" address in the raw text of the message. (You can also specify both.) Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a source email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the domain part of an address (the part after the @ sign) contains non-ASCII characters, they must be encoded using Punycode, as described in RFC3492. The sender name (also known as the friendly name) may contain non-ASCII characters. These characters must be encoded using MIME encoded-word syntax, as described in RFC 2047. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. If you specify the Source parameter and have feedback forwarding enabled, then bounces and complaints will be sent to this email address. This takes precedence over any Return-Path header that you might include in the raw text of the message.
22
+ */
23
+ Source?: string;
24
+ /**
25
+ * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses.
26
+ */
27
+ Destinations?: string[];
28
+ /**
29
+ * The raw email message itself. The message has to meet the following criteria: The message has to contain a header and a body, separated by a blank line. All of the required header fields must be present in the message. Each part of a multipart MIME message must be formatted properly. Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see Unsupported Attachment Types in the Amazon SES Developer Guide. The entire message must be base64-encoded. If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, we highly recommend that you encode that content. For more information, see Sending Raw Email in the Amazon SES Developer Guide. Per RFC 5321, the maximum length of each line of text, including the &lt;CRLF&gt;, must not exceed 1,000 characters.
30
+ */
31
+ RawMessage?: {
32
+ /**
33
+ * The raw data of the message. This data needs to base64-encoded if you are accessing Amazon SES directly through the HTTPS interface. If you are accessing Amazon SES using an AWS SDK, the SDK takes care of the base 64-encoding for you. In all cases, the client must ensure that the message format complies with Internet email standards regarding email header fields, MIME types, and MIME encoding. The To:, CC:, and BCC: headers in the raw message can contain a group list. If you are using SendRawEmail with sending authorization, you can include X-headers in the raw message to specify the "Source," "From," and "Return-Path" addresses. For more information, see the documentation for SendRawEmail. Do not include these X-headers in the DKIM signature, because they are removed by Amazon SES before sending the email. For more information, go to the Amazon SES Developer Guide.
34
+ */
35
+ Data: Buffer|Uint8Array|{}|string;
36
+ };
37
+ /**
38
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to specify a particular "From" address in the header of the raw email. Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of the email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses the value of the FromArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
39
+ */
40
+ FromArn?: string;
41
+ /**
42
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to send from user@example.com, then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be user@example.com. Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of the email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES uses the value of the SourceArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
43
+ */
44
+ SourceArn?: string;
45
+ /**
46
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be feedback@example.com. Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw message of the email. If you use both the ReturnPathArn parameter and the corresponding X-header, Amazon SES uses the value of the ReturnPathArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
47
+ */
48
+ ReturnPathArn?: string;
49
+ /**
50
+ * A list of tags, in the form of name/value pairs, to apply to an email that you send using SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
51
+ */
52
+ Tags?: Array<{
53
+ /**
54
+ * The name of the tag. The name must: This value can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). Contain less than 256 characters.
55
+ */
56
+ Name: string;
57
+ /**
58
+ * The value of the tag. The value must: This value can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). Contain less than 256 characters.
59
+ */
60
+ Value: string;
61
+ }>;
62
+ /**
63
+ * The name of the configuration set to use when you send an email using SendRawEmail.
64
+ */
65
+ ConfigurationSetName?: string;
17
66
  }
18
67
 
19
68
  interface Options extends MailOptions, TransportOptions {
@@ -22,17 +22,23 @@ declare namespace SMTPConnection {
22
22
 
23
23
  type OAuth2 = XOAuth2.Options;
24
24
 
25
+ interface AuthenticationTypeCustom extends Credentials {
26
+ /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */
27
+ type: 'custom' | 'Custom' | 'CUSTOM';
28
+ method: string;
29
+ }
30
+
25
31
  interface AuthenticationTypeLogin extends Credentials {
26
- /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ */
32
+ /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */
27
33
  type?: 'login' | 'Login' | 'LOGIN';
28
34
  }
29
35
 
30
36
  interface AuthenticationTypeOAuth2 extends OAuth2 {
31
- /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ */
37
+ /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */
32
38
  type?: 'oauth2' | 'OAuth2' | 'OAUTH2';
33
39
  }
34
40
 
35
- type AuthenticationType = AuthenticationTypeLogin | AuthenticationTypeOAuth2;
41
+ type AuthenticationType = AuthenticationTypeCustom | AuthenticationTypeLogin | AuthenticationTypeOAuth2;
36
42
 
37
43
  interface AuthenticationCredentials {
38
44
  /** normal authentication object */
@@ -44,6 +50,30 @@ declare namespace SMTPConnection {
44
50
  oauth2: OAuth2;
45
51
  }
46
52
 
53
+ interface CustomAuthenticationResponse {
54
+ command: string;
55
+ response: string;
56
+ status: number;
57
+ text: string;
58
+ code?: number;
59
+ }
60
+
61
+ interface CustomAuthenticationContext {
62
+ auth: AuthenticationCredentials;
63
+ authMethod: string;
64
+ extensions: string[];
65
+ authMethods: string[];
66
+ maxAllowedSize: number | false;
67
+ sendCommand(cmd: string): Promise<CustomAuthenticationResponse>;
68
+ sendCommand(cmd: string, done: (err: Error | null, data: CustomAuthenticationResponse) => void): void;
69
+ resolve(): unknown;
70
+ reject(err: Error | string): unknown;
71
+ }
72
+
73
+ interface CustomAuthenticationHandlers {
74
+ [method: string]: (ctx: CustomAuthenticationContext) => Promise<boolean> | unknown;
75
+ }
76
+
47
77
  type DSNOption = 'NEVER' | 'SUCCESS' | 'FAILURE' | 'DELAY';
48
78
 
49
79
  interface DSNOptions {
@@ -137,6 +167,7 @@ declare namespace SMTPConnection {
137
167
  socket?: net.Socket;
138
168
  /** connected socket to use instead of creating and connecting a new one. If secure option is true, then socket is upgraded from plaintext to ciphertext */
139
169
  connection?: net.Socket;
170
+ customAuth?: CustomAuthenticationHandlers;
140
171
  }
141
172
  }
142
173
 
@@ -13,6 +13,11 @@ import SMTPConnection = require('./smtp-connection');
13
13
  import XOAuth2 = require('./xoauth2');
14
14
 
15
15
  declare namespace SMTPTransport {
16
+ interface AuthenticationTypeCustom extends SMTPConnection.Credentials {
17
+ type: 'CUSTOM';
18
+ method: string;
19
+ }
20
+
16
21
  interface AuthenticationTypeLogin {
17
22
  type: 'LOGIN';
18
23
  user: string;
@@ -30,6 +30,7 @@ declare namespace XOAuth2 {
30
30
  timeout?: s;
31
31
  /** Function to run when a new access token is required */
32
32
  provisionCallback?(user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void): void;
33
+ serviceClient?: string;
33
34
  }
34
35
 
35
36
  interface Token {
@@ -49,7 +50,7 @@ declare class XOAuth2 extends Stream {
49
50
  accessToken: string | false;
50
51
  expires: number;
51
52
 
52
- constructor(options: XOAuth2.Options, logger: shared.Logger);
53
+ constructor(options?: XOAuth2.Options, logger?: shared.Logger);
53
54
 
54
55
  /** Returns or generates (if previous has expired) a XOAuth2 token */
55
56
  getToken(renew: boolean, callback: (err: Error | null, accessToken: string) => void): void;
@@ -71,7 +72,12 @@ declare class XOAuth2 extends Stream {
71
72
  * As we do only a simple POST request we do not actually require complicated
72
73
  * logic support (no redirects, no nothing) anyway.
73
74
  */
74
- postRequest(url: string, payload: string | Buffer | Readable | { [key: string]: string }, params: XOAuth2.RequestParams, callback: (err: Error | null, buf: Buffer) => void): void;
75
+ postRequest(
76
+ url: string,
77
+ payload: string | Buffer | Readable | { [key: string]: string },
78
+ params: XOAuth2.RequestParams,
79
+ callback: (err: Error | null, buf: Buffer) => void
80
+ ): void;
75
81
 
76
82
  /** Encodes a buffer or a string into Base64url format */
77
83
  toBase64URL(data: Buffer | string): string;
nodemailer/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/nodemailer",
3
- "version": "6.1.1",
3
+ "version": "6.4.0",
4
4
  "description": "TypeScript definitions for Nodemailer",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -21,7 +21,7 @@
21
21
  }
22
22
  ],
23
23
  "main": "",
24
- "types": "index",
24
+ "types": "index.d.ts",
25
25
  "repository": {
26
26
  "type": "git",
27
27
  "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
@@ -31,6 +31,6 @@
31
31
  "dependencies": {
32
32
  "@types/node": "*"
33
33
  },
34
- "typesPublisherContentHash": "a650b914d963a357341d26b2b50c6d64832f6a849206656e6fc18c586532ab7f",
35
- "typeScriptVersion": "2.3"
34
+ "typesPublisherContentHash": "0039445f01109c0e68106090b3609cab060c769ad2516b099fdafdb8ca22d4a0",
35
+ "typeScriptVersion": "3.3"
36
36
  }