@capawesome/cli 1.2.0 → 1.3.0
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/CHANGELOG.md +7 -0
- package/dist/utils/http-client.js +11 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.3.0](https://github.com/capawesome-team/cli/compare/v1.2.0...v1.3.0) (2024-12-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* set custom user agent for http requests ([dceb044](https://github.com/capawesome-team/cli/commit/dceb044c4e9a14f40a26544ab46815e77333a831))
|
|
11
|
+
|
|
5
12
|
## [1.2.0](https://github.com/capawesome-team/cli/compare/v1.1.0...v1.2.0) (2024-12-21)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -13,41 +13,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
const package_json_1 = require("../../package.json");
|
|
16
17
|
const config_1 = __importDefault(require("../services/config"));
|
|
17
18
|
class HttpClientImpl {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.baseHeaders = {
|
|
21
|
+
'User-Agent': `Capawesome CLI v${package_json_1.version}`,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
18
24
|
delete(url, config) {
|
|
19
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
26
|
const baseUrl = yield config_1.default.getValueForKey('API_URL');
|
|
21
27
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
22
|
-
return axios_1.default.delete(urlWithHost, config);
|
|
28
|
+
return axios_1.default.delete(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), this.baseHeaders) }));
|
|
23
29
|
});
|
|
24
30
|
}
|
|
25
31
|
get(url, config) {
|
|
26
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
33
|
const baseUrl = yield config_1.default.getValueForKey('API_URL');
|
|
28
34
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
29
|
-
return axios_1.default.get(urlWithHost, config);
|
|
35
|
+
return axios_1.default.get(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), this.baseHeaders) }));
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
patch(url, data, config) {
|
|
33
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
40
|
const baseUrl = yield config_1.default.getValueForKey('API_URL');
|
|
35
41
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
36
|
-
return axios_1.default.patch(urlWithHost, data, config);
|
|
42
|
+
return axios_1.default.patch(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), this.baseHeaders) }));
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
45
|
post(url, data, config) {
|
|
40
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
47
|
const baseUrl = yield config_1.default.getValueForKey('API_URL');
|
|
42
48
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
43
|
-
return axios_1.default.post(urlWithHost, data, config);
|
|
49
|
+
return axios_1.default.post(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), this.baseHeaders) }));
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
52
|
put(url, data, config) {
|
|
47
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
54
|
const baseUrl = yield config_1.default.getValueForKey('API_URL');
|
|
49
55
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
50
|
-
return axios_1.default.put(urlWithHost, data, config);
|
|
56
|
+
return axios_1.default.put(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), this.baseHeaders) }));
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
}
|