@aircall/http
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -6,2 +6,6 @@ # Change Log | ||
## [0.6.1](https://gitlab.com/aircall/shared/front-end-modules/compare/@aircall/http@0.6.0...@aircall/http@0.6.1) (2023-01-13) | ||
**Note:** Version bump only for package @aircall/http | ||
# [0.6.0](https://gitlab.com/aircall/shared/front-end-modules/compare/@aircall/http@0.5.8...@aircall/http@0.6.0) (2023-01-05) | ||
@@ -8,0 +12,0 @@ |
@@ -1,5 +0,2 @@ | ||
"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; | ||
export var ErrorCode; | ||
(function (ErrorCode) { | ||
@@ -10,7 +7,7 @@ // Default message for unparsable Api error response | ||
ErrorCode[ErrorCode["UNAUTHORIZED_API_RESPONSE_CODE"] = 401] = "UNAUTHORIZED_API_RESPONSE_CODE"; | ||
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); | ||
exports.INVALID_API_RESPONSE_MESSAGE = 'An internal error occured'; | ||
exports.DEFAULT_MAX_RETRY = 3; | ||
})(ErrorCode || (ErrorCode = {})); | ||
export const INVALID_API_RESPONSE_MESSAGE = 'An internal error occured'; | ||
export const DEFAULT_MAX_RETRY = 3; | ||
// Delay of 300ms will be applied between each retry | ||
exports.DEFAULT_DELAY = 300; | ||
export const DEFAULT_DELAY = 300; | ||
//# sourceMappingURL=constants.js.map |
@@ -1,6 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const axios_1 = require("axios"); | ||
const constants_1 = require("./constants"); | ||
const utils_1 = require("./utils"); | ||
import axios from 'axios'; | ||
import { DEFAULT_DELAY, DEFAULT_MAX_RETRY } from './constants'; | ||
import { sleep } from './utils'; | ||
const namespace = 'http-retry'; | ||
@@ -73,3 +71,3 @@ /* istanbul ignore next */ | ||
const { config } = error; | ||
const { onRetryAttempt = noop, retryCondition = defaultRetryCondition, maxRetry = constants_1.DEFAULT_MAX_RETRY, delay = constants_1.DEFAULT_DELAY } = this.getHttpRetryConfig(retryStrategy, config); | ||
const { onRetryAttempt = noop, retryCondition = defaultRetryCondition, maxRetry = DEFAULT_MAX_RETRY, delay = DEFAULT_DELAY } = this.getHttpRetryConfig(retryStrategy, config); | ||
config.retryCount = (_a = config.retryCount) !== null && _a !== void 0 ? _a : 0; | ||
@@ -82,3 +80,3 @@ const shouldRetry = retryCondition(error) && config.retryCount < maxRetry; | ||
if (delayDuration > 0) { | ||
await (0, utils_1.sleep)(delayDuration); | ||
await sleep(delayDuration); | ||
} | ||
@@ -104,3 +102,3 @@ await onRetryAttempt(error); | ||
*/ | ||
this.setAxiosInstance(axios_1.default.create({ | ||
this.setAxiosInstance(axios.create({ | ||
adapter: adapter ? adapter : undefined, | ||
@@ -179,3 +177,3 @@ baseURL: apiBaseUrl, | ||
}; | ||
exports.default = HttpService; | ||
export default HttpService; | ||
//# sourceMappingURL=HttpService.js.map |
@@ -1,21 +0,5 @@ | ||
"use strict"; | ||
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"); | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./typing/HttpService"), exports); | ||
exports.default = HttpService_1.default; | ||
import HttpService from './HttpService'; | ||
export * from './constants'; | ||
export * from './typing/HttpService'; | ||
export default HttpService; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=HttpService.js.map |
@@ -1,6 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sleep = void 0; | ||
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay)); | ||
exports.sleep = sleep; | ||
export const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay)); | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@aircall/http", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"main": "dist/index.js", | ||
@@ -14,5 +14,5 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "f56e14dde828c80b6d68afaa1f56972a669249a6", | ||
"gitHead": "8b834c28bfd294b3c6094b1b3103f033cd57f227", | ||
"dependencies": { | ||
"@aircall/logger": "^2.8.2", | ||
"@aircall/logger": "^2.8.3", | ||
"axios": "^0.27.2" | ||
@@ -19,0 +19,0 @@ }, |
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
47309
860
Updated@aircall/logger@^2.8.3