@sp-api-sdk/vendor-direct-fulfillment-orders-api-v1 1.6.20 → 1.6.24
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
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
The Selling Partner API for Direct Fulfillment Orders provides programmatic access to a direct fulfillment vendor's order data.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@sp-api-sdk/vendor-direct-fulfillment-orders-api-v1)
|
|
6
|
+
[](https://github.com/xojs/xo)
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/vendor-direct-fulfillment-orders-api/vendorDirectFulfillmentOrdersV1.md).
|
|
11
|
+
|
|
12
|
+
Also, see the [generated documentation](https://bizon.github.io/selling-partner-api-sdk/modules/_sp_api_sdk_vendor_direct_fulfillment_orders_api_v1.html) for this API client.
|
|
13
|
+
|
|
5
14
|
## Installing
|
|
6
15
|
|
|
7
16
|
```sh
|
|
@@ -19,26 +28,25 @@ import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
|
|
|
19
28
|
import {VendorDirectFulfillmentOrdersApiClient} from '@sp-api-sdk/vendor-direct-fulfillment-orders-api-v1'
|
|
20
29
|
|
|
21
30
|
const auth = new SellingPartnerApiAuth({
|
|
22
|
-
clientId:
|
|
23
|
-
clientSecret:
|
|
24
|
-
refreshToken: '',
|
|
25
|
-
secretAccessKey: '',
|
|
31
|
+
clientId: process.env.LWA_CLIENT_ID,
|
|
32
|
+
clientSecret: process.env.LWA_CLIENT_SECRET,
|
|
33
|
+
refreshToken: 'Atzr|…',
|
|
26
34
|
accessKeyId: '',
|
|
27
|
-
|
|
35
|
+
secretAccessKey: '',
|
|
28
36
|
role: {
|
|
29
|
-
arn: '',
|
|
30
|
-
}
|
|
37
|
+
arn: 'arn:aws:iam::…',
|
|
38
|
+
},
|
|
31
39
|
})
|
|
32
40
|
|
|
33
41
|
const client = new VendorDirectFulfillmentOrdersApiClient({
|
|
34
42
|
auth,
|
|
35
|
-
region: 'eu'
|
|
43
|
+
region: 'eu',
|
|
36
44
|
})
|
|
37
45
|
```
|
|
38
46
|
|
|
39
|
-
##
|
|
47
|
+
## Rate Limiting
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
In order to retry rate limited requests (HTTP 429), you can configure the API client as such:
|
|
42
50
|
|
|
43
51
|
```javascript
|
|
44
52
|
const client = new VendorDirectFulfillmentOrdersApiClient({
|
|
@@ -46,13 +54,28 @@ const client = new VendorDirectFulfillmentOrdersApiClient({
|
|
|
46
54
|
region: 'eu',
|
|
47
55
|
rateLimiting: {
|
|
48
56
|
retry: true,
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
// Optionally specify a callback that will be called on every retry.
|
|
58
|
+
onRetry: (retryInfo) => {
|
|
59
|
+
console.log(retryInfo)
|
|
60
|
+
},
|
|
61
|
+
},
|
|
51
62
|
})
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
The
|
|
65
|
+
The rate limits used for each route are specified in the [API documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/vendor-direct-fulfillment-orders-api/vendorDirectFulfillmentOrdersV1.md).
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
55
70
|
|
|
56
|
-
##
|
|
71
|
+
## Miscellaneous
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
```
|
|
74
|
+
╚⊙ ⊙╝
|
|
75
|
+
╚═(███)═╝
|
|
76
|
+
╚═(███)═╝
|
|
77
|
+
╚═(███)═╝
|
|
78
|
+
╚═(███)═╝
|
|
79
|
+
╚═(███)═╝
|
|
80
|
+
╚═(███)═╝
|
|
81
|
+
```
|
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.VendorDirectFulfillmentOrdersApiClient = exports.
|
|
3
|
+
exports.VendorDirectFulfillmentOrdersApiClient = 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('^/vendor/directFulfillment/orders/v1/purchaseOrders$'),
|
|
@@ -27,20 +27,23 @@ exports.RATE_LIMITS = [
|
|
|
27
27
|
];
|
|
28
28
|
class VendorDirectFulfillmentOrdersApiClient extends api_model_1.VendorOrdersApi {
|
|
29
29
|
constructor(parameters) {
|
|
30
|
-
const
|
|
30
|
+
const config = common_1.sellingPartnerRegions[parameters.region];
|
|
31
|
+
if (!config) {
|
|
32
|
+
throw new error_1.VendorDirectFulfillmentOrdersApiError(`Unknown region: ${parameters.region}`);
|
|
33
|
+
}
|
|
31
34
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
32
|
-
const axiosParameters = {
|
|
35
|
+
const axiosParameters = {
|
|
36
|
+
...clientParameters,
|
|
37
|
+
region: config.awsRegion,
|
|
38
|
+
};
|
|
33
39
|
if (rateLimiting?.retry) {
|
|
34
|
-
axiosParameters.rateLimits = exports.
|
|
40
|
+
axiosParameters.rateLimits = exports.clientRateLimits;
|
|
35
41
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
36
42
|
}
|
|
37
43
|
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
|
|
38
44
|
const configuration = new api_model_1.Configuration();
|
|
39
45
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
40
|
-
const endpoint =
|
|
41
|
-
if (!endpoint) {
|
|
42
|
-
throw new error_1.VendorDirectFulfillmentOrdersApiError(`Unknown region : ${region}`);
|
|
43
|
-
}
|
|
46
|
+
const endpoint = config.endpoints[environment];
|
|
44
47
|
super(configuration, endpoint, axiosInstance);
|
|
45
48
|
}
|
|
46
49
|
}
|
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, VendorOrdersApi } from './api-model';
|
|
4
4
|
import { VendorDirectFulfillmentOrdersApiError } from './error';
|
|
5
|
-
export const
|
|
5
|
+
export const clientRateLimits = [
|
|
6
6
|
{
|
|
7
7
|
method: 'get',
|
|
8
8
|
urlRegex: new RegExp('^/vendor/directFulfillment/orders/v1/purchaseOrders$'),
|
|
@@ -24,20 +24,23 @@ export const RATE_LIMITS = [
|
|
|
24
24
|
];
|
|
25
25
|
export class VendorDirectFulfillmentOrdersApiClient extends VendorOrdersApi {
|
|
26
26
|
constructor(parameters) {
|
|
27
|
-
const
|
|
27
|
+
const config = sellingPartnerRegions[parameters.region];
|
|
28
|
+
if (!config) {
|
|
29
|
+
throw new VendorDirectFulfillmentOrdersApiError(`Unknown region: ${parameters.region}`);
|
|
30
|
+
}
|
|
28
31
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
29
|
-
const axiosParameters = {
|
|
32
|
+
const axiosParameters = {
|
|
33
|
+
...clientParameters,
|
|
34
|
+
region: config.awsRegion,
|
|
35
|
+
};
|
|
30
36
|
if (rateLimiting?.retry) {
|
|
31
|
-
axiosParameters.rateLimits =
|
|
37
|
+
axiosParameters.rateLimits = clientRateLimits;
|
|
32
38
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
33
39
|
}
|
|
34
40
|
const axiosInstance = createAxiosInstance(axiosParameters);
|
|
35
41
|
const configuration = new Configuration();
|
|
36
42
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
37
|
-
const endpoint = endpoints[environment]
|
|
38
|
-
if (!endpoint) {
|
|
39
|
-
throw new VendorDirectFulfillmentOrdersApiError(`Unknown region : ${region}`);
|
|
40
|
-
}
|
|
43
|
+
const endpoint = config.endpoints[environment];
|
|
41
44
|
super(configuration, endpoint, axiosInstance);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -213,7 +213,7 @@ export declare class VendorOrdersApi extends BaseAPI {
|
|
|
213
213
|
* @throws {RequiredError}
|
|
214
214
|
* @memberof VendorOrdersApi
|
|
215
215
|
*/
|
|
216
|
-
getOrder(requestParameters: VendorOrdersApiGetOrderRequest, options?: any): Promise<import("axios").AxiosResponse<GetOrderResponse>>;
|
|
216
|
+
getOrder(requestParameters: VendorOrdersApiGetOrderRequest, options?: any): Promise<import("axios").AxiosResponse<GetOrderResponse, any>>;
|
|
217
217
|
/**
|
|
218
218
|
* Returns a list of purchase orders created during the time frame that you specify. You define the time frame using the createdAfter and createdBefore parameters. You must use both parameters. You can choose to get only the purchase order numbers by setting the includeDetails parameter to false. In that case, the operation returns a list of purchase order numbers. You can then call the getOrder operation to return the details of a specific order. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 10 | 10 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
219
219
|
* @param {VendorOrdersApiGetOrdersRequest} requestParameters Request parameters.
|
|
@@ -221,7 +221,7 @@ export declare class VendorOrdersApi extends BaseAPI {
|
|
|
221
221
|
* @throws {RequiredError}
|
|
222
222
|
* @memberof VendorOrdersApi
|
|
223
223
|
*/
|
|
224
|
-
getOrders(requestParameters: VendorOrdersApiGetOrdersRequest, options?: any): Promise<import("axios").AxiosResponse<GetOrdersResponse>>;
|
|
224
|
+
getOrders(requestParameters: VendorOrdersApiGetOrdersRequest, options?: any): Promise<import("axios").AxiosResponse<GetOrdersResponse, any>>;
|
|
225
225
|
/**
|
|
226
226
|
* Submits acknowledgements for one or more purchase orders. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 10 | 10 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
227
227
|
* @param {VendorOrdersApiSubmitAcknowledgementRequest} requestParameters Request parameters.
|
|
@@ -229,5 +229,5 @@ export declare class VendorOrdersApi extends BaseAPI {
|
|
|
229
229
|
* @throws {RequiredError}
|
|
230
230
|
* @memberof VendorOrdersApi
|
|
231
231
|
*/
|
|
232
|
-
submitAcknowledgement(requestParameters: VendorOrdersApiSubmitAcknowledgementRequest, options?: any): Promise<import("axios").AxiosResponse<SubmitAcknowledgementResponse>>;
|
|
232
|
+
submitAcknowledgement(requestParameters: VendorOrdersApiSubmitAcknowledgementRequest, options?: any): Promise<import("axios").AxiosResponse<SubmitAcknowledgementResponse, any>>;
|
|
233
233
|
}
|
|
@@ -62,4 +62,4 @@ export declare const toPathString: (url: URL) => string;
|
|
|
62
62
|
*
|
|
63
63
|
* @export
|
|
64
64
|
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => (axios?: AxiosInstance, basePath?: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => (axios?: AxiosInstance, basePath?: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ClientConfiguration, RateLimit } from '@sp-api-sdk/common';
|
|
1
|
+
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
3
2
|
import { VendorOrdersApi } from './api-model';
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const clientRateLimits: RateLimit[];
|
|
5
4
|
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
5
|
+
region: SellingPartnerRegion;
|
|
6
6
|
rateLimiting?: {
|
|
7
7
|
retry: boolean;
|
|
8
|
-
onRetry?:
|
|
8
|
+
onRetry?: OnRetryHandler;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export declare class VendorDirectFulfillmentOrdersApiClient extends VendorOrdersApi {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/vendor-direct-fulfillment-orders-api-v1",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Direct Fulfillment Orders provides programmatic access to a direct fulfillment vendor's order data.",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.24",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dist/**/*.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
+
"check:ts": "yarn tsc --noEmit",
|
|
21
22
|
"build:cjs": "tsc -p tsconfig.json",
|
|
22
23
|
"build:es": "tsc -p tsconfig.es.json",
|
|
23
24
|
"build": "yarn build:cjs && yarn build:es",
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
"test": "NODE_ENV='test' yarn jest"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@sp-api-sdk/auth": "^1.9.
|
|
29
|
-
"@sp-api-sdk/common": "^1.7.
|
|
30
|
-
"axios": "^0.
|
|
29
|
+
"@sp-api-sdk/auth": "^1.9.8",
|
|
30
|
+
"@sp-api-sdk/common": "^1.7.10",
|
|
31
|
+
"axios": "^0.26.0"
|
|
31
32
|
},
|
|
32
33
|
"repository": {
|
|
33
34
|
"type": "git",
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"sp sdk",
|
|
49
50
|
"vendor direct fulfillment orders api"
|
|
50
51
|
],
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3f4ecdeef2ce06ff28612448d263cc8d08eb69f6"
|
|
52
53
|
}
|