datastake-daf 0.6.491 → 0.6.492
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/services/index.js
CHANGED
|
@@ -6095,6 +6095,32 @@ const isProxy = () => {
|
|
|
6095
6095
|
};
|
|
6096
6096
|
const getToken = () => isProxy() ? StorageManager.get('proxy_token') : StorageManager.get('token');
|
|
6097
6097
|
|
|
6098
|
+
/**
|
|
6099
|
+
* Custom params serializer to maintain JSON format for nested objects
|
|
6100
|
+
* Ensures consistent behavior across all axios versions
|
|
6101
|
+
*/
|
|
6102
|
+
const paramsSerializer = params => {
|
|
6103
|
+
const parts = [];
|
|
6104
|
+
Object.keys(params).forEach(key => {
|
|
6105
|
+
const value = params[key];
|
|
6106
|
+
if (value !== null && value !== undefined) {
|
|
6107
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
6108
|
+
// Serialize objects as JSON strings
|
|
6109
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`);
|
|
6110
|
+
} else if (Array.isArray(value)) {
|
|
6111
|
+
// Handle arrays
|
|
6112
|
+
value.forEach(val => {
|
|
6113
|
+
parts.push(`${encodeURIComponent(key)}[]=${encodeURIComponent(val)}`);
|
|
6114
|
+
});
|
|
6115
|
+
} else {
|
|
6116
|
+
// Handle primitive values
|
|
6117
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
6120
|
+
});
|
|
6121
|
+
return parts.join('&');
|
|
6122
|
+
};
|
|
6123
|
+
|
|
6098
6124
|
/**
|
|
6099
6125
|
* Base HTTP Service Class
|
|
6100
6126
|
* Provides axios wrapper with token management, cancel tokens, and interceptors
|
|
@@ -6130,6 +6156,7 @@ class BaseHTTPService {
|
|
|
6130
6156
|
baseURL: this.getBaseURL(),
|
|
6131
6157
|
headers,
|
|
6132
6158
|
timeout: this.timeout,
|
|
6159
|
+
paramsSerializer: paramsSerializer,
|
|
6133
6160
|
...this.customAxiosConfig
|
|
6134
6161
|
});
|
|
6135
6162
|
this.setupInterceptors();
|
|
@@ -6151,6 +6178,7 @@ class BaseHTTPService {
|
|
|
6151
6178
|
const options = {
|
|
6152
6179
|
baseURL: this.getBaseURL(),
|
|
6153
6180
|
timeout: this.timeout,
|
|
6181
|
+
paramsSerializer: paramsSerializer,
|
|
6154
6182
|
...this.customAxiosConfig
|
|
6155
6183
|
};
|
|
6156
6184
|
if (token) {
|
package/package.json
CHANGED
|
@@ -3,6 +3,32 @@ import { cleanJSON } from '../../helpers/StringHelper.js';
|
|
|
3
3
|
import { assignParamsToUrl } from '../../helpers/urlHelpers.js';
|
|
4
4
|
import { getToken } from '../../helpers/Token.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Custom params serializer to maintain JSON format for nested objects
|
|
8
|
+
* Ensures consistent behavior across all axios versions
|
|
9
|
+
*/
|
|
10
|
+
const paramsSerializer = (params) => {
|
|
11
|
+
const parts = [];
|
|
12
|
+
Object.keys(params).forEach(key => {
|
|
13
|
+
const value = params[key];
|
|
14
|
+
if (value !== null && value !== undefined) {
|
|
15
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
16
|
+
// Serialize objects as JSON strings
|
|
17
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`);
|
|
18
|
+
} else if (Array.isArray(value)) {
|
|
19
|
+
// Handle arrays
|
|
20
|
+
value.forEach(val => {
|
|
21
|
+
parts.push(`${encodeURIComponent(key)}[]=${encodeURIComponent(val)}`);
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
// Handle primitive values
|
|
25
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return parts.join('&');
|
|
30
|
+
};
|
|
31
|
+
|
|
6
32
|
/**
|
|
7
33
|
* Base HTTP Service Class
|
|
8
34
|
* Provides axios wrapper with token management, cancel tokens, and interceptors
|
|
@@ -36,6 +62,7 @@ export class BaseHTTPService {
|
|
|
36
62
|
baseURL: this.getBaseURL(),
|
|
37
63
|
headers,
|
|
38
64
|
timeout: this.timeout,
|
|
65
|
+
paramsSerializer: paramsSerializer,
|
|
39
66
|
...this.customAxiosConfig,
|
|
40
67
|
});
|
|
41
68
|
|
|
@@ -43,7 +70,8 @@ export class BaseHTTPService {
|
|
|
43
70
|
}
|
|
44
71
|
|
|
45
72
|
setupInterceptors() {
|
|
46
|
-
this.api.interceptors.response.use(
|
|
73
|
+
this.api.interceptors.response.use(
|
|
74
|
+
(response) => response,
|
|
47
75
|
(error) => Promise.reject(error)
|
|
48
76
|
);
|
|
49
77
|
|
|
@@ -67,6 +95,7 @@ export class BaseHTTPService {
|
|
|
67
95
|
const options = {
|
|
68
96
|
baseURL: this.getBaseURL(),
|
|
69
97
|
timeout: this.timeout,
|
|
98
|
+
paramsSerializer: paramsSerializer,
|
|
70
99
|
...this.customAxiosConfig,
|
|
71
100
|
};
|
|
72
101
|
|
|
@@ -221,9 +250,8 @@ export class BaseHTTPService {
|
|
|
221
250
|
);
|
|
222
251
|
}
|
|
223
252
|
|
|
224
|
-
|
|
225
253
|
// Utility method
|
|
226
254
|
assignParamsToUrl(path, params) {
|
|
227
255
|
return assignParamsToUrl(path, params);
|
|
228
256
|
}
|
|
229
|
-
}
|
|
257
|
+
}
|