@sp-api-sdk/common
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -73,2 +73,3 @@ "use strict"; | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
method: true, | ||
@@ -79,2 +80,3 @@ url: true, | ||
headers: false, | ||
logger: console.info, | ||
...requestLoggerOptions, | ||
@@ -87,2 +89,3 @@ })); | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
status: true, | ||
@@ -93,7 +96,20 @@ statusText: false, | ||
headers: true, | ||
logger: console.info, | ||
...responseLoggerOptions, | ||
})); | ||
} | ||
if (logging?.error) { | ||
const errorLoggerOptions = logging.error === true ? undefined : logging.error; | ||
instance.interceptors.response.use((response) => response, async (error) => (0, axios_logger_1.errorLogger)(error, { | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
params: false, | ||
data: false, | ||
headers: true, | ||
logger: console.error, | ||
...errorLoggerOptions, | ||
})); | ||
} | ||
return { axios: instance, endpoint }; | ||
} | ||
exports.createAxiosInstance = createAxiosInstance; |
import axios from 'axios'; | ||
import { aws4Interceptor } from 'aws4-axios'; | ||
import axiosRetry from 'axios-retry'; | ||
import { requestLogger, responseLogger } from 'axios-logger'; | ||
import { requestLogger, responseLogger, errorLogger } from 'axios-logger'; | ||
import { sync as readPackageJson } from 'read-pkg-up'; | ||
@@ -69,2 +69,3 @@ import { SellingPartnerApiError } from './errors'; | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
method: true, | ||
@@ -75,2 +76,3 @@ url: true, | ||
headers: false, | ||
logger: console.info, | ||
...requestLoggerOptions, | ||
@@ -83,2 +85,3 @@ })); | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
status: true, | ||
@@ -89,6 +92,19 @@ statusText: false, | ||
headers: true, | ||
logger: console.info, | ||
...responseLoggerOptions, | ||
})); | ||
} | ||
if (logging?.error) { | ||
const errorLoggerOptions = logging.error === true ? undefined : logging.error; | ||
instance.interceptors.response.use((response) => response, async (error) => errorLogger(error, { | ||
prefixText: `sp-api-sdk/${region}`, | ||
dateFormat: 'isoDateTime', | ||
params: false, | ||
data: false, | ||
headers: true, | ||
logger: console.error, | ||
...errorLoggerOptions, | ||
})); | ||
} | ||
return { axios: instance, endpoint }; | ||
} |
import { type Method } from 'axios'; | ||
import { requestLogger, responseLogger } from 'axios-logger'; | ||
import { requestLogger, responseLogger, errorLogger } from 'axios-logger'; | ||
import type { SellingPartnerApiAuth } from '@sp-api-sdk/auth'; | ||
@@ -7,2 +7,3 @@ import { type SellingPartnerRegion } from './regions'; | ||
declare type ResponseLogConfig = Exclude<Parameters<typeof responseLogger>[1], undefined>; | ||
declare type ErrorLogConfig = Exclude<Parameters<typeof errorLogger>[1], undefined>; | ||
export interface RateLimit { | ||
@@ -30,2 +31,3 @@ urlRegex: RegExp; | ||
response?: ResponseLogConfig | true; | ||
error?: ErrorLogConfig | true; | ||
}; | ||
@@ -32,0 +34,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "Selling Parner API common library", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -32,7 +32,7 @@ "module": "dist/es/index.js", | ||
"dependencies": { | ||
"@sp-api-sdk/auth": "^1.9.13", | ||
"@sp-api-sdk/auth": "^1.9.14", | ||
"aws4-axios": "^2.4.9", | ||
"axios": "^0.27.2", | ||
"axios-logger": "^2.6.0", | ||
"axios-retry": "^3.2.4", | ||
"axios-retry": "^3.2.5", | ||
"read-pkg-up": "^7.0.1" | ||
@@ -62,3 +62,3 @@ }, | ||
], | ||
"gitHead": "975705017de9384bf28b85e97d93f866d4d71611" | ||
"gitHead": "15c172555c85ce89731cebb62eb7e23f550f9506" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17885
378
0
101
0
4
0
15
Updated@sp-api-sdk/auth@^1.9.14
Updatedaxios-retry@^3.2.5