Socket
Socket
Sign inDemoInstall

@sendgrid/helpers

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/helpers - npm Package Compare versions

Comparing version 7.4.6 to 7.5.0

8

classes/mail.d.ts

@@ -158,2 +158,4 @@ import {AttachmentData, AttachmentJSON} from "./attachment";

hideWarnings?: boolean,
replyToList?: EmailJSON | EmailJSON[],
}

@@ -183,2 +185,3 @@

ip_pool_name?: string;
reply_to_list?: EmailJSON[];
}

@@ -358,2 +361,7 @@

static create(data: MailData[]): Mail[];
/**
* Set reply_to_list header from given data
*/
setReplyToList(replyToList: EmailJSON[]): void;
}

20

classes/mail.js

@@ -71,3 +71,3 @@ 'use strict';

trackingSettings, substitutions, substitutionWrappers, dynamicTemplateData, isMultiple,
hideWarnings,
hideWarnings, replyToList,
} = data;

@@ -94,2 +94,3 @@

this.setHideWarnings(hideWarnings);
this.setReplyToList(replyToList);

@@ -509,3 +510,3 @@ if (this.isDynamic) {

sections, headers, categories, customArgs, mailSettings,
trackingSettings,
trackingSettings, replyToList,
} = this;

@@ -566,2 +567,5 @@

}
if(typeof replyToList !== 'undefined') {
json.replyToList = replyToList;
}

@@ -674,2 +678,14 @@ //Return as snake cased object

}
/**
* Set the replyToList from email body
*/
setReplyToList(replyToList) {
if (this._doArrayCheck('replyToList', replyToList) && replyToList.length) {
if (!replyToList.every(replyTo => replyTo && typeof replyTo.email === 'string')) {
throw new Error('Expected each replyTo to contain an `email` string');
}
this.replyToList = replyToList;
}
}
}

@@ -676,0 +692,0 @@

@@ -249,2 +249,60 @@ 'use strict';

});
describe('set replyToList to set multiple reply-to', () => {
let data;
this.beforeEach(() => {
data = {
to: 'send-to@example.org',
from: 'sender@example.org',
subject: 'test replyToList',
category: 'test',
text: 'Testing replyToList settings',
html: '<p>Testing replyToList settings</p>',
};
});
it('should set the replyToList', () => {
let replyToList = [
{
'name': 'Test User1',
'email': 'test_user1@example.org'
},
{
'email': 'test_user2@example.org'
}
];
data.replyToList = replyToList;
const mail = new Mail(data);
expect(mail.replyToList)
.to.be.deep.equal(replyToList);
});
it('should throw error for incorrect replyToList format', () => {
let replyToList = [
{
'name': 'Test User1'
},
{
'email_data': 'test_user2@example.org'
}
];
data.replyToList = replyToList;
expect(() => new Mail(data))
.to.throw('Expected each replyTo to contain an `email` string');
});
it('should throw error for as replyToList is not an array', () => {
let replyToList = {
'name': 'Test User1',
'email': 'test_user1@example.org'
};
data.replyToList = replyToList;
expect(() => new Mail(data))
.to.throw('Array expected for`replyToList`');
});
});
});

4

package.json
{
"name": "@sendgrid/helpers",
"description": "Twilio SendGrid NodeJS internal helpers",
"version": "7.4.6",
"version": "7.5.0",
"author": "Twilio SendGrid <help@twilio.com> (sendgrid.com)",

@@ -35,3 +35,3 @@ "contributors": [

},
"gitHead": "1843e8689bd850b60e4550443fdf8722a51c7c68"
"gitHead": "a3307fda9318973ef9410f604a4d117ff7548e24"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc