@sp-api-sdk/shipment-invoicing-api-v0
Advanced tools
Comparing version 1.8.6 to 1.8.7
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ShipmentInvoicingApiClient = exports.RATE_LIMITS = void 0; | ||
exports.ShipmentInvoicingApiClient = 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 = [ | ||
{ | ||
@@ -31,7 +31,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.ShipmentInvoicingApiError(`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; | ||
@@ -42,6 +48,3 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = common_1.endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new error_1.ShipmentInvoicingApiError(`Unknown region : ${region}`); | ||
} | ||
const endpoint = config.endpoints[environment]; | ||
super(configuration, endpoint, axiosInstance); | ||
@@ -48,0 +51,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, ShipmentInvoiceApi } from './api-model'; | ||
import { ShipmentInvoicingApiError } from './error'; | ||
export const RATE_LIMITS = [ | ||
export const clientRateLimits = [ | ||
{ | ||
@@ -27,7 +27,13 @@ method: 'get', | ||
constructor(parameters) { | ||
const region = awsRegionByCode[parameters.region] ?? parameters.region; | ||
const config = sellingPartnerRegions[parameters.region]; | ||
if (!config) { | ||
throw new ShipmentInvoicingApiError(`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; | ||
@@ -38,8 +44,5 @@ } | ||
const environment = parameters.sandbox ? 'sandbox' : 'production'; | ||
const endpoint = endpoints[environment][region]; | ||
if (!endpoint) { | ||
throw new ShipmentInvoicingApiError(`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 { ShipmentInvoiceApi } 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 Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders.", | ||
"version": "1.8.6", | ||
"version": "1.8.7", | ||
"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 @@ # `shipment-invoicing-api-v0` | ||
[![npm version](https://badgen.net/npm/v/@sp-api-sdk/shipment-invoicing-api-v0)](https://www.npmjs.com/package/@sp-api-sdk/shipment-invoicing-api-v0) | ||
[![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](https://github.com/xojs/xo) | ||
## Documentation | ||
@@ -7,0 +10,0 @@ |
128574
2822
82
Updated@sp-api-sdk/auth@^1.9.6
Updated@sp-api-sdk/common@^1.7.8