@sp-api-sdk/vendor-direct-fulfillment-shipping-api-v1 1.7.6 → 1.7.10

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,9 @@
2
2
 
3
3
  The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.
4
4
 
5
+ [![npm version](https://badgen.net/npm/v/@sp-api-sdk/vendor-direct-fulfillment-shipping-api-v1)](https://www.npmjs.com/package/@sp-api-sdk/vendor-direct-fulfillment-shipping-api-v1)
6
+ [![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](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/vendor-direct-fulfillment-shipping-api/vendorDirectFulfillmentShippingV1.md).
@@ -59,7 +62,7 @@ const client = new VendorDirectFulfillmentShippingApiClient({
59
62
  })
60
63
  ```
61
64
 
62
- 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-shipping-api/vendorDirectFulfillmentShippingV1.md)).
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-shipping-api/vendorDirectFulfillmentShippingV1.md).
63
66
 
64
67
  ## License
65
68
 
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VendorDirectFulfillmentShippingApiClient = exports.RATE_LIMITS = void 0;
3
+ exports.VendorDirectFulfillmentShippingApiClient = 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.RATE_LIMITS = [
8
+ exports.clientRateLimits = [
9
9
  {
10
10
  method: 'get',
11
11
  urlRegex: new RegExp('^/vendor/directFulfillment/shipping/v1/shippingLabels$'),
@@ -63,20 +63,23 @@ exports.RATE_LIMITS = [
63
63
  ];
64
64
  class VendorDirectFulfillmentShippingApiClient extends api_model_1.VendorShippingLabelsApi {
65
65
  constructor(parameters) {
66
- const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region;
66
+ const config = common_1.sellingPartnerRegions[parameters.region];
67
+ if (!config) {
68
+ throw new error_1.VendorDirectFulfillmentShippingApiError(`Unknown region: ${parameters.region}`);
69
+ }
67
70
  const { rateLimiting, ...clientParameters } = parameters;
68
- const axiosParameters = { ...clientParameters, region };
71
+ const axiosParameters = {
72
+ ...clientParameters,
73
+ region: config.awsRegion,
74
+ };
69
75
  if (rateLimiting?.retry) {
70
- axiosParameters.rateLimits = exports.RATE_LIMITS;
76
+ axiosParameters.rateLimits = exports.clientRateLimits;
71
77
  axiosParameters.onRetry = rateLimiting.onRetry;
72
78
  }
73
79
  const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
74
80
  const configuration = new api_model_1.Configuration();
75
81
  const environment = parameters.sandbox ? 'sandbox' : 'production';
76
- const endpoint = common_1.endpoints[environment][region];
77
- if (!endpoint) {
78
- throw new error_1.VendorDirectFulfillmentShippingApiError(`Unknown region : ${region}`);
79
- }
82
+ const endpoint = config.endpoints[environment];
80
83
  super(configuration, endpoint, axiosInstance);
81
84
  }
82
85
  }
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable prefer-regex-literals */
2
- import { endpoints, awsRegionByCode, createAxiosInstance } from '@sp-api-sdk/common';
2
+ import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
3
3
  import { Configuration, VendorShippingLabelsApi } from './api-model';
4
4
  import { VendorDirectFulfillmentShippingApiError } from './error';
5
- export const RATE_LIMITS = [
5
+ export const clientRateLimits = [
6
6
  {
7
7
  method: 'get',
8
8
  urlRegex: new RegExp('^/vendor/directFulfillment/shipping/v1/shippingLabels$'),
@@ -60,20 +60,23 @@ export const RATE_LIMITS = [
60
60
  ];
61
61
  export class VendorDirectFulfillmentShippingApiClient extends VendorShippingLabelsApi {
62
62
  constructor(parameters) {
63
- const region = awsRegionByCode[parameters.region] ?? parameters.region;
63
+ const config = sellingPartnerRegions[parameters.region];
64
+ if (!config) {
65
+ throw new VendorDirectFulfillmentShippingApiError(`Unknown region: ${parameters.region}`);
66
+ }
64
67
  const { rateLimiting, ...clientParameters } = parameters;
65
- const axiosParameters = { ...clientParameters, region };
68
+ const axiosParameters = {
69
+ ...clientParameters,
70
+ region: config.awsRegion,
71
+ };
66
72
  if (rateLimiting?.retry) {
67
- axiosParameters.rateLimits = RATE_LIMITS;
73
+ axiosParameters.rateLimits = clientRateLimits;
68
74
  axiosParameters.onRetry = rateLimiting.onRetry;
69
75
  }
70
76
  const axiosInstance = createAxiosInstance(axiosParameters);
71
77
  const configuration = new Configuration();
72
78
  const environment = parameters.sandbox ? 'sandbox' : 'production';
73
- const endpoint = endpoints[environment][region];
74
- if (!endpoint) {
75
- throw new VendorDirectFulfillmentShippingApiError(`Unknown region : ${region}`);
76
- }
79
+ const endpoint = config.endpoints[environment];
77
80
  super(configuration, endpoint, axiosInstance);
78
81
  }
79
82
  }
@@ -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 { VendorShippingLabelsApi } from './api-model';
3
- export declare const RATE_LIMITS: RateLimit[];
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/vendor-direct-fulfillment-shipping-api-v1",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.",
5
- "version": "1.7.6",
5
+ "version": "1.7.10",
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.5",
29
- "@sp-api-sdk/common": "^1.7.7",
30
- "axios": "^0.24.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 shipping api"
50
51
  ],
51
- "gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6"
52
+ "gitHead": "3f4ecdeef2ce06ff28612448d263cc8d08eb69f6"
52
53
  }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for Direct Fulfillment Shipping
6
- * The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor\'s shipping data.
7
- *
8
- * The version of the OpenAPI document: v1
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for Direct Fulfillment Shipping
5
- * The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor\'s shipping data.
6
- *
7
- * The version of the OpenAPI document: v1
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,62 +0,0 @@
1
- /**
2
- * Selling Partner API for Direct Fulfillment Shipping
3
- * The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor\'s shipping data.
4
- *
5
- * The version of the OpenAPI document: v1
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import { Dimensions } from './dimensions';
13
- import { Weight } from './weight';
14
- /**
15
- * Details of the package being shipped.
16
- * @export
17
- * @interface Package
18
- */
19
- export interface Package {
20
- /**
21
- * Package identifier for the package. The first package will be 001, the second 002, and so on. This number is used as a reference to refer to this package from the pallet level.
22
- * @type {string}
23
- * @memberof Package
24
- */
25
- packageIdentifier: string;
26
- /**
27
- * This is required to be provided for every package in the small parcel shipments.
28
- * @type {string}
29
- * @memberof Package
30
- */
31
- trackingNumber?: string;
32
- /**
33
- * Carrier manifest Id (Applicable for LTL shipments).
34
- * @type {string}
35
- * @memberof Package
36
- */
37
- manifestId?: string;
38
- /**
39
- * Carrier manifest Date (Applicable for LTL shipments).
40
- * @type {string}
41
- * @memberof Package
42
- */
43
- manifestDate?: string;
44
- /**
45
- * Shipment method.
46
- * @type {string}
47
- * @memberof Package
48
- */
49
- shipMethod?: string;
50
- /**
51
- *
52
- * @type {Weight}
53
- * @memberof Package
54
- */
55
- weight: Weight;
56
- /**
57
- *
58
- * @type {Dimensions}
59
- * @memberof Package
60
- */
61
- dimensions?: Dimensions;
62
- }