@types/email-templates
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -6,19 +6,95 @@ // Type definitions for node-email-templates 6.0 | ||
// Jacob Copeland <https://github.com/blankstar85> | ||
// Vesa Poikajärvi <https://github.com/vesse> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 3.3 | ||
interface EmailConfig { | ||
/// <reference types="nodemailer"/> | ||
/// <reference types="html-to-text"/> | ||
import JSONTransport = require('nodemailer/lib/json-transport'); | ||
import Mail = require('nodemailer/lib/mailer'); | ||
import SendmailTransport = require('nodemailer/lib/sendmail-transport'); | ||
import SESTransport = require('nodemailer/lib/ses-transport'); | ||
import SMTPPool = require('nodemailer/lib/smtp-pool'); | ||
import SMTPTransport = require('nodemailer/lib/smtp-transport'); | ||
import StreamTransport = require('nodemailer/lib/stream-transport'); | ||
// email-templates accepts nodemailer.createTransport options directly | ||
// too and calls createTransport if given a non-function, thus a lot | ||
// of different types accepted for transport | ||
type NodeMailerTransportOptions = | ||
Mail | | ||
SMTPPool | SMTPPool.Options | | ||
SendmailTransport | SendmailTransport.Options | | ||
StreamTransport | StreamTransport.Options | | ||
JSONTransport | JSONTransport.Options | | ||
SESTransport | SESTransport.Options | | ||
SMTPTransport | SMTPTransport.Options | | ||
string; | ||
// No typedef for https://github.com/niftylettuce/preview-email | ||
interface PreviewEmailOpts { | ||
/** | ||
* a path to a directory for saving the generated email previews (defaults to os.tmpdir() | ||
*/ | ||
dir?: string; | ||
/** | ||
* https://github.com/sindresorhus/open | ||
*/ | ||
open?: any; | ||
/** | ||
* a unique ID for the file name created for the preview in dir (defaults to uuid.v4() from uuid) | ||
*/ | ||
id?: string; | ||
/** | ||
* a file path to a pug template file (defaults to preview-email's template.pug by default) | ||
*/ | ||
template?: string; | ||
} | ||
interface ViewOptions { | ||
/** | ||
* View extansion. defaults to 'pug', and is the default file extension for templates | ||
*/ | ||
extension?: string; | ||
/** | ||
* a template file extension mapping, defaults to { hbs: 'handlebars', njk: 'nunjucks' } | ||
* (this is useful if you use different file extension naming conventions) | ||
*/ | ||
map?: any; | ||
/** | ||
* the default template engine source, defaults to consolidate | ||
*/ | ||
engineSource?: any; | ||
} | ||
interface View { | ||
/** | ||
* View root. Defaults to the current working directory's "emails" folder via path.resolve('emails') | ||
*/ | ||
root: string; | ||
options?: ViewOptions; | ||
} | ||
interface EmailConfig<T = any> { | ||
/** | ||
* The message <Nodemailer.com/message/> | ||
*/ | ||
message: any; | ||
message: Mail.Options; | ||
/** | ||
* The nodemailer Transport created via nodemailer.createTransport | ||
*/ | ||
transport?: any; | ||
transport?: NodeMailerTransportOptions; | ||
/** | ||
* The email template directory and engine information | ||
*/ | ||
views?: any; | ||
views?: View; | ||
/** | ||
* Do you really want to send, false for test or development | ||
* Do you really want to send, false for test or development | ||
*/ | ||
@@ -29,3 +105,3 @@ send?: boolean; | ||
*/ | ||
preview?: boolean; | ||
preview?: boolean|PreviewEmailOpts; | ||
/** | ||
@@ -38,3 +114,3 @@ * Set to object to configure and Enable <https://github.com/ladjs/il8n> | ||
*/ | ||
render?: (view: string, locals: any) => Promise<any>; | ||
render?: (view: string, locals: T) => Promise<any>; | ||
/** | ||
@@ -46,4 +122,6 @@ * force text-only rendering of template (disregards template folder) | ||
* <Https://github.com/werk85/node-html-to-text> | ||
* | ||
* configuration object for html-to-text | ||
*/ | ||
htmlToText?: any; | ||
htmlToText?: HtmlToTextOptions|false; | ||
/** | ||
@@ -53,3 +131,3 @@ * You can pass an option to prefix subject lines with a string | ||
*/ | ||
subjectPrefix?: any; | ||
subjectPrefix?: string|false; | ||
/** | ||
@@ -65,3 +143,3 @@ * <https://github.com/Automattic/juice> | ||
interface EmailOptions { | ||
interface EmailOptions<T = any> { | ||
/** | ||
@@ -73,11 +151,13 @@ * The template name | ||
* Nodemailer Message <Nodemailer.com/message/> | ||
* | ||
* Overrides what is given for constructor | ||
*/ | ||
message: any; | ||
message: Mail.Options; | ||
/** | ||
* The Template Variables | ||
*/ | ||
locals: any; | ||
locals: T; | ||
} | ||
declare class EmailTemplate { | ||
declare class EmailTemplate<T = any> { | ||
constructor(config: EmailConfig); | ||
@@ -94,28 +174,28 @@ /** | ||
*/ | ||
render(view: string, locals: any): Promise<string>; | ||
render(view: string, locals: T): Promise<string>; | ||
/** | ||
* Send the Email | ||
*/ | ||
send(options: EmailOptions): any; | ||
send(options: EmailOptions<T>): any; | ||
} | ||
declare namespace EmailTemplate { | ||
/** | ||
* shorthand use of `juiceResources` with the config | ||
* mainly for custom renders like from a database). | ||
*/ | ||
function juiceResources(html: string): Promise<string> ; | ||
/** | ||
* shorthand use of `juiceResources` with the config | ||
* mainly for custom renders like from a database). | ||
*/ | ||
function juiceResources(html: string): Promise<string> ; | ||
/** | ||
* | ||
* @param view The Html pug to render | ||
* @param locals The template Variables | ||
*/ | ||
function render(view: string, locals: any): Promise<string>; | ||
/** | ||
* | ||
* @param view The Html pug to render | ||
* @param locals The template Variables | ||
*/ | ||
function render(view: string, locals: any): Promise<string>; | ||
/** | ||
* Send the Email | ||
*/ | ||
function send(options: EmailOptions): any; | ||
/** | ||
* Send the Email | ||
*/ | ||
function send(options: EmailOptions): any; | ||
} | ||
export = EmailTemplate; |
{ | ||
"name": "@types/email-templates", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "TypeScript definitions for node-email-templates", | ||
@@ -21,6 +21,11 @@ "license": "MIT", | ||
"githubUsername": "blankstar85" | ||
}, | ||
{ | ||
"name": "Vesa Poikajärvi", | ||
"url": "https://github.com/vesse", | ||
"githubUsername": "vesse" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -32,5 +37,8 @@ "type": "git", | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "15c07ca1131c17df84ccb58bf95f82b12fc03dc42c677eb78ae27baa68f2347a", | ||
"typeScriptVersion": "2.0" | ||
"dependencies": { | ||
"@types/html-to-text": "*", | ||
"@types/nodemailer": "*" | ||
}, | ||
"typesPublisherContentHash": "b24fbb893e0317c0d82637dce10369654db80122af432df4b18f41e1ad8dcc6d", | ||
"typeScriptVersion": "3.3" | ||
} |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/email-templates | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/email-templates. | ||
Additional Details | ||
* Last updated: Mon, 12 Aug 2019 20:44:37 GMT | ||
* Dependencies: none | ||
### Additional Details | ||
* Last updated: Fri, 15 Nov 2019 20:19:24 GMT | ||
* Dependencies: [@types/nodemailer](https://npmjs.com/package/@types/nodemailer), [@types/html-to-text](https://npmjs.com/package/@types/html-to-text) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Cyril Schumacher <https://github.com/cyrilschumacher>, Matus Gura <https://github.com/gurisko>, and Jacob Copeland <https://github.com/blankstar85>. | ||
These definitions were written by Cyril Schumacher (https://github.com/cyrilschumacher), Matus Gura (https://github.com/gurisko), Jacob Copeland (https://github.com/blankstar85), and Vesa Poikajärvi (https://github.com/vesse). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8703
175
2
+ Added@types/html-to-text@*
+ Added@types/nodemailer@*
+ Added@types/html-to-text@9.0.4(transitive)
+ Added@types/node@22.9.0(transitive)
+ Added@types/nodemailer@6.4.16(transitive)
+ Addedundici-types@6.19.8(transitive)