-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#175168739] Common utilities for mailing #112
Conversation
@@ -23,7 +23,7 @@ | |||
"@types/helmet": "^0.0.40", | |||
"@types/jest": "^24.0.13", | |||
"@types/node": "10.14.1", | |||
"@types/nodemailer": "^4.6.2", | |||
"@types/nodemailer": "^6.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine as we are already using this version in our applications
Affected stories
New dependencies added: nodemailer-sendgridAuthor: Andris Reinman Description: SendGrid transport object for Nodemailer. Homepage: http://npmjs.com/package/nodemailer-sendgrid
|
Created | about 4 years ago |
Last Updated | about 2 months ago |
License | MIT |
Maintainers | 1 |
Releases | 33 |
Direct Dependencies | @types/node and form-data |
README
Installation
npm install --save @types/node-fetch
Summary
This package contains type definitions for node-fetch (https://github.com/bitinn/node-fetch).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch.
Additional Details
- Last updated: Thu, 23 Apr 2020 19:30:58 GMT
- Dependencies: @types/form-data, @types/node
- Global values: none
Credits
These definitions were written by Torsten Werner, Niklas Lindgren, Vinay Bedre, Antonio Román, Andrew Leedham, Jason Li, Brandon Wilson, Steve Faulkner, ExE Boss, Alex Savin, Alexis Tyler, and Jakub Kisielewski.
@types/nodemailer-sendgrid
Author: Unknown
Description: TypeScript definitions for nodemailer-sendgrid
Homepage: http://npmjs.com/package/@types/nodemailer-sendgrid
Created | 4 months ago |
Last Updated | about 2 months ago |
License | MIT |
Maintainers | 1 |
Releases | 1 |
Direct Dependencies | @types/nodemailer |
README
Installation
npm install --save @types/nodemailer-sendgrid
Summary
This package contains type definitions for nodemailer-sendgrid (https://github.com/nodemailer/nodemailer-sendgrid).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer-sendgrid.
Additional Details
- Last updated: Tue, 23 Jun 2020 19:07:37 GMT
- Dependencies: @types/nodemailer
- Global values: none
Credits
These definitions were written by Luke Jones.
src/mailer/index.ts
Outdated
const abortableFetch = AbortableFetch(agent.getHttpsFetch(process.env)); | ||
const fetchWithTimeout = setFetchTimeout( | ||
DEFAULT_EMAIL_REQUEST_TIMEOUT_MS as Millisecond, | ||
abortableFetch | ||
); | ||
const fetchAgent = toFetch(fetchWithTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, as this we're accessing process.env
here, this (fetch) should be configured in the caller and removed from this module but passed as a parameter to getMailerTransporter
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
==========================================
+ Coverage 86.50% 86.56% +0.06%
==========================================
Files 32 70 +38
Lines 1000 1020 +20
Branches 92 86 -6
==========================================
+ Hits 865 883 +18
- Misses 133 134 +1
- Partials 2 3 +1
Continue to review full report at Codecov.
|
// exclude a specific value from a type | ||
// as strict equality is performed, allowed input types are constrained to be values not references (object, arrays, etc) | ||
// tslint:disable-next-line max-union-size | ||
export const AnyBut = <A extends string | number | boolean | symbol, O = A>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this belongs to io-ts-commons, but at least, can we move it into ustils/types.ts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not do it because I didn't stress AnyBut
enough to make it a general-purpose utility. It is performing good for this specific case, but I'm afraid it might not be the same in other contexts.
why draft? |
[#175225851] Mailer integration tests (#113)
Collect mail utilities and groups them under a unique submodule of
io-functons-commons
. The idea is to have a single, shared entrypoint applications can call and setup by just pour their configuration in it.The PR is in draft as I'd like to make some integration tests.
Design
Everything regarding email is now under the
/mailer
folder. There are no outbound dependency references, so the folder may be even moved in a module on its own.The folder has a
index.ts
entrypoint which is ideally the only file users want to refer. Inner references worth to the user are proxied by the index module itself.Every reference to
nodemailer
has been confined into themailer/transports
file.Mailer's env configuration decoder is exposed and user applications may want to extend their config with that.
Usage
Breaking changes
When upgrading to a version of
io-functions-commons
which introduces this changes, please take note of the following:getMailerTransporter
's dutyutils/nodemailer
is removed, most of its functionalities are now inmailer/transports
utils/email
is removed, its only function (sendMail
) has been included intomailer/transports
sendMail
used to return aPromise<Either<Error, MailInfo>>
, now it's aTaskEither<Error, MailInfo>
utils/multi_transport_connection
andutils/mailup
have both been moved into/mailer