diff --git a/README.md b/README.md index b3578f6b..eab47efe 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ npm i -s @scaleleap/selling-partner-api-sdk A few things to get started: -- [Registering as a developer](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-as-a-developer) -- [Registering your Selling Partner API application](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-your-selling-partner-api-application) -- [Authorizing Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#authorizing-selling-partner-api-applications) +- [Registering as a developer](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-as-a-developer) +- [Registering your Hybrid Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#hybrid-selling-partner-api-applications) +- [Authorizing Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#authorizing-selling-partner-api-applications) ### Basic Usage diff --git a/package-lock.json b/package-lock.json index 8850c47a..caa84f32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2925,6 +2925,15 @@ "uuid": "8.3.2" }, "dependencies": { + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dev": true, + "requires": { + "follow-redirects": "^1.14.0" + } + }, "tslib": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", @@ -4659,11 +4668,11 @@ } }, "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", "requires": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.14.4" } }, "babel-jest": { @@ -8215,9 +8224,9 @@ "dev": true }, "follow-redirects": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz", - "integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==" + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", + "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==" }, "for-in": { "version": "1.0.2", diff --git a/package.json b/package.json index 383e23a4..dcce4877 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "types": "lib/index.d.ts", "dependencies": { "aws4-axios": "2.4.3", - "axios": "0.21.4", + "axios": "0.24.0", "http-status-codes": "2.1.4", "ts-error": "1.0.6" }, diff --git a/src/helpers/api-client-helpers.ts b/src/helpers/api-client-helpers.ts index 702632a2..3484916a 100644 --- a/src/helpers/api-client-helpers.ts +++ b/src/helpers/api-client-helpers.ts @@ -40,7 +40,7 @@ export class ApiClientHelpers { axiosInstance = globalAxios.create({ headers: { 'user-agent': USER_AGENT, - 'x-amz-access-token': accessToken, + 'x-amz-access-token': accessToken ?? '', }, }) diff --git a/src/types/errors/selling-partner-api-errors.ts b/src/types/errors/selling-partner-api-errors.ts index 729becf2..43423824 100644 --- a/src/types/errors/selling-partner-api-errors.ts +++ b/src/types/errors/selling-partner-api-errors.ts @@ -1,4 +1,5 @@ /* eslint-disable max-classes-per-file */ +import { AxiosResponseHeaders } from 'axios' import { ExtendableError } from 'ts-error' export interface ModelErrorContainer { @@ -35,7 +36,7 @@ export class SellingPartnerGenericError extends ExtendableError { public requestId: string - public constructor(error: ModelError, headers: Headers) { + public constructor(error: ModelError, headers: AxiosResponseHeaders) { super(error.details) this.code = error.code @@ -53,7 +54,7 @@ export class SellingPartnerUnsupportedMediaTypeError extends SellingPartnerGener export class SellingPartnerTooManyRequestsError extends SellingPartnerGenericError { public rateLimit?: number - public constructor(error: ModelError, headers: Headers) { + public constructor(error: ModelError, headers: AxiosResponseHeaders) { super(error, headers) this.rateLimit = Number(headers['x-amzn-RateLimit-Limit']) ||