@sp-api-sdk/fulfillment-outbound-api-2020-07-01 1.8.1 → 1.9.0
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 +23 -0
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/src/client.js +15 -21
- package/dist/es/index.js +0 -1
- package/dist/es/src/client.js +16 -22
- package/dist/types/index.d.ts +0 -1
- package/dist/types/src/client.d.ts +2 -9
- package/package.json +6 -5
- package/dist/cjs/src/error.js +0 -10
- package/dist/es/src/error.js +0 -6
- package/dist/types/src/error.d.ts +0 -3
package/README.md
CHANGED
|
@@ -64,6 +64,29 @@ const client = new FulfillmentOutboundApiClient({
|
|
|
64
64
|
|
|
65
65
|
The rate limits used for each route are specified in the [API documentation](https://developer-docs.amazon.com/sp-api/docs).
|
|
66
66
|
|
|
67
|
+
## Logging
|
|
68
|
+
|
|
69
|
+
You can enable logging for both SP-API requests and responses by configuring the `logging.request` and `logging.response` properties.
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
const client = new FulfillmentOutboundApiClient({
|
|
73
|
+
auth,
|
|
74
|
+
region: 'eu',
|
|
75
|
+
logging: {
|
|
76
|
+
request: {
|
|
77
|
+
logger: console.debug
|
|
78
|
+
},
|
|
79
|
+
response: {
|
|
80
|
+
logger: console.debug
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Specifying `true` will use the default options, specifying an object will allow you to override the default options.
|
|
87
|
+
This uses [axios-logger](https://github.com/hg-pyun/axios-logger) under the hood.
|
|
88
|
+
|
|
89
|
+
|
|
67
90
|
## License
|
|
68
91
|
|
|
69
92
|
MIT
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./src/client"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./src/error"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./src/api-model/models"), exports);
|
package/dist/cjs/src/client.js
CHANGED
|
@@ -1,104 +1,98 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FulfillmentOutboundApiClient = exports.clientRateLimits = void 0;
|
|
4
|
-
/* eslint-disable prefer-regex-literals */
|
|
5
4
|
const common_1 = require("@sp-api-sdk/common");
|
|
6
5
|
const api_model_1 = require("./api-model");
|
|
7
|
-
const error_1 = require("./error");
|
|
8
6
|
exports.clientRateLimits = [
|
|
9
7
|
{
|
|
10
8
|
method: 'post',
|
|
9
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
11
10
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/preview$'),
|
|
12
11
|
rate: 2,
|
|
13
12
|
burst: 30,
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
15
|
method: 'get',
|
|
16
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
17
17
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders$'),
|
|
18
18
|
rate: 2,
|
|
19
19
|
burst: 30,
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
method: 'post',
|
|
23
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
23
24
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders$'),
|
|
24
25
|
rate: 2,
|
|
25
26
|
burst: 30,
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
method: 'get',
|
|
30
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
29
31
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/tracking$'),
|
|
30
32
|
rate: 2,
|
|
31
33
|
burst: 30,
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
method: 'get',
|
|
37
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
35
38
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/returnReasonCodes$'),
|
|
36
39
|
rate: 2,
|
|
37
40
|
burst: 30,
|
|
38
41
|
},
|
|
39
42
|
{
|
|
40
43
|
method: 'put',
|
|
44
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
41
45
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*/return$'),
|
|
42
46
|
rate: 2,
|
|
43
47
|
burst: 30,
|
|
44
48
|
},
|
|
45
49
|
{
|
|
46
50
|
method: 'get',
|
|
51
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
47
52
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*$'),
|
|
48
53
|
rate: 2,
|
|
49
54
|
burst: 30,
|
|
50
55
|
},
|
|
51
56
|
{
|
|
52
57
|
method: 'put',
|
|
58
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
53
59
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*$'),
|
|
54
60
|
rate: 2,
|
|
55
61
|
burst: 30,
|
|
56
62
|
},
|
|
57
63
|
{
|
|
58
64
|
method: 'put',
|
|
65
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
59
66
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*/cancel$'),
|
|
60
67
|
rate: 2,
|
|
61
68
|
burst: 30,
|
|
62
69
|
},
|
|
63
70
|
{
|
|
64
71
|
method: 'get',
|
|
72
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
65
73
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features$'),
|
|
66
74
|
rate: 2,
|
|
67
75
|
burst: 30,
|
|
68
76
|
},
|
|
69
77
|
{
|
|
70
78
|
method: 'get',
|
|
79
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
71
80
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features/inventory/[^/]*$'),
|
|
72
81
|
rate: 2,
|
|
73
82
|
burst: 30,
|
|
74
83
|
},
|
|
75
84
|
{
|
|
76
85
|
method: 'get',
|
|
86
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
77
87
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features/inventory/[^/]*$'),
|
|
78
88
|
rate: 2,
|
|
79
89
|
burst: 30,
|
|
80
90
|
},
|
|
81
91
|
];
|
|
82
92
|
class FulfillmentOutboundApiClient extends api_model_1.FbaOutboundApi {
|
|
83
|
-
constructor(
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
throw new error_1.FulfillmentOutboundApiError(`Unknown region: ${parameters.region}`);
|
|
87
|
-
}
|
|
88
|
-
const { rateLimiting, ...clientParameters } = parameters;
|
|
89
|
-
const axiosParameters = {
|
|
90
|
-
...clientParameters,
|
|
91
|
-
region: config.awsRegion,
|
|
92
|
-
};
|
|
93
|
-
if (rateLimiting?.retry) {
|
|
94
|
-
axiosParameters.rateLimits = exports.clientRateLimits;
|
|
95
|
-
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
96
|
-
}
|
|
97
|
-
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
|
|
98
|
-
const configuration = new api_model_1.Configuration();
|
|
99
|
-
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
100
|
-
const endpoint = config.endpoints[environment];
|
|
101
|
-
super(configuration, endpoint, axiosInstance);
|
|
93
|
+
constructor(configuration) {
|
|
94
|
+
const { axios, endpoint } = (0, common_1.createAxiosInstance)(configuration, exports.clientRateLimits);
|
|
95
|
+
super(new api_model_1.Configuration(), endpoint, axios);
|
|
102
96
|
}
|
|
103
97
|
}
|
|
104
98
|
exports.FulfillmentOutboundApiClient = FulfillmentOutboundApiClient;
|
package/dist/es/index.js
CHANGED
package/dist/es/src/client.js
CHANGED
|
@@ -1,100 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
|
|
1
|
+
import { createAxiosInstance } from '@sp-api-sdk/common';
|
|
3
2
|
import { Configuration, FbaOutboundApi } from './api-model';
|
|
4
|
-
import { FulfillmentOutboundApiError } from './error';
|
|
5
3
|
export const clientRateLimits = [
|
|
6
4
|
{
|
|
7
5
|
method: 'post',
|
|
6
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
8
7
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/preview$'),
|
|
9
8
|
rate: 2,
|
|
10
9
|
burst: 30,
|
|
11
10
|
},
|
|
12
11
|
{
|
|
13
12
|
method: 'get',
|
|
13
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
14
14
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders$'),
|
|
15
15
|
rate: 2,
|
|
16
16
|
burst: 30,
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
method: 'post',
|
|
20
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
20
21
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders$'),
|
|
21
22
|
rate: 2,
|
|
22
23
|
burst: 30,
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
method: 'get',
|
|
27
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
26
28
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/tracking$'),
|
|
27
29
|
rate: 2,
|
|
28
30
|
burst: 30,
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
33
|
method: 'get',
|
|
34
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
32
35
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/returnReasonCodes$'),
|
|
33
36
|
rate: 2,
|
|
34
37
|
burst: 30,
|
|
35
38
|
},
|
|
36
39
|
{
|
|
37
40
|
method: 'put',
|
|
41
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
38
42
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*/return$'),
|
|
39
43
|
rate: 2,
|
|
40
44
|
burst: 30,
|
|
41
45
|
},
|
|
42
46
|
{
|
|
43
47
|
method: 'get',
|
|
48
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
44
49
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*$'),
|
|
45
50
|
rate: 2,
|
|
46
51
|
burst: 30,
|
|
47
52
|
},
|
|
48
53
|
{
|
|
49
54
|
method: 'put',
|
|
55
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
50
56
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*$'),
|
|
51
57
|
rate: 2,
|
|
52
58
|
burst: 30,
|
|
53
59
|
},
|
|
54
60
|
{
|
|
55
61
|
method: 'put',
|
|
62
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
56
63
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/fulfillmentOrders/[^/]*/cancel$'),
|
|
57
64
|
rate: 2,
|
|
58
65
|
burst: 30,
|
|
59
66
|
},
|
|
60
67
|
{
|
|
61
68
|
method: 'get',
|
|
69
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
62
70
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features$'),
|
|
63
71
|
rate: 2,
|
|
64
72
|
burst: 30,
|
|
65
73
|
},
|
|
66
74
|
{
|
|
67
75
|
method: 'get',
|
|
76
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
68
77
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features/inventory/[^/]*$'),
|
|
69
78
|
rate: 2,
|
|
70
79
|
burst: 30,
|
|
71
80
|
},
|
|
72
81
|
{
|
|
73
82
|
method: 'get',
|
|
83
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
74
84
|
urlRegex: new RegExp('^/fba/outbound/2020-07-01/features/inventory/[^/]*$'),
|
|
75
85
|
rate: 2,
|
|
76
86
|
burst: 30,
|
|
77
87
|
},
|
|
78
88
|
];
|
|
79
89
|
export class FulfillmentOutboundApiClient extends FbaOutboundApi {
|
|
80
|
-
constructor(
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
throw new FulfillmentOutboundApiError(`Unknown region: ${parameters.region}`);
|
|
84
|
-
}
|
|
85
|
-
const { rateLimiting, ...clientParameters } = parameters;
|
|
86
|
-
const axiosParameters = {
|
|
87
|
-
...clientParameters,
|
|
88
|
-
region: config.awsRegion,
|
|
89
|
-
};
|
|
90
|
-
if (rateLimiting?.retry) {
|
|
91
|
-
axiosParameters.rateLimits = clientRateLimits;
|
|
92
|
-
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
93
|
-
}
|
|
94
|
-
const axiosInstance = createAxiosInstance(axiosParameters);
|
|
95
|
-
const configuration = new Configuration();
|
|
96
|
-
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
97
|
-
const endpoint = config.endpoints[environment];
|
|
98
|
-
super(configuration, endpoint, axiosInstance);
|
|
90
|
+
constructor(configuration) {
|
|
91
|
+
const { axios, endpoint } = createAxiosInstance(configuration, clientRateLimits);
|
|
92
|
+
super(new Configuration(), endpoint, axios);
|
|
99
93
|
}
|
|
100
94
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ClientConfiguration, type RateLimit } from '@sp-api-sdk/common';
|
|
2
2
|
import { FbaOutboundApi } from './api-model';
|
|
3
3
|
export declare const clientRateLimits: RateLimit[];
|
|
4
|
-
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
5
|
-
region: SellingPartnerRegion;
|
|
6
|
-
rateLimiting?: {
|
|
7
|
-
retry: boolean;
|
|
8
|
-
onRetry?: OnRetryHandler;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
4
|
export declare class FulfillmentOutboundApiClient extends FbaOutboundApi {
|
|
12
|
-
constructor(
|
|
5
|
+
constructor(configuration: ClientConfiguration);
|
|
13
6
|
}
|
package/package.json
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/fulfillment-outbound-api-2020-07-01",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orders.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.9.0",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
|
+
"typedocMain": "./index.ts",
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"publishConfig": {
|
|
11
12
|
"access": "public"
|
|
@@ -26,9 +27,9 @@
|
|
|
26
27
|
"test": "NODE_ENV='test' yarn jest"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@sp-api-sdk/auth": "^1.9.
|
|
30
|
-
"@sp-api-sdk/common": "^1.
|
|
31
|
-
"axios": "^0.
|
|
30
|
+
"@sp-api-sdk/auth": "^1.9.13",
|
|
31
|
+
"@sp-api-sdk/common": "^1.8.0",
|
|
32
|
+
"axios": "^0.27.2"
|
|
32
33
|
},
|
|
33
34
|
"repository": {
|
|
34
35
|
"type": "git",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"sp sdk",
|
|
50
51
|
"fulfillment outbound api"
|
|
51
52
|
],
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "975705017de9384bf28b85e97d93f866d4d71611"
|
|
53
54
|
}
|
package/dist/cjs/src/error.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FulfillmentOutboundApiError = void 0;
|
|
4
|
-
class FulfillmentOutboundApiError extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = 'FulfillmentOutboundApiError';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.FulfillmentOutboundApiError = FulfillmentOutboundApiError;
|
package/dist/es/src/error.js
DELETED