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

@vonage/server-client

Package Overview
Dependencies
Maintainers
51
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/server-client - npm Package Compare versions

Comparing version 1.10.2 to 1.10.3-0

28

dist/client.d.ts

@@ -39,2 +39,30 @@ import { Response } from 'node-fetch';

/**
* Adds API key and secret to the request body.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
protected addQueryKeySecretToRequestBody(request: VetchOptions): Promise<VetchOptions>;
/**
* Adds API key and secret to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
protected addQueryKeySecretToRequest(request: VetchOptions): Promise<VetchOptions>;
/**
* Adds a JWT to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
protected addJWTToRequest(request: VetchOptions): Promise<VetchOptions>;
/**
* Adds basic authentication headers to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
protected addBasicAuthToRequest(request: VetchOptions): Promise<VetchOptions>;
/**
* Sends a DELETE request to the specified URL.

@@ -41,0 +69,0 @@ *

68

dist/client.js

@@ -76,20 +76,18 @@ "use strict";

case enums_1.AuthenticationType.BASIC:
request.headers = Object.assign({}, request.headers, {
Authorization: await this.auth.createBasicHeader(),
});
return request;
return this.addBasicAuthToRequest(request);
case enums_1.AuthenticationType.JWT:
request.headers = Object.assign({}, request.headers, {
Authorization: await this.auth.createBearerHeader(),
});
return request;
return this.addJWTToRequest(request);
case enums_1.AuthenticationType.QUERY_KEY_SECRET:
return this.addQueryKeySecretToRequest(request);
default:
return this.addQueryKeySecretToRequestBody(request);
}
if (this.authType === enums_1.AuthenticationType.QUERY_KEY_SECRET) {
log(`adding parameters to query string`);
request.params = {
...(request.params ? request.params : {}),
...(await this.auth.getQueryParams({})),
};
return request;
}
}
/**
* Adds API key and secret to the request body.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
async addQueryKeySecretToRequestBody(request) {
if (typeof request.data === 'string') {

@@ -109,2 +107,40 @@ throw new Error('Cannot append auth parameters to body');

/**
* Adds API key and secret to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
async addQueryKeySecretToRequest(request) {
log(`adding parameters to query string`);
request.params = {
...(request.params ? request.params : {}),
...(await this.auth.getQueryParams({})),
};
return request;
}
/**
* Adds a JWT to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
async addJWTToRequest(request) {
request.headers = Object.assign({}, request.headers, {
Authorization: await this.auth.createBearerHeader(),
});
return request;
}
/**
* Adds basic authentication headers to the request.
*
* @param {VetchOptions} request - The request options to which authentication needs to be added.
* @return {VetchOptions} - The request options with the added authentication.
*/
async addBasicAuthToRequest(request) {
request.headers = Object.assign({}, request.headers, {
Authorization: await this.auth.createBasicHeader(),
});
return request;
}
/**
* Sends a DELETE request to the specified URL.

@@ -111,0 +147,0 @@ *

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@vonage/server-client",
"version": "1.10.2",
"version": "1.10.3-0",
"description": "The Vonage Server Client provides core functionalities for interacting with Vonage APIs, ensuring a standardized response regardless of the underlying HTTP adapter.",

@@ -6,0 +6,0 @@ "homepage": "https://developer.vonage.com",

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