@zohoim/client-sdk 1.0.0-poc40 → 1.0.0-poc42
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/es/domain/interfaces/BaseAPI.js +12 -12
- package/es/index.js +1 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getRegistryConfig } from "../../config/registry";
|
|
2
2
|
import { configRegistry } from "../../infrastructure/sdk/config";
|
|
3
3
|
export default class BaseAPI {
|
|
4
|
-
constructor(
|
|
4
|
+
constructor() {
|
|
5
5
|
let {
|
|
6
6
|
module
|
|
7
|
-
} =
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
8
|
this.httpClient = configRegistry.getHttpClient();
|
|
9
9
|
this.baseURL = configRegistry.getBaseURL();
|
|
10
10
|
this.module = module;
|
|
@@ -12,19 +12,19 @@ export default class BaseAPI {
|
|
|
12
12
|
|
|
13
13
|
replacePathParams(url, params) {
|
|
14
14
|
let _url = url;
|
|
15
|
-
Object.entries(params).forEach(
|
|
16
|
-
let [key, value] =
|
|
15
|
+
Object.entries(params).forEach(_ref => {
|
|
16
|
+
let [key, value] = _ref;
|
|
17
17
|
_url = url.replace(`:${key}`, value);
|
|
18
18
|
});
|
|
19
19
|
return _url;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
buildUrl(
|
|
22
|
+
buildUrl(_ref2) {
|
|
23
23
|
let {
|
|
24
24
|
url,
|
|
25
25
|
params,
|
|
26
26
|
query
|
|
27
|
-
} =
|
|
27
|
+
} = _ref2;
|
|
28
28
|
|
|
29
29
|
const _params = params || {};
|
|
30
30
|
|
|
@@ -46,23 +46,23 @@ export default class BaseAPI {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
buildQuery(query) {
|
|
49
|
-
const filteredQuery = Object.entries(query).filter(
|
|
50
|
-
let [, value] =
|
|
49
|
+
const filteredQuery = Object.entries(query).filter(_ref3 => {
|
|
50
|
+
let [, value] = _ref3;
|
|
51
51
|
return value !== undefined && value !== null && value !== '';
|
|
52
|
-
}).reduce((acc,
|
|
53
|
-
let [key, value] =
|
|
52
|
+
}).reduce((acc, _ref4) => {
|
|
53
|
+
let [key, value] = _ref4;
|
|
54
54
|
acc[key] = value;
|
|
55
55
|
return acc;
|
|
56
56
|
}, {});
|
|
57
57
|
return new URLSearchParams(filteredQuery).toString();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
async request(
|
|
60
|
+
async request(_ref5) {
|
|
61
61
|
let {
|
|
62
62
|
request,
|
|
63
63
|
operation,
|
|
64
64
|
header
|
|
65
|
-
} =
|
|
65
|
+
} = _ref5;
|
|
66
66
|
const config = getRegistryConfig(this.module, operation);
|
|
67
67
|
|
|
68
68
|
if (!config) {
|
package/es/index.js
CHANGED
|
@@ -6,5 +6,4 @@ export * from "./infrastructure/sdk";
|
|
|
6
6
|
export * from "./infrastructure/adapters";
|
|
7
7
|
export * from "./infrastructure/api";
|
|
8
8
|
export * from "./infrastructure/interfaces/api";
|
|
9
|
-
export * from "./core/constants";
|
|
10
|
-
export * from "./config/urls/base";
|
|
9
|
+
export * from "./core/constants";
|