@sp-api-sdk/fba-inbound-eligibility-api-v1
Advanced tools
Comparing version 1.6.21 to 1.6.22
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FbaInboundEligibilityApiClient = exports.RATE_LIMITS = void 0; | ||
exports.FbaInboundEligibilityApiClient = 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 = [ | ||
{ | ||
@@ -19,7 +19,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.FbaInboundEligibilityApiError(`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; | ||
@@ -30,6 +36,3 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = common_1.endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new error_1.FbaInboundEligibilityApiError(`Unknown region : ${region}`); | ||
} | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
@@ -36,0 +39,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, FbaInboundApi } from './api-model'; | ||
import { FbaInboundEligibilityApiError } from './error'; | ||
export const RATE_LIMITS = [ | ||
export const clientRateLimits = [ | ||
{ | ||
@@ -15,7 +15,13 @@ method: 'get', | ||
constructor(parameters) { | ||
const region = awsRegionByCode[parameters.region] ?? parameters.region; | ||
const config = sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new FbaInboundEligibilityApiError(`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; | ||
@@ -26,8 +32,5 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new FbaInboundEligibilityApiError(`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 { FbaInboundApi } 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": "With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to inform their decisions about which items to ship Amazon's fulfillment centers.", | ||
"version": "1.6.21", | ||
"version": "1.6.22", | ||
"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" | ||
} |
@@ -5,2 +5,5 @@ # `fba-inbound-eligibility-api-v1` | ||
[](https://www.npmjs.com/package/@sp-api-sdk/fba-inbound-eligibility-api-v1) | ||
[](https://github.com/xojs/xo) | ||
## Documentation | ||
@@ -7,0 +10,0 @@ |
84187
1646
82
Updated@sp-api-sdk/auth@^1.9.6
Updated@sp-api-sdk/common@^1.7.8