@deliverart/sdk-js-core 2.0.0 → 2.1.1

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/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -27,6 +37,9 @@ __export(index_exports, {
27
37
  });
28
38
  module.exports = __toCommonJS(index_exports);
29
39
 
40
+ // src/ApiClient.ts
41
+ var import_qs = __toESM(require("qs"), 1);
42
+
30
43
  // src/errors.ts
31
44
  var InputValidationError = class extends Error {
32
45
  // eslint-disable-next-line no-unused-vars
@@ -98,11 +111,13 @@ function createApiClient(config) {
98
111
  const headers = request.validateHeaders();
99
112
  const url = new URL(request.getPath(), config.baseUrl);
100
113
  if (query) {
101
- Object.entries(query).forEach(([key, value]) => {
102
- if (value !== void 0 && value !== null) {
103
- url.searchParams.append(key, String(value));
104
- }
114
+ const queryString = import_qs.default.stringify(query, {
115
+ arrayFormat: "brackets",
116
+ skipNulls: true
105
117
  });
118
+ if (queryString) {
119
+ url.search = queryString;
120
+ }
106
121
  }
107
122
  const isGet = request.method === "GET";
108
123
  const isFormData = request.contentType === "multipart/form-data";
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ // src/ApiClient.ts
2
+ import qs from "qs";
3
+
1
4
  // src/errors.ts
2
5
  var InputValidationError = class extends Error {
3
6
  // eslint-disable-next-line no-unused-vars
@@ -69,11 +72,13 @@ function createApiClient(config) {
69
72
  const headers = request.validateHeaders();
70
73
  const url = new URL(request.getPath(), config.baseUrl);
71
74
  if (query) {
72
- Object.entries(query).forEach(([key, value]) => {
73
- if (value !== void 0 && value !== null) {
74
- url.searchParams.append(key, String(value));
75
- }
75
+ const queryString = qs.stringify(query, {
76
+ arrayFormat: "brackets",
77
+ skipNulls: true
76
78
  });
79
+ if (queryString) {
80
+ url.search = queryString;
81
+ }
77
82
  }
78
83
  const isGet = request.method === "GET";
79
84
  const isFormData = request.contentType === "multipart/form-data";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-core",
3
3
  "description": "Core SDK for DeliverArt, providing essential functionalities and utilities.",
4
- "version": "2.0.0",
4
+ "version": "2.1.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,6 +20,12 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
23
+ "dependencies": {
24
+ "qs": "6.14.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/qs": "^6.14.0"
28
+ },
23
29
  "scripts": {
24
30
  "build": "tsup src/index.ts --dts --format esm,cjs",
25
31
  "dev": "tsup src/index.ts --dts --watch"