@sp-api-sdk/catalog-items-api-2020-12-01
Advanced tools
Comparing version 1.8.2 to 1.8.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CatalogItemsApiClient = exports.RATE_LIMITS = void 0; | ||
exports.CatalogItemsApiClient = exports.clientRateLimits = void 0; | ||
/* eslint-disable prefer-regex-literals */ | ||
@@ -8,3 +8,3 @@ const common_1 = require("@sp-api-sdk/common"); | ||
const error_1 = require("./error"); | ||
exports.RATE_LIMITS = [ | ||
exports.clientRateLimits = [ | ||
{ | ||
@@ -25,7 +25,13 @@ method: 'get', | ||
constructor(parameters) { | ||
const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region; | ||
const config = common_1.sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new error_1.CatalogItemsApiError(`Unknown region: ${parameters.region}`); | ||
} | ||
const { rateLimiting, ...clientParameters } = parameters; | ||
const axiosParameters = { ...clientParameters, region }; | ||
const axiosParameters = { | ||
...clientParameters, | ||
region: config.awsRegion, | ||
}; | ||
if (rateLimiting?.retry) { | ||
axiosParameters.rateLimits = exports.RATE_LIMITS; | ||
axiosParameters.rateLimits = exports.clientRateLimits; | ||
axiosParameters.onRetry = rateLimiting.onRetry; | ||
@@ -36,6 +42,3 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = common_1.endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new error_1.CatalogItemsApiError(`Unknown region : ${region}`); | ||
} | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
@@ -42,0 +45,0 @@ } |
/* eslint-disable prefer-regex-literals */ | ||
import { endpoints, awsRegionByCode, createAxiosInstance } from '@sp-api-sdk/common'; | ||
import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common'; | ||
import { Configuration, CatalogApi } from './api-model'; | ||
import { CatalogItemsApiError } from './error'; | ||
export const RATE_LIMITS = [ | ||
export const clientRateLimits = [ | ||
{ | ||
@@ -21,7 +21,13 @@ method: 'get', | ||
constructor(parameters) { | ||
const region = awsRegionByCode[parameters.region] ?? parameters.region; | ||
const config = sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new CatalogItemsApiError(`Unknown region: ${parameters.region}`); | ||
} | ||
const { rateLimiting, ...clientParameters } = parameters; | ||
const axiosParameters = { ...clientParameters, region }; | ||
const axiosParameters = { | ||
...clientParameters, | ||
region: config.awsRegion, | ||
}; | ||
if (rateLimiting?.retry) { | ||
axiosParameters.rateLimits = RATE_LIMITS; | ||
axiosParameters.rateLimits = clientRateLimits; | ||
axiosParameters.onRetry = rateLimiting.onRetry; | ||
@@ -32,8 +38,5 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new CatalogItemsApiError(`Unknown region : ${region}`); | ||
} | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
} | ||
} |
@@ -1,5 +0,6 @@ | ||
import type { ClientConfiguration, RateLimit, OnRetryHandler } from '@sp-api-sdk/common'; | ||
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common'; | ||
import { CatalogApi } from './api-model'; | ||
export declare const RATE_LIMITS: RateLimit[]; | ||
export declare const clientRateLimits: RateLimit[]; | ||
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> { | ||
region: SellingPartnerRegion; | ||
rateLimiting?: { | ||
@@ -6,0 +7,0 @@ retry: boolean; |
@@ -5,3 +5,3 @@ { | ||
"description": "The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog. For more information, see the Catalog Items API Use Case Guide.", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"main": "dist/cjs/index.js", | ||
@@ -29,4 +29,4 @@ "module": "dist/es/index.js", | ||
"dependencies": { | ||
"@sp-api-sdk/auth": "^1.9.5", | ||
"@sp-api-sdk/common": "^1.7.7", | ||
"@sp-api-sdk/auth": "^1.9.6", | ||
"@sp-api-sdk/common": "^1.7.8", | ||
"axios": "^0.24.0" | ||
@@ -53,3 +53,3 @@ }, | ||
], | ||
"gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6" | ||
"gitHead": "f21b5cb511abd110bf1f07843558719993f36187" | ||
} |
@@ -7,2 +7,5 @@ # `catalog-items-api-2020-12-01` | ||
[![npm version](https://badgen.net/npm/v/@sp-api-sdk/catalog-items-api-2020-12-01)](https://www.npmjs.com/package/@sp-api-sdk/catalog-items-api-2020-12-01) | ||
[![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](https://github.com/xojs/xo) | ||
## Documentation | ||
@@ -9,0 +12,0 @@ |
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
159862
3144
84
Updated@sp-api-sdk/auth@^1.9.6
Updated@sp-api-sdk/common@^1.7.8