@aircall/http
Advanced tools
Comparing version 1.4.2 to 1.5.1
@@ -9,8 +9,3 @@ 'use strict'; | ||
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
// src/HttpService.ts | ||
@@ -41,3 +36,3 @@ // src/constants.ts | ||
} | ||
var _HttpService = class { | ||
var HttpService = class _HttpService { | ||
constructor(options) { | ||
@@ -69,2 +64,31 @@ this.options = options; | ||
} | ||
static getResponseLogPayload = (response) => { | ||
return { | ||
data: response.data, | ||
statusCode: response.status, | ||
headers: response.headers | ||
}; | ||
}; | ||
static getRequestLogPayload = (config) => { | ||
return { | ||
request_base_url: config.baseURL, | ||
request_body: config.data, | ||
request_headers: config.headers, | ||
request_method: config.method, | ||
request_params: config.params, | ||
request_path: config.url, | ||
retry_count: config.retryCount | ||
}; | ||
}; | ||
static getErrorLogPayload = (error) => { | ||
return { | ||
code: error.code, | ||
config: error.config, | ||
message: error.message, | ||
name: error.name, | ||
stack: error.stack, | ||
statusCode: error.response?.status, | ||
data: error.response?.data | ||
}; | ||
}; | ||
/** | ||
@@ -127,3 +151,3 @@ * Interceptor sending a logging action for each request. | ||
await onRetryAttempt(error); | ||
return await this.axiosInstance.request(error.config); | ||
return this.axiosInstance.request(error.config); | ||
} catch { | ||
@@ -152,32 +176,2 @@ return Promise.reject(error); | ||
}; | ||
var HttpService = _HttpService; | ||
__publicField(HttpService, "getResponseLogPayload", (response) => { | ||
return { | ||
data: response.data, | ||
statusCode: response.status, | ||
headers: response.headers | ||
}; | ||
}); | ||
__publicField(HttpService, "getRequestLogPayload", (config) => { | ||
return { | ||
request_base_url: config.baseURL, | ||
request_body: config.data, | ||
request_headers: config.headers, | ||
request_method: config.method, | ||
request_params: config.params, | ||
request_path: config.url, | ||
retry_count: config.retryCount | ||
}; | ||
}); | ||
__publicField(HttpService, "getErrorLogPayload", (error) => { | ||
return { | ||
code: error.code, | ||
config: error.config, | ||
message: error.message, | ||
name: error.name, | ||
stack: error.stack, | ||
statusCode: error.response?.status, | ||
data: error.response?.data | ||
}; | ||
}); | ||
@@ -184,0 +178,0 @@ exports.DEFAULT_DELAY = DEFAULT_DELAY; |
{ | ||
"name": "@aircall/http", | ||
"version": "1.4.2", | ||
"version": "1.5.1", | ||
"main": "dist/index.js", | ||
@@ -30,22 +30,22 @@ "module": "dist/index.mjs", | ||
"devDependencies": { | ||
"@aircall/test-sequencer": "1.0.0", | ||
"@aircall/tsconfig": "1.4.0", | ||
"@size-limit/preset-small-lib": "8.1.0", | ||
"@types/jest": "29.5.2", | ||
"axios-mock-adapter": "1.21.1", | ||
"jest": "29.5.0", | ||
"size-limit": "8.1.0", | ||
"ts-jest": "29.1.0", | ||
"axios-mock-adapter": "1.21.1", | ||
"@size-limit/preset-small-lib": "8.1.0", | ||
"eslint": "8.30.0", | ||
"@aircall/eslint-config": "1.2.5", | ||
"size-limit": "8.1.0", | ||
"@aircall/tsconfig": "1.3.1", | ||
"tsup": "6.7.0", | ||
"tslib": "2.4.0" | ||
"tslib": "2.4.0", | ||
"tsup": "7.1.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup --config ../../tsup.config.ts", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", | ||
"dev": "pnpm build --watch", | ||
"build": "tsup --config ../../tsup.config.ts", | ||
"test": "jest --passWithNoTests", | ||
"posttest": "pnpm run size", | ||
"lint": "eslint --ext ts src", | ||
"size": "size-limit" | ||
"size": "size-limit", | ||
"test:ci": "pnpm run test --testSequencer @aircall/test-sequencer/parallel-ci-sequencer.js --passWithNoTests", | ||
"test": "jest --passWithNoTests" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
19431
10
5
423