@sendgrid/helpers
Advanced tools
Comparing version 6.5.5 to 7.0.0
@@ -55,3 +55,3 @@ 'use strict'; | ||
throw new Error( | ||
`The props 'content' and 'filePath' cannot be used together.` | ||
"The props 'content' and 'filePath' cannot be used together." | ||
); | ||
@@ -83,4 +83,3 @@ } | ||
return; | ||
} | ||
else if (content instanceof Buffer && content.toString !== undefined) { | ||
} else if (content instanceof Buffer && content.toString !== undefined) { | ||
this.content = content.toString(); | ||
@@ -87,0 +86,0 @@ |
@@ -90,3 +90,3 @@ 'use strict'; | ||
contentId: 'myattachment', | ||
filePath: path.resolve(path.join(__dirname, '/attachment.js')), | ||
filePath: path.join(__dirname, '/attachment.js'), | ||
}); | ||
@@ -93,0 +93,0 @@ |
@@ -5,2 +5,3 @@ import Attachment from "@sendgrid/helpers/classes/attachment"; | ||
import Personalization from "@sendgrid/helpers/classes/personalization"; | ||
import Response from "@sendgrid/helpers/classes/response"; | ||
import ResponseError from "@sendgrid/helpers/classes/response-error"; | ||
@@ -13,3 +14,4 @@ | ||
Personalization, | ||
Response, | ||
ResponseError, | ||
} | ||
} |
@@ -10,2 +10,3 @@ 'use strict'; | ||
const Personalization = require('./personalization'); | ||
const Response = require('./response'); | ||
const ResponseError = require('./response-error'); | ||
@@ -22,4 +23,5 @@ const Statistics = require('./statistics'); | ||
Personalization, | ||
Response, | ||
ResponseError, | ||
Statistics, | ||
}; |
@@ -95,4 +95,3 @@ 'use strict'; | ||
this.setDynamicTemplateData(dynamicTemplateData); | ||
} | ||
else { | ||
} else { | ||
this.setSubstitutions(substitutions); | ||
@@ -109,11 +108,7 @@ this.setSubstitutionWrappers(substitutionWrappers); | ||
this.setPersonalizations(personalizations); | ||
} | ||
//Multiple individual emails | ||
else if (isMultiple && Array.isArray(to)) { | ||
} else if (isMultiple && Array.isArray(to)) { | ||
//Multiple individual emails | ||
to.forEach(to => this.addTo(to, cc, bcc)); | ||
} | ||
//Single email (possibly with multiple recipients in the to field) | ||
else { | ||
} else { | ||
//Single email (possibly with multiple recipients in the to field) | ||
this.addTo(to, cc, bcc); | ||
@@ -252,4 +247,3 @@ } | ||
delete personalization.substitutions; | ||
} | ||
else if (!this.isDynamic && personalization.dynamicTemplateData) { | ||
} else if (!this.isDynamic && personalization.dynamicTemplateData) { | ||
delete personalization.dynamicTemplateData; | ||
@@ -266,4 +260,3 @@ } | ||
this.applyDynamicTemplateData(personalization); | ||
} | ||
else { | ||
} else { | ||
this.applySubstitutions(personalization); | ||
@@ -270,0 +263,0 @@ } |
@@ -125,25 +125,25 @@ 'use strict'; | ||
expect(mail.toJSON()).to.deep.equal({ | ||
'content': [ | ||
content: [ | ||
{ | ||
'type': 'text/plain', | ||
'value': 'test', | ||
type: 'text/plain', | ||
value: 'test', | ||
}, | ||
], | ||
'from': { | ||
'email': 'test@example.com', | ||
from: { | ||
email: 'test@example.com', | ||
}, | ||
'personalizations': [ | ||
personalizations: [ | ||
{ | ||
'dynamic_template_data': { | ||
'test1': 'Test 1', | ||
'test2': 'Testy 2', | ||
'test3': 'Testy 3', | ||
dynamic_template_data: { | ||
test1: 'Test 1', | ||
test2: 'Testy 2', | ||
test3: 'Testy 3', | ||
}, | ||
'headers': { | ||
headers: { | ||
'test-header': 'test', | ||
}, | ||
'to': [ | ||
to: [ | ||
{ | ||
'email': 'test@example.com', | ||
'name': '', | ||
email: 'test@example.com', | ||
name: '', | ||
}, | ||
@@ -153,4 +153,4 @@ ], | ||
], | ||
'subject': 'test', | ||
'template_id': 'd-df80613cccc6441ea5cd7c95377bc1ef', | ||
subject: 'test', | ||
template_id: 'd-df80613cccc6441ea5cd7c95377bc1ef', | ||
}); | ||
@@ -162,3 +162,3 @@ }); | ||
describe('dynamic template handlebars substitutions', () => { | ||
let logSpy, data; | ||
let logSpy; let data; | ||
@@ -165,0 +165,0 @@ beforeEach(() => { |
@@ -22,8 +22,8 @@ 'use strict'; | ||
//Extract data from response | ||
const {headers, statusCode, statusMessage, body} = response; | ||
const {headers, status, statusText, data} = response; | ||
//Set data | ||
this.code = statusCode; | ||
this.message = statusMessage; | ||
this.response = {headers, body}; | ||
this.code = status; | ||
this.message = statusText; | ||
this.response = {headers, body: data}; | ||
@@ -30,0 +30,0 @@ //Capture stack trace |
@@ -100,4 +100,3 @@ 'use strict'; | ||
this.aggregatedBy = aggregatedBy; | ||
} | ||
else { | ||
} else { | ||
throw new Error('Incorrect value for `aggregatedBy`'); | ||
@@ -104,0 +103,0 @@ } |
@@ -7,3 +7,3 @@ const DYNAMIC_TEMPLATE_CHAR_WARNING = ` | ||
module.exports = { | ||
DYNAMIC_TEMPLATE_CHAR_WARNING | ||
DYNAMIC_TEMPLATE_CHAR_WARNING, | ||
}; |
@@ -25,8 +25,6 @@ 'use strict'; | ||
Object.assign(output, { [key]: data[key] }); | ||
} | ||
else { | ||
} else { | ||
output[key] = mergeDeep(base[key], data[key]); | ||
} | ||
} | ||
else { | ||
} else { | ||
Object.assign(output, { [key]: data[key] }); | ||
@@ -33,0 +31,0 @@ } |
@@ -25,7 +25,5 @@ 'use strict'; | ||
merged[key] = data[key]; | ||
} | ||
else if (data[key] && typeof data[key] === 'object') { | ||
} else if (data[key] && typeof data[key] === 'object') { | ||
merged[key] = Object.assign({}, data[key]); | ||
} | ||
else { | ||
} else if (data[key]) { | ||
merged[key] = data[key]; | ||
@@ -32,0 +30,0 @@ } |
{ | ||
"name": "@sendgrid/helpers", | ||
"description": "Twilio SendGrid NodeJS internal helpers", | ||
"version": "6.5.5", | ||
"version": "7.0.0", | ||
"author": "Twilio SendGrid <dx@sendgrid.com> (sendgrid.com)", | ||
@@ -36,3 +36,3 @@ "contributors": [ | ||
}, | ||
"gitHead": "bc3e7371aa73af6c2b53128d6866837b0a60df65" | ||
"gitHead": "ae1148c025261fc831def208782a6e94e0c19138" | ||
} |
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
133033
83
4440