@sp-api-sdk/fulfillment-inbound-api-v0 1.6.21 → 1.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/cjs/src/client.js +12 -9
- package/dist/es/src/client.js +12 -9
- package/dist/types/src/client.d.ts +3 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@sp-api-sdk/fulfillment-inbound-api-v0)
|
|
6
|
+
[](https://github.com/xojs/xo)
|
|
7
|
+
|
|
5
8
|
## Documentation
|
|
6
9
|
|
|
7
10
|
Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/fulfillment-inbound-api/fulfillmentInboundV0.md).
|
package/dist/cjs/src/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FulfillmentInboundApiClient = exports.
|
|
3
|
+
exports.FulfillmentInboundApiClient = exports.clientRateLimits = void 0;
|
|
4
4
|
/* eslint-disable prefer-regex-literals */
|
|
5
5
|
const common_1 = require("@sp-api-sdk/common");
|
|
6
6
|
const api_model_1 = require("./api-model");
|
|
7
7
|
const error_1 = require("./error");
|
|
8
|
-
exports.
|
|
8
|
+
exports.clientRateLimits = [
|
|
9
9
|
{
|
|
10
10
|
method: 'get',
|
|
11
11
|
urlRegex: new RegExp('^/fba/inbound/v0/itemsGuidance$'),
|
|
@@ -111,20 +111,23 @@ exports.RATE_LIMITS = [
|
|
|
111
111
|
];
|
|
112
112
|
class FulfillmentInboundApiClient extends api_model_1.FbaInboundApi {
|
|
113
113
|
constructor(parameters) {
|
|
114
|
-
const
|
|
114
|
+
const config = common_1.sellingPartnerRegions[parameters.region];
|
|
115
|
+
if (!config) {
|
|
116
|
+
throw new error_1.FulfillmentInboundApiError(`Unknown region: ${parameters.region}`);
|
|
117
|
+
}
|
|
115
118
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
116
|
-
const axiosParameters = {
|
|
119
|
+
const axiosParameters = {
|
|
120
|
+
...clientParameters,
|
|
121
|
+
region: config.awsRegion,
|
|
122
|
+
};
|
|
117
123
|
if (rateLimiting?.retry) {
|
|
118
|
-
axiosParameters.rateLimits = exports.
|
|
124
|
+
axiosParameters.rateLimits = exports.clientRateLimits;
|
|
119
125
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
120
126
|
}
|
|
121
127
|
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
|
|
122
128
|
const configuration = new api_model_1.Configuration();
|
|
123
129
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
124
|
-
const endpoint =
|
|
125
|
-
if (!endpoint) {
|
|
126
|
-
throw new error_1.FulfillmentInboundApiError(`Unknown region : ${region}`);
|
|
127
|
-
}
|
|
130
|
+
const endpoint = config.endpoints[environment];
|
|
128
131
|
super(configuration, endpoint, axiosInstance);
|
|
129
132
|
}
|
|
130
133
|
}
|
package/dist/es/src/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable prefer-regex-literals */
|
|
2
|
-
import {
|
|
2
|
+
import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
|
|
3
3
|
import { Configuration, FbaInboundApi } from './api-model';
|
|
4
4
|
import { FulfillmentInboundApiError } from './error';
|
|
5
|
-
export const
|
|
5
|
+
export const clientRateLimits = [
|
|
6
6
|
{
|
|
7
7
|
method: 'get',
|
|
8
8
|
urlRegex: new RegExp('^/fba/inbound/v0/itemsGuidance$'),
|
|
@@ -108,20 +108,23 @@ export const RATE_LIMITS = [
|
|
|
108
108
|
];
|
|
109
109
|
export class FulfillmentInboundApiClient extends FbaInboundApi {
|
|
110
110
|
constructor(parameters) {
|
|
111
|
-
const
|
|
111
|
+
const config = sellingPartnerRegions[parameters.region];
|
|
112
|
+
if (!config) {
|
|
113
|
+
throw new FulfillmentInboundApiError(`Unknown region: ${parameters.region}`);
|
|
114
|
+
}
|
|
112
115
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
113
|
-
const axiosParameters = {
|
|
116
|
+
const axiosParameters = {
|
|
117
|
+
...clientParameters,
|
|
118
|
+
region: config.awsRegion,
|
|
119
|
+
};
|
|
114
120
|
if (rateLimiting?.retry) {
|
|
115
|
-
axiosParameters.rateLimits =
|
|
121
|
+
axiosParameters.rateLimits = clientRateLimits;
|
|
116
122
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
117
123
|
}
|
|
118
124
|
const axiosInstance = createAxiosInstance(axiosParameters);
|
|
119
125
|
const configuration = new Configuration();
|
|
120
126
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
121
|
-
const endpoint = endpoints[environment]
|
|
122
|
-
if (!endpoint) {
|
|
123
|
-
throw new FulfillmentInboundApiError(`Unknown region : ${region}`);
|
|
124
|
-
}
|
|
127
|
+
const endpoint = config.endpoints[environment];
|
|
125
128
|
super(configuration, endpoint, axiosInstance);
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ClientConfiguration, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
1
|
+
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
2
2
|
import { FbaInboundApi } from './api-model';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const clientRateLimits: RateLimit[];
|
|
4
4
|
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
5
|
+
region: SellingPartnerRegion;
|
|
5
6
|
rateLimiting?: {
|
|
6
7
|
retry: boolean;
|
|
7
8
|
onRetry?: OnRetryHandler;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/fulfillment-inbound-api-v0",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network.",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.22",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"test": "NODE_ENV='test' yarn jest"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sp-api-sdk/auth": "^1.9.
|
|
29
|
-
"@sp-api-sdk/common": "^1.7.
|
|
28
|
+
"@sp-api-sdk/auth": "^1.9.6",
|
|
29
|
+
"@sp-api-sdk/common": "^1.7.8",
|
|
30
30
|
"axios": "^0.24.0"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"sp sdk",
|
|
49
49
|
"fulfillment inbound api"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f21b5cb511abd110bf1f07843558719993f36187"
|
|
52
52
|
}
|