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

@aircall/http

Package Overview
Dependencies
Maintainers
5
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aircall/http - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.5.2](https://gitlab.com/aircall/shared/front-end-modules/compare/@aircall/http@0.5.1...@aircall/http@0.5.2) (2022-06-07)
**Note:** Version bump only for package @aircall/http
## [0.5.1](https://gitlab.com/aircall/shared/front-end-modules/compare/@aircall/http@0.5.0...@aircall/http@0.5.1) (2022-01-05)

@@ -8,0 +16,0 @@

1

dist/constants.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_DELAY = exports.DEFAULT_MAX_RETRY = exports.INVALID_API_RESPONSE_MESSAGE = exports.ErrorCode = void 0;
var ErrorCode;

@@ -4,0 +5,0 @@ (function (ErrorCode) {

8

dist/HttpService.d.ts

@@ -18,5 +18,5 @@ import { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios';

getUrlFromConfig: (baseURL: string | undefined, url: string | undefined, httpLogType: HTTP_LOG_TYPE) => string | undefined;
static getResponseLogPayload: (response: AxiosResponse<any>) => ResponseLogPayload;
static getResponseLogPayload: (response: AxiosResponse) => ResponseLogPayload;
static getRequestLogPayload: (config: AxiosRequestConfig) => RequestLogPayload;
static getErrorLogPayload: (error: AxiosError<any>) => ErrorLogPayload;
static getErrorLogPayload: (error: AxiosError) => ErrorLogPayload;
/**

@@ -33,5 +33,5 @@ * Interceptor sending a logging action for each request.

*/
logErrorInterceptor: (error: AxiosError<any>) => Promise<AxiosError<any>>;
logErrorInterceptor: (error: AxiosError) => Promise<AxiosError>;
private getHttpRetryConfig;
retryStrategyInterceptor: (error: AxiosError<any>) => Promise<AxiosResponse<any>>;
retryStrategyInterceptor: (error: AxiosError) => Promise<AxiosResponse<any>>;
private handleResponse;

@@ -38,0 +38,0 @@ get<T = any>(path: string, config?: AxiosRequestConfig): Promise<T>;

@@ -79,3 +79,3 @@ "use strict";

if (delay > 0) {
await utils_1.sleep(delay);
await (0, utils_1.sleep)(delay);
}

@@ -82,0 +82,0 @@ await onRetryAttempt(error);

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const HttpService_1 = require("./HttpService");
__export(require("./constants"));
__exportStar(require("./constants"), exports);
__exportStar(require("./typing/HttpService"), exports);
exports.default = HttpService_1.default;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay));
exports.sleep = void 0;
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay));
exports.sleep = sleep;
//# sourceMappingURL=utils.js.map
{
"name": "@aircall/http",
"version": "0.5.1",
"version": "0.5.2",
"main": "dist/index.js",

@@ -14,10 +14,10 @@ "types": "dist/index.d.ts",

},
"gitHead": "fe0329386cf5102a736c2630e697302af4c196da",
"gitHead": "6b665d191566dcde97810d3a1567aa4576f3af5b",
"dependencies": {
"@aircall/logger": "^2.5.5",
"axios": "^0.21.1"
"@aircall/logger": "^2.5.6",
"axios": "^0.27.2"
},
"devDependencies": {
"axios-mock-adapter": "1.18.1"
"axios-mock-adapter": "1.21.1"
}
}

@@ -42,5 +42,5 @@ import axios, { AxiosError, AxiosRequestConfig } from 'axios';

it('should register a global "handleError" interceptor if provided in config', async () => {
const handleError: jest.Mocked<
HttpServiceOptions['handleError']
> = jest.fn().mockImplementation(error => Promise.reject(error));
const handleError: jest.Mocked<HttpServiceOptions['handleError']> = jest
.fn()
.mockImplementation(error => Promise.reject(error));
const data = { message: 'error message' };

@@ -67,5 +67,5 @@ const status = 400;

it('should correctly handle successfull requests when the global "handleError" interceptor is registered', async () => {
const handleError: jest.Mocked<
HttpServiceOptions['handleError']
> = jest.fn().mockImplementation(error => Promise.reject(error));
const handleError: jest.Mocked<HttpServiceOptions['handleError']> = jest
.fn()
.mockImplementation(error => Promise.reject(error));
const data = { message: 'message' };

@@ -268,5 +268,5 @@ const status = 200;

const service = new HttpService({ apiBaseUrl: BASE_URL, retryStrategy, logger });
const error =
{ config: { method: 'get', retryCount: undefined } } as
AxiosError & { config: AxiosRequestConfig & { retryCount?: number } };
const error = { config: { method: 'get', retryCount: undefined } } as AxiosError & {
config: AxiosRequestConfig & { retryCount?: number };
};

@@ -285,9 +285,9 @@ service.retryStrategyInterceptor(error).catch(errorInt => {

const service = new HttpService({ apiBaseUrl: BASE_URL, retryStrategy, logger });
const error =
{ config: { method: 'get', retryCount: undefined } } as
AxiosError & { config: AxiosRequestConfig & { retryCount?: number } };
const error = { config: { method: 'get', retryCount: undefined } } as AxiosError & {
config: AxiosRequestConfig & { retryCount?: number };
};
service.retryStrategyInterceptor(error).catch(() => {
expect(retryStrategy.onRetryAttempt).toHaveBeenCalledTimes(1);
expect(retryStrategy.retryCondition).toHaveBeenCalledTimes(1);
expect(retryStrategy.onRetryAttempt).toHaveBeenCalledTimes(3);
expect(retryStrategy.retryCondition).toHaveBeenCalledTimes(4);
expect(error.config.retryCount).toBe(1);

@@ -303,5 +303,5 @@ done();

const service = new HttpService({ apiBaseUrl: BASE_URL, retryStrategy, logger });
const error =
{ config: { method: 'get', retryCount: 3 } } as
AxiosError & { config: AxiosRequestConfig & { retryCount?: number } };
const error = { config: { method: 'get', retryCount: 3 } } as AxiosError & {
config: AxiosRequestConfig & { retryCount?: number };
};

@@ -319,5 +319,5 @@ service.retryStrategyInterceptor(error).catch(() => {

const service = new HttpService({ apiBaseUrl: BASE_URL, retryStrategy, logger });
const error =
{ config: { method: 'get', retryCount: 0 } } as
AxiosError & { config: AxiosRequestConfig & { retryCount?: number } };
const error = { config: { method: 'get', retryCount: 0 } } as AxiosError & {
config: AxiosRequestConfig & { retryCount?: number };
};

@@ -324,0 +324,0 @@ service.retryStrategyInterceptor(error).catch(errorInt => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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