From d18d95d1c39b07585880c72af6ba797484ba878a Mon Sep 17 00:00:00 2001 From: Robert Rossmann Date: Wed, 5 Dec 2018 16:44:42 +0100 Subject: [PATCH] feat(nodemailer): add typings --- packages/nodemailer/src/index.d.ts | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 packages/nodemailer/src/index.d.ts diff --git a/packages/nodemailer/src/index.d.ts b/packages/nodemailer/src/index.d.ts new file mode 100644 index 0000000..74573fc --- /dev/null +++ b/packages/nodemailer/src/index.d.ts @@ -0,0 +1,56 @@ +declare module '@atlas.js/nodemailer' { + import * as nodemailer from 'nodemailer' + import AtlasService from '@atlas.js/service' + + /** + * Send emails using nodemailer from within Atlas + */ + class Service extends AtlasService { + /** Service runtime configuration values */ + config: Service.Config + + prepare(): Promise + start(service: nodemailer.Transporter): Promise + stop(service: nodemailer.Transporter): Promise + } + + namespace Service { + /** Configuration schema available to this service */ + interface Config { + /** + * The transport to be used for sending emails + * + * Either provide the transport module itself or specify it as a string and it will be + * `require()`d. + */ + transport: Function | string + /** + * Transport-specific options + * + * Check the docs for the transporter you are going to use for available options. + */ + options: object + + plugins?: Array + } + + interface PluginConfiguration { + /** + * The plugin to be added to the transporter + * + * Either provide the plugin module itself or specify it as a string and it will be + * `require()`d. + */ + plugin: Function | string + /** Event to which this plugin should be attached */ + event: 'compile' | 'stream' + /** Plugin configuration options */ + options: object + } + } + + export { + Service, + nodemailer, + } +}