@sp-api-sdk/merchant-fulfillment-api-v0 1.11.4 → 1.11.6

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.
@@ -80,25 +80,31 @@ const setOAuthToObject = async function (object, name, scopes, configuration) {
80
80
  }
81
81
  };
82
82
  exports.setOAuthToObject = setOAuthToObject;
83
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
84
+ if (typeof parameter === "object") {
85
+ if (Array.isArray(parameter)) {
86
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
87
+ }
88
+ else {
89
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
90
+ }
91
+ }
92
+ else {
93
+ if (urlSearchParams.has(key)) {
94
+ urlSearchParams.append(key, parameter);
95
+ }
96
+ else {
97
+ urlSearchParams.set(key, parameter);
98
+ }
99
+ }
100
+ }
83
101
  /**
84
102
  *
85
103
  * @export
86
104
  */
87
105
  const setSearchParams = function (url, ...objects) {
88
106
  const searchParams = new URLSearchParams(url.search);
89
- for (const object of objects) {
90
- for (const key in object) {
91
- if (Array.isArray(object[key])) {
92
- searchParams.delete(key);
93
- for (const item of object[key]) {
94
- searchParams.append(key, item);
95
- }
96
- }
97
- else {
98
- searchParams.set(key, object[key]);
99
- }
100
- }
101
- }
107
+ setFlattenedQueryParams(searchParams, objects);
102
108
  url.search = searchParams.toString();
103
109
  };
104
110
  exports.setSearchParams = setSearchParams;
@@ -72,25 +72,31 @@ export const setOAuthToObject = async function (object, name, scopes, configurat
72
72
  object["Authorization"] = "Bearer " + localVarAccessTokenValue;
73
73
  }
74
74
  };
75
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
76
+ if (typeof parameter === "object") {
77
+ if (Array.isArray(parameter)) {
78
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
79
+ }
80
+ else {
81
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
82
+ }
83
+ }
84
+ else {
85
+ if (urlSearchParams.has(key)) {
86
+ urlSearchParams.append(key, parameter);
87
+ }
88
+ else {
89
+ urlSearchParams.set(key, parameter);
90
+ }
91
+ }
92
+ }
75
93
  /**
76
94
  *
77
95
  * @export
78
96
  */
79
97
  export const setSearchParams = function (url, ...objects) {
80
98
  const searchParams = new URLSearchParams(url.search);
81
- for (const object of objects) {
82
- for (const key in object) {
83
- if (Array.isArray(object[key])) {
84
- searchParams.delete(key);
85
- for (const item of object[key]) {
86
- searchParams.append(key, item);
87
- }
88
- }
89
- else {
90
- searchParams.set(key, object[key]);
91
- }
92
- }
93
- }
99
+ setFlattenedQueryParams(searchParams, objects);
94
100
  url.search = searchParams.toString();
95
101
  };
96
102
  /**
@@ -19,4 +19,4 @@ export declare const CarrierWillPickUpOption: {
19
19
  readonly ShipperWillDropOff: "ShipperWillDropOff";
20
20
  readonly NoPreference: "NoPreference";
21
21
  };
22
- export declare type CarrierWillPickUpOption = typeof CarrierWillPickUpOption[keyof typeof CarrierWillPickUpOption];
22
+ export type CarrierWillPickUpOption = typeof CarrierWillPickUpOption[keyof typeof CarrierWillPickUpOption];
@@ -21,4 +21,4 @@ export declare const DeliveryExperienceOption: {
21
21
  readonly NoTracking: "NoTracking";
22
22
  readonly NoPreference: "NoPreference";
23
23
  };
24
- export declare type DeliveryExperienceOption = typeof DeliveryExperienceOption[keyof typeof DeliveryExperienceOption];
24
+ export type DeliveryExperienceOption = typeof DeliveryExperienceOption[keyof typeof DeliveryExperienceOption];
@@ -20,4 +20,4 @@ export declare const DeliveryExperienceType: {
20
20
  readonly DeliveryConfirmationWithoutSignature: "DeliveryConfirmationWithoutSignature";
21
21
  readonly NoTracking: "NoTracking";
22
22
  };
23
- export declare type DeliveryExperienceType = typeof DeliveryExperienceType[keyof typeof DeliveryExperienceType];
23
+ export type DeliveryExperienceType = typeof DeliveryExperienceType[keyof typeof DeliveryExperienceType];
@@ -19,4 +19,4 @@ export declare const FileType: {
19
19
  readonly ApplicationZpl: "application/zpl";
20
20
  readonly ImagePng: "image/png";
21
21
  };
22
- export declare type FileType = typeof FileType[keyof typeof FileType];
22
+ export type FileType = typeof FileType[keyof typeof FileType];
@@ -18,4 +18,4 @@ export declare const HazmatType: {
18
18
  readonly None: "None";
19
19
  readonly LqHazmat: "LQHazmat";
20
20
  };
21
- export declare type HazmatType = typeof HazmatType[keyof typeof HazmatType];
21
+ export type HazmatType = typeof HazmatType[keyof typeof HazmatType];
@@ -18,4 +18,4 @@ export declare const InputTargetType: {
18
18
  readonly ShipmentLevel: "SHIPMENT_LEVEL";
19
19
  readonly ItemLevel: "ITEM_LEVEL";
20
20
  };
21
- export declare type InputTargetType = typeof InputTargetType[keyof typeof InputTargetType];
21
+ export type InputTargetType = typeof InputTargetType[keyof typeof InputTargetType];
@@ -21,4 +21,4 @@ export declare const LabelFormat: {
21
21
  readonly Zpl300: "ZPL300";
22
22
  readonly ShippingServiceDefault: "ShippingServiceDefault";
23
23
  };
24
- export declare type LabelFormat = typeof LabelFormat[keyof typeof LabelFormat];
24
+ export type LabelFormat = typeof LabelFormat[keyof typeof LabelFormat];
@@ -66,4 +66,4 @@ export declare const PredefinedPackageDimensions: {
66
66
  readonly UspsSmallFlatRateBox: "USPS_SmallFlatRateBox";
67
67
  readonly UspsSmallFlatRateEnvelope: "USPS_SmallFlatRateEnvelope";
68
68
  };
69
- export declare type PredefinedPackageDimensions = typeof PredefinedPackageDimensions[keyof typeof PredefinedPackageDimensions];
69
+ export type PredefinedPackageDimensions = typeof PredefinedPackageDimensions[keyof typeof PredefinedPackageDimensions];
@@ -20,4 +20,4 @@ export declare const ShipmentStatus: {
20
20
  readonly RefundRejected: "RefundRejected";
21
21
  readonly RefundApplied: "RefundApplied";
22
22
  };
23
- export declare type ShipmentStatus = typeof ShipmentStatus[keyof typeof ShipmentStatus];
23
+ export type ShipmentStatus = typeof ShipmentStatus[keyof typeof ShipmentStatus];
@@ -17,4 +17,4 @@
17
17
  export declare const StandardIdForLabel: {
18
18
  readonly AmazonOrderId: "AmazonOrderId";
19
19
  };
20
- export declare type StandardIdForLabel = typeof StandardIdForLabel[keyof typeof StandardIdForLabel];
20
+ export type StandardIdForLabel = typeof StandardIdForLabel[keyof typeof StandardIdForLabel];
@@ -18,4 +18,4 @@ export declare const UnitOfLength: {
18
18
  readonly Inches: "inches";
19
19
  readonly Centimeters: "centimeters";
20
20
  };
21
- export declare type UnitOfLength = typeof UnitOfLength[keyof typeof UnitOfLength];
21
+ export type UnitOfLength = typeof UnitOfLength[keyof typeof UnitOfLength];
@@ -18,4 +18,4 @@ export declare const UnitOfWeight: {
18
18
  readonly Oz: "oz";
19
19
  readonly G: "g";
20
20
  };
21
- export declare type UnitOfWeight = typeof UnitOfWeight[keyof typeof UnitOfWeight];
21
+ export type UnitOfWeight = typeof UnitOfWeight[keyof typeof UnitOfWeight];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sp-api-sdk/merchant-fulfillment-api-v0",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "The Selling Partner API for Merchant Fulfillment helps you build applications that let sellers purchase shipping for non-Prime and Prime orders using Amazon’s Buy Shipping Services.",
5
- "version": "1.11.4",
5
+ "version": "1.11.6",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/es/index.js",
8
8
  "types": "dist/types/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "test": "jest"
27
27
  },
28
28
  "dependencies": {
29
- "@sp-api-sdk/common": "^1.9.16",
29
+ "@sp-api-sdk/common": "^1.9.18",
30
30
  "axios": "^0.27.2"
31
31
  },
32
32
  "repository": {
@@ -51,5 +51,5 @@
51
51
  "typedoc": {
52
52
  "entryPoint": "./index.ts"
53
53
  },
54
- "gitHead": "e5aa87a6384048c9f49b97db7d5d7aca34927853"
54
+ "gitHead": "59d4ae523f7261bbee380ef3bd43a368266a55a6"
55
55
  }