Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sendgrid/client

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/client - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

4

package.json
{
"name": "@sendgrid/client",
"description": "Twilio SendGrid NodeJS API client",
"version": "8.0.0",
"version": "8.1.0",
"author": "Twilio SendGrid <help@twilio.com> (sendgrid.com)",

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

],
"gitHead": "b1c831ff33b848e09f9afc644426fd22615f51bd"
"gitHead": "2d4d51214d63961d3138421c297790b479c12c26"
}

@@ -17,3 +17,8 @@ 'use strict';

const TWILIO_BASE_URL = 'https://email.twilio.com/';
const SENDGRID_REGION = 'global';
// Initialize the allowed regions and their corresponding hosts
const REGION_HOST_MAP = {
eu: 'https://api.eu.sendgrid.com/',
global: 'https://api.sendgrid.com/',
};
class Client {

@@ -23,2 +28,3 @@ constructor() {

this.impersonateSubuser = '';
this.sendgrid_region = SENDGRID_REGION;

@@ -43,3 +49,3 @@ this.defaultHeaders = {

this.auth = 'Bearer ' + apiKey;
this.setDefaultRequest('baseUrl', SENDGRID_BASE_URL);
this.setDefaultRequest('baseUrl', REGION_HOST_MAP[this.sendgrid_region]);

@@ -100,2 +106,17 @@ if (!this.isValidApiKey(apiKey)) {

/**
* Global is the default residency (or region)
* Global region means the message will be sent through https://api.sendgrid.com
* EU region means the message will be sent through https://api.eu.sendgrid.com
**/
setDataResidency(region) {
if (!REGION_HOST_MAP.hasOwnProperty(region)) {
console.warn('Region can only be "global" or "eu".');
} else {
this.sendgrid_region = region;
this.setDefaultRequest('baseUrl', REGION_HOST_MAP[region]);
}
return this;
}
createHeaders(data) {

@@ -102,0 +123,0 @@ // Merge data with default headers.

@@ -34,2 +34,7 @@ import {ResponseError} from "@sendgrid/helpers/classes";

/**
* Sets the data residency as per region provided
*/
setDataResidency(region: string): this;
/**
* Create headers for request

@@ -36,0 +41,0 @@ */

Sorry, the diff of this file is too big to display

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