mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Fix and improve nodemailer. Add nodemailer-ses-transport. Improve aws-sdk.
Move types to nodemailer.d.ts. Move namespace to bottom. Fix spacing. Add nodemailer-ses-transport. Add templateSender. Allow Exists: false to exist by itself. Convert spacing to tabs. Fixed references. Add DynamoDB createTable and delete table. They do not exist on the DocumentClient. Fix spacing.
This commit is contained in:
parent
e659470271
commit
3aac49ea7e
9
aws-sdk/aws-sdk.d.ts
vendored
9
aws-sdk/aws-sdk.d.ts
vendored
@ -319,7 +319,8 @@ declare module "aws-sdk" {
|
||||
export class DynamoDB {
|
||||
constructor(options?: any);
|
||||
endpoint: Endpoint;
|
||||
|
||||
createTable(params: any, next: (err: any, data: any) => void): void;
|
||||
deleteTable(params: any, next: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
// ==========================================================
|
||||
@ -355,10 +356,10 @@ declare module "aws-sdk" {
|
||||
ConditionalOperator?: "AND" | "OR";
|
||||
Expected?: {
|
||||
[someKey: string]: {
|
||||
AttributeValueList: any[];
|
||||
ComparisonOperator: _DDBDC_ComparisonOperator;
|
||||
AttributeValueList?: any[];
|
||||
ComparisonOperator?: _DDBDC_ComparisonOperator;
|
||||
Exists: boolean;
|
||||
Value: any;
|
||||
Value?: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../nodemailer/nodemailer-types.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer.d.ts" />
|
||||
|
||||
declare module "nodemailer-direct-transport" {
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// Definitions by: Peter Snider <https://github.com/psnider/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../nodemailer/nodemailer-types.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer.d.ts" />
|
||||
|
||||
declare module "nodemailer-pickup-transport" {
|
||||
|
||||
|
||||
26
nodemailer-ses-transport/nodemailer-ses-transport-tests.ts
Normal file
26
nodemailer-ses-transport/nodemailer-ses-transport-tests.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/// <reference path="../aws-sdk/aws-sdk.d.ts" />
|
||||
/// <reference path="nodemailer-ses-transport.d.ts" />
|
||||
|
||||
import * as AWS from 'aws-sdk';
|
||||
import * as sesTransport from 'nodemailer-ses-transport';
|
||||
|
||||
var opts: sesTransport.SesOptions = {
|
||||
ses: new AWS.SES(),
|
||||
rateLimit: 5,
|
||||
maxConnections: 3,
|
||||
};
|
||||
|
||||
var transport: nodemailer.Transport = sesTransport(opts);
|
||||
|
||||
// setup e-mail data with unicode symbols
|
||||
var mailOptions: nodemailer.SendMailOptions = {
|
||||
from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address
|
||||
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
|
||||
subject: 'Hello ✔', // Subject line
|
||||
text: 'Hello world ✔', // plaintext body
|
||||
html: '<b>Hello world ✔</b>' // html body
|
||||
};
|
||||
|
||||
transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => {
|
||||
// nothing
|
||||
});
|
||||
29
nodemailer-ses-transport/nodemailer-ses-transport.d.ts
vendored
Normal file
29
nodemailer-ses-transport/nodemailer-ses-transport.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for nodemailer-ses-transport 1.4.0
|
||||
// Project: https://github.com/andris9/nodemailer-ses-transport
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../aws-sdk/aws-sdk.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer.d.ts" />
|
||||
|
||||
declare module "nodemailer-ses-transport" {
|
||||
|
||||
import * as AWS from 'aws-sdk';
|
||||
|
||||
namespace sesTransport {
|
||||
export interface SesOptions {
|
||||
ses?: AWS.SES;
|
||||
accessKeyId?: string;
|
||||
secretAccessKey?: string;
|
||||
sessionToken?: string;
|
||||
region?: string;
|
||||
httpOptions?: AWS.HttpOptions;
|
||||
rateLimit?: number;
|
||||
maxConnections?: number;
|
||||
}
|
||||
}
|
||||
|
||||
function sesTransport(options: sesTransport.SesOptions): nodemailer.Transport;
|
||||
|
||||
export = sesTransport;
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer-types.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer.d.ts" />
|
||||
|
||||
declare module "nodemailer-smtp-pool" {
|
||||
import tls = require("tls");
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer-types.d.ts" />
|
||||
/// <reference path="../nodemailer/nodemailer.d.ts" />
|
||||
|
||||
declare module "nodemailer-smtp-transport" {
|
||||
|
||||
|
||||
@ -42,4 +42,22 @@ transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInf
|
||||
// promise send mail without callback
|
||||
transporter
|
||||
.sendMail(mailOptions)
|
||||
.then(info => info.messageId)
|
||||
.then(info => info.messageId)
|
||||
|
||||
// create template based sender function
|
||||
var sendPwdReset = transporter.templateSender({
|
||||
subject: 'Password reset for {{username}}!',
|
||||
text: 'Hello, {{username}}, Please go here to reset your password: {{ reset }}',
|
||||
html: '<b>Hello, <strong>{{username}}</strong>, Please <a href="{{ reset }}">go here to reset your password</a>: {{ reset }}</p>'
|
||||
}, {
|
||||
from: 'sender@example.com',
|
||||
});
|
||||
|
||||
// use template based sender to send a message
|
||||
sendPwdReset({
|
||||
to: 'receiver@example.com'
|
||||
}, {
|
||||
username: 'Node Mailer',
|
||||
reset: 'https://www.example.com/reset?token=<unique-single-use-token>'
|
||||
})
|
||||
.then(info => info.messageId);
|
||||
|
||||
149
nodemailer/nodemailer-types.d.ts
vendored
149
nodemailer/nodemailer-types.d.ts
vendored
@ -1,149 +0,0 @@
|
||||
// Type definitions for Nodemailer 1.3.2
|
||||
// Project: https://github.com/andris9/Nodemailer
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace nodemailer {
|
||||
|
||||
export interface AttachmentObject {
|
||||
/**
|
||||
* filename to be reported as the name of the attached file, use of unicode is allowed
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* optional content id for using inline images in HTML message source
|
||||
*/
|
||||
cid?: string;
|
||||
/**
|
||||
* Pathname or URL to use streaming
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* String, Buffer or a Stream contents for the attachment
|
||||
*/
|
||||
content: string|Buffer|NodeJS.ReadableStream;
|
||||
/**
|
||||
* If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.
|
||||
*/
|
||||
encoding?: string;
|
||||
/**
|
||||
* optional content type for the attachment, if not set will be derived from the filename property
|
||||
*/
|
||||
contentType?: string;
|
||||
/**
|
||||
* optional content disposition type for the attachment, defaults to 'attachment'
|
||||
*/
|
||||
contentDisposition?: string;
|
||||
}
|
||||
|
||||
export interface SendMailOptions {
|
||||
/**
|
||||
* The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>', see here for details
|
||||
*/
|
||||
from?: string;
|
||||
/**
|
||||
* An e-mail address that will appear on the Sender: field
|
||||
*/
|
||||
sender?: string;
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the To: field
|
||||
*/
|
||||
to?: string|string[];
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field
|
||||
*/
|
||||
cc?: string|string[];
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field
|
||||
*/
|
||||
bcc?: string|string[];
|
||||
/**
|
||||
* An e-mail address that will appear on the Reply-To: field
|
||||
*/
|
||||
replyTo?: string;
|
||||
/**
|
||||
* The message-id this message is replying
|
||||
*/
|
||||
inReplyTo?: string;
|
||||
/**
|
||||
* Message-id list (an array or space separated string)
|
||||
*/
|
||||
references?: string|string[];
|
||||
/**
|
||||
* The subject of the e-mail
|
||||
*/
|
||||
subject?: string;
|
||||
/**
|
||||
* The plaintext version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
|
||||
*/
|
||||
text?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
|
||||
/**
|
||||
* The HTML version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
|
||||
*/
|
||||
html?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
|
||||
/**
|
||||
* An object or array of additional header fields (e.g. {"X-Key-Name": "key value"} or [{key: "X-Key-Name", value: "val1"}, {key: "X-Key-Name", value: "val2"}])
|
||||
*/
|
||||
headers?: any;
|
||||
/**
|
||||
* An array of attachment objects (see below for details)
|
||||
*/
|
||||
attachments?: AttachmentObject[];
|
||||
/**
|
||||
* An array of alternative text contents (in addition to text and html parts) (see below for details)
|
||||
*/
|
||||
alternatives?: AttachmentObject[];
|
||||
/**
|
||||
* optional Message-Id value, random value will be generated if not set
|
||||
*/
|
||||
messageId?: string;
|
||||
/**
|
||||
* optional Date value, current UTC string will be used if not set
|
||||
*/
|
||||
date?: Date;
|
||||
/**
|
||||
* optional transfer encoding for the textual parts (defaults to 'quoted-printable')
|
||||
*/
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
export interface SentMessageInfo {
|
||||
/**
|
||||
* most transports should return the final Message-Id value used with this property
|
||||
*/
|
||||
messageId: string;
|
||||
/**
|
||||
* includes the envelope object for the message
|
||||
*/
|
||||
envelope: any;
|
||||
/**
|
||||
* is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)
|
||||
*/
|
||||
accepted: string[];
|
||||
/**
|
||||
* is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)
|
||||
*/
|
||||
rejected: string[];
|
||||
/**
|
||||
* is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response
|
||||
*/
|
||||
pending?: string[];
|
||||
/**
|
||||
* is a string returned by SMTP transports and includes the last SMTP response from the server
|
||||
*/
|
||||
response: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is what you implement to create a new transporter yourself
|
||||
*/
|
||||
export interface Transport {
|
||||
name: string;
|
||||
version: string;
|
||||
send(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
}
|
||||
174
nodemailer/nodemailer.d.ts
vendored
174
nodemailer/nodemailer.d.ts
vendored
@ -3,8 +3,8 @@
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="./nodemailer-types.d.ts" />
|
||||
/// <reference path="../nodemailer-direct-transport/nodemailer-direct-transport.d.ts" />
|
||||
/// <reference path="../nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts" />
|
||||
|
||||
@ -13,6 +13,8 @@ declare module "nodemailer" {
|
||||
import directTransport = require("nodemailer-direct-transport");
|
||||
import smtpTransport = require("nodemailer-smtp-transport");
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
|
||||
export type Transport = nodemailer.Transport;
|
||||
export type SendMailOptions = nodemailer.SendMailOptions;
|
||||
export type SentMessageInfo = nodemailer.SentMessageInfo;
|
||||
@ -39,6 +41,17 @@ declare module "nodemailer" {
|
||||
*/
|
||||
sendMail(mail: SendMailOptions): Promise<SentMessageInfo>;
|
||||
|
||||
/**
|
||||
* Send mail using a template.
|
||||
*/
|
||||
templateSender(template?: any, defaults?: any): (mailData: any, context: any) => Promise<SentMessageInfo>;
|
||||
|
||||
/**
|
||||
* Send mail using a template with a callback.
|
||||
*/
|
||||
templateSender(template?: any, defaults?: any, callback?: (error: Error, info: SentMessageInfo) => void): void;
|
||||
|
||||
|
||||
/**
|
||||
* Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method
|
||||
*
|
||||
@ -48,14 +61,14 @@ declare module "nodemailer" {
|
||||
use(step: string, plugin: Plugin): void;
|
||||
|
||||
/**
|
||||
* Verifies connection with server
|
||||
*/
|
||||
verify(callback: (error: Error, success?: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Verifies connection with server
|
||||
*/
|
||||
verify(): Promise<void>;
|
||||
* Verifies connection with server
|
||||
*/
|
||||
verify(callback: (error: Error, success?: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Verifies connection with server
|
||||
*/
|
||||
verify(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Close all connections
|
||||
@ -76,3 +89,146 @@ declare module "nodemailer" {
|
||||
*/
|
||||
export function createTransport(transport: Transport, defaults?: Object): Transporter;
|
||||
}
|
||||
|
||||
declare namespace nodemailer {
|
||||
|
||||
export interface AttachmentObject {
|
||||
/**
|
||||
* filename to be reported as the name of the attached file, use of unicode is allowed
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* optional content id for using inline images in HTML message source
|
||||
*/
|
||||
cid?: string;
|
||||
/**
|
||||
* Pathname or URL to use streaming
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* String, Buffer or a Stream contents for the attachment
|
||||
*/
|
||||
content: string|Buffer|NodeJS.ReadableStream;
|
||||
/**
|
||||
* If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.
|
||||
*/
|
||||
encoding?: string;
|
||||
/**
|
||||
* optional content type for the attachment, if not set will be derived from the filename property
|
||||
*/
|
||||
contentType?: string;
|
||||
/**
|
||||
* optional content disposition type for the attachment, defaults to 'attachment'
|
||||
*/
|
||||
contentDisposition?: string;
|
||||
}
|
||||
|
||||
export interface SendMailOptions {
|
||||
/**
|
||||
* The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>', see here for details
|
||||
*/
|
||||
from?: string;
|
||||
/**
|
||||
* An e-mail address that will appear on the Sender: field
|
||||
*/
|
||||
sender?: string;
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the To: field
|
||||
*/
|
||||
to?: string|string[];
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field
|
||||
*/
|
||||
cc?: string|string[];
|
||||
/**
|
||||
* Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field
|
||||
*/
|
||||
bcc?: string|string[];
|
||||
/**
|
||||
* An e-mail address that will appear on the Reply-To: field
|
||||
*/
|
||||
replyTo?: string;
|
||||
/**
|
||||
* The message-id this message is replying
|
||||
*/
|
||||
inReplyTo?: string;
|
||||
/**
|
||||
* Message-id list (an array or space separated string)
|
||||
*/
|
||||
references?: string|string[];
|
||||
/**
|
||||
* The subject of the e-mail
|
||||
*/
|
||||
subject?: string;
|
||||
/**
|
||||
* The plaintext version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
|
||||
*/
|
||||
text?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
|
||||
/**
|
||||
* The HTML version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
|
||||
*/
|
||||
html?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
|
||||
/**
|
||||
* An object or array of additional header fields (e.g. {"X-Key-Name": "key value"} or [{key: "X-Key-Name", value: "val1"}, {key: "X-Key-Name", value: "val2"}])
|
||||
*/
|
||||
headers?: any;
|
||||
/**
|
||||
* An array of attachment objects (see below for details)
|
||||
*/
|
||||
attachments?: AttachmentObject[];
|
||||
/**
|
||||
* An array of alternative text contents (in addition to text and html parts) (see below for details)
|
||||
*/
|
||||
alternatives?: AttachmentObject[];
|
||||
/**
|
||||
* optional Message-Id value, random value will be generated if not set
|
||||
*/
|
||||
messageId?: string;
|
||||
/**
|
||||
* optional Date value, current UTC string will be used if not set
|
||||
*/
|
||||
date?: Date;
|
||||
/**
|
||||
* optional transfer encoding for the textual parts (defaults to 'quoted-printable')
|
||||
*/
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
export interface SentMessageInfo {
|
||||
/**
|
||||
* most transports should return the final Message-Id value used with this property
|
||||
*/
|
||||
messageId: string;
|
||||
/**
|
||||
* includes the envelope object for the message
|
||||
*/
|
||||
envelope: any;
|
||||
/**
|
||||
* is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)
|
||||
*/
|
||||
accepted: string[];
|
||||
/**
|
||||
* is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)
|
||||
*/
|
||||
rejected: string[];
|
||||
/**
|
||||
* is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response
|
||||
*/
|
||||
pending?: string[];
|
||||
/**
|
||||
* is a string returned by SMTP transports and includes the last SMTP response from the server
|
||||
*/
|
||||
response: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is what you implement to create a new transporter yourself
|
||||
*/
|
||||
export interface Transport {
|
||||
name: string;
|
||||
version: string;
|
||||
send(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user