@capawesome/cli 1.6.3 → 1.8.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 +19 -0
- package/dist/commands/doctor.js +34 -0
- package/dist/commands/login.js +95 -40
- package/dist/index.js +15 -5
- package/dist/services/app-bundle-files.js +1 -1
- package/dist/services/app-bundles.js +3 -3
- package/dist/services/app-channels.js +2 -2
- package/dist/services/app-devices.js +1 -1
- package/dist/services/apps.js +3 -3
- package/dist/services/config.js +2 -1
- package/dist/services/session-code.js +28 -0
- package/dist/services/sessions.js +2 -2
- package/dist/services/users.js +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/session-code.js +2 -0
- package/dist/utils/http-client.js +5 -5
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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.8.0](https://github.com/capawesome-team/cli/compare/v1.7.0...v1.8.0) (2025-04-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* login via browser ([#39](https://github.com/capawesome-team/cli/issues/39)) ([814f0e4](https://github.com/capawesome-team/cli/commit/814f0e4875e6ce0a21fd655cfa3c57b50fa5146a)), closes [#32](https://github.com/capawesome-team/cli/issues/32)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* improved error handling ([9f12894](https://github.com/capawesome-team/cli/commit/9f128941d1a8576034712cadea22da62313fa90c))
|
|
16
|
+
|
|
17
|
+
## [1.7.0](https://github.com/capawesome-team/cli/compare/v1.6.3...v1.7.0) (2025-03-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **doctor:** add doctor command ([#37](https://github.com/capawesome-team/cli/issues/37)) ([1d9d0ac](https://github.com/capawesome-team/cli/commit/1d9d0acf74b1b3ce63c87031a8499227bf3e3f8b))
|
|
23
|
+
|
|
5
24
|
## [1.6.3](https://github.com/capawesome-team/cli/compare/v1.6.2...v1.6.3) (2025-03-20)
|
|
6
25
|
|
|
7
26
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const citty_1 = require("citty");
|
|
16
|
+
const consola_1 = __importDefault(require("consola"));
|
|
17
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
18
|
+
const systeminformation_1 = __importDefault(require("systeminformation"));
|
|
19
|
+
exports.default = (0, citty_1.defineCommand)({
|
|
20
|
+
meta: {
|
|
21
|
+
name: 'doctor',
|
|
22
|
+
description: 'Prints out neccessary information for debugging',
|
|
23
|
+
},
|
|
24
|
+
run: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const osInfo = yield systeminformation_1.default.osInfo();
|
|
26
|
+
const versions = yield systeminformation_1.default.versions('npm, node');
|
|
27
|
+
consola_1.default.box([
|
|
28
|
+
`NodeJS version: ${versions.node}`,
|
|
29
|
+
`NPM version: ${versions.npm}`,
|
|
30
|
+
`CLI version: ${package_json_1.default.version}`,
|
|
31
|
+
`OS: ${osInfo.distro} ${osInfo.release} ${osInfo.codename ? `(${osInfo.codename})` : ''}`,
|
|
32
|
+
].join('\n'));
|
|
33
|
+
}),
|
|
34
|
+
});
|
package/dist/commands/login.js
CHANGED
|
@@ -15,6 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const axios_1 = require("axios");
|
|
16
16
|
const citty_1 = require("citty");
|
|
17
17
|
const consola_1 = __importDefault(require("consola"));
|
|
18
|
+
const open_1 = __importDefault(require("open"));
|
|
19
|
+
const config_1 = __importDefault(require("../services/config"));
|
|
20
|
+
const session_code_1 = __importDefault(require("../services/session-code"));
|
|
18
21
|
const sessions_1 = __importDefault(require("../services/sessions"));
|
|
19
22
|
const users_1 = __importDefault(require("../services/users"));
|
|
20
23
|
const error_1 = require("../utils/error");
|
|
@@ -33,55 +36,107 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
33
36
|
},
|
|
34
37
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
38
|
var _a;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
const consoleBaseUrl = yield config_1.default.getValueForKey('CONSOLE_BASE_URL');
|
|
40
|
+
let sessionIdOrToken = ctx.args.token;
|
|
41
|
+
if (sessionIdOrToken === undefined) {
|
|
42
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
43
|
+
const authenticationMethod = yield (0, prompt_1.prompt)('How would you like to authenticate Capawesome CLI?', {
|
|
44
|
+
type: 'select',
|
|
45
|
+
options: [
|
|
46
|
+
{ label: 'Login with a web browser', value: 'browser' },
|
|
47
|
+
{ label: 'Paste an authentication token', value: 'token' },
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
if (authenticationMethod === 'browser') {
|
|
51
|
+
// Create a session code
|
|
52
|
+
const { id: deviceCode, code: userCode } = yield session_code_1.default.create();
|
|
53
|
+
consola_1.default.box(`Copy your one-time code: ${userCode.slice(0, 4)}-${userCode.slice(4)}`);
|
|
54
|
+
// Prompt the user to open the authorization URL in their browser
|
|
55
|
+
const shouldProceed = yield (0, prompt_1.prompt)(`Select Yes to continue in your browser or No to cancel the authentication.`, {
|
|
56
|
+
type: 'confirm',
|
|
57
|
+
initial: true,
|
|
51
58
|
});
|
|
52
|
-
|
|
59
|
+
if (!shouldProceed) {
|
|
60
|
+
consola_1.default.error('Authentication cancelled.');
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
// Open the authorization URL in the user's default browser
|
|
64
|
+
consola_1.default.start('Opening browser...');
|
|
65
|
+
const authorizationUrl = `${consoleBaseUrl}/login/device`;
|
|
66
|
+
try {
|
|
67
|
+
(0, open_1.default)(authorizationUrl);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
consola_1.default.warn(`Could not open browser automatically. Please open the following URL manually: ${authorizationUrl}`);
|
|
71
|
+
}
|
|
72
|
+
// Wait for the user to authenticate
|
|
73
|
+
consola_1.default.start('Waiting for authentication...');
|
|
74
|
+
const sessionId = yield createSession(deviceCode);
|
|
75
|
+
if (!sessionId) {
|
|
76
|
+
consola_1.default.error('Authentication timed out. Please try again.');
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
sessionIdOrToken = sessionId;
|
|
53
80
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
81
|
+
else {
|
|
82
|
+
sessionIdOrToken = yield (0, prompt_1.prompt)('Please provide your authentication token:', {
|
|
83
|
+
type: 'text',
|
|
84
|
+
});
|
|
85
|
+
if (!sessionIdOrToken) {
|
|
86
|
+
consola_1.default.error('Token must be provided.');
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
57
89
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
90
|
+
}
|
|
91
|
+
else if (sessionIdOrToken.length === 0) {
|
|
92
|
+
// No token provided
|
|
93
|
+
consola_1.default.error(`Please provide a valid token. You can create a token at ${consoleBaseUrl}/settings/tokens.`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
// Sign in with the provided token
|
|
97
|
+
consola_1.default.start('Signing in...');
|
|
98
|
+
userConfig_1.default.write({
|
|
99
|
+
token: sessionIdOrToken,
|
|
100
|
+
});
|
|
101
|
+
try {
|
|
102
|
+
yield users_1.default.me();
|
|
61
103
|
consola_1.default.success(`Successfully signed in.`);
|
|
62
104
|
}
|
|
63
|
-
|
|
64
|
-
|
|
105
|
+
catch (error) {
|
|
106
|
+
userConfig_1.default.write({});
|
|
107
|
+
let message = (0, error_1.getMessageFromUnknownError)(error);
|
|
108
|
+
if (error instanceof axios_1.AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
109
|
+
message = `Invalid token. Please provide a valid token. You can create a token at ${consoleBaseUrl}/settings/tokens.`;
|
|
110
|
+
}
|
|
111
|
+
consola_1.default.error(message);
|
|
65
112
|
process.exit(1);
|
|
66
113
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
const createSession = (deviceCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
var _a;
|
|
118
|
+
const maxAttempts = 20;
|
|
119
|
+
const interval = 3 * 1000; // 3 seconds
|
|
120
|
+
let attempts = 0;
|
|
121
|
+
let sessionId = null;
|
|
122
|
+
while (attempts < maxAttempts && sessionId === null) {
|
|
123
|
+
try {
|
|
124
|
+
const response = yield sessions_1.default.create({
|
|
125
|
+
code: deviceCode,
|
|
126
|
+
provider: 'code',
|
|
70
127
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
128
|
+
sessionId = response.id;
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error instanceof axios_1.AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
|
|
132
|
+
// Session not ready yet, wait and try again
|
|
133
|
+
attempts++;
|
|
134
|
+
yield new Promise((resolve) => setTimeout(resolve, interval));
|
|
74
135
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
let message = (0, error_1.getMessageFromUnknownError)(error);
|
|
78
|
-
if (error instanceof axios_1.AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
79
|
-
message =
|
|
80
|
-
'Invalid token. Please provide a valid token. You can create a token at https://cloud.capawesome.io/settings/tokens.';
|
|
81
|
-
}
|
|
82
|
-
consola_1.default.error(message);
|
|
83
|
-
process.exit(1);
|
|
136
|
+
else {
|
|
137
|
+
throw error;
|
|
84
138
|
}
|
|
85
139
|
}
|
|
86
|
-
}
|
|
140
|
+
}
|
|
141
|
+
return sessionId;
|
|
87
142
|
});
|
package/dist/index.js
CHANGED
|
@@ -38,9 +38,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
const Sentry = __importStar(require("@sentry/node"));
|
|
40
40
|
const citty_1 = require("citty");
|
|
41
|
+
const consola_1 = __importDefault(require("consola"));
|
|
41
42
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
42
43
|
const config_1 = __importDefault(require("./services/config"));
|
|
43
44
|
const update_1 = __importDefault(require("./services/update"));
|
|
45
|
+
const error_1 = require("./utils/error");
|
|
44
46
|
const main = (0, citty_1.defineCommand)({
|
|
45
47
|
meta: {
|
|
46
48
|
name: package_json_1.default.name,
|
|
@@ -57,6 +59,7 @@ const main = (0, citty_1.defineCommand)({
|
|
|
57
59
|
whoami: Promise.resolve().then(() => __importStar(require('./commands/whoami'))).then((mod) => mod.default),
|
|
58
60
|
login: Promise.resolve().then(() => __importStar(require('./commands/login'))).then((mod) => mod.default),
|
|
59
61
|
logout: Promise.resolve().then(() => __importStar(require('./commands/logout'))).then((mod) => mod.default),
|
|
62
|
+
doctor: Promise.resolve().then(() => __importStar(require('./commands/doctor'))).then((mod) => mod.default),
|
|
60
63
|
'apps:create': Promise.resolve().then(() => __importStar(require('./commands/apps/create'))).then((mod) => mod.default),
|
|
61
64
|
'apps:delete': Promise.resolve().then(() => __importStar(require('./commands/apps/delete'))).then((mod) => mod.default),
|
|
62
65
|
'apps:bundles:create': Promise.resolve().then(() => __importStar(require('./commands/apps/bundles/create'))).then((mod) => mod.default),
|
|
@@ -80,9 +83,16 @@ const captureException = (error) => __awaiter(void 0, void 0, void 0, function*
|
|
|
80
83
|
yield Sentry.close();
|
|
81
84
|
});
|
|
82
85
|
(0, citty_1.runMain)(main).catch((error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
try {
|
|
87
|
+
yield captureException(error).catch(() => {
|
|
88
|
+
// No op
|
|
89
|
+
});
|
|
90
|
+
// Print the error message
|
|
91
|
+
const message = (0, error_1.getMessageFromUnknownError)(error);
|
|
92
|
+
consola_1.default.error(message);
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
// Exit with a non-zero code
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
88
98
|
}));
|
|
@@ -30,7 +30,7 @@ class AppBundleFilesServiceImpl {
|
|
|
30
30
|
if (dto.signature) {
|
|
31
31
|
formData.append('signature', dto.signature);
|
|
32
32
|
}
|
|
33
|
-
const response = yield this.httpClient.post(`/apps/${dto.appId}/bundles/${dto.appBundleId}/files`, formData, {
|
|
33
|
+
const response = yield this.httpClient.post(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}/files`, formData, {
|
|
34
34
|
headers: Object.assign({ Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}` }, formData.getHeaders()),
|
|
35
35
|
});
|
|
36
36
|
return response.data;
|
|
@@ -20,7 +20,7 @@ class AppBundlesServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
create(dto) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const response = yield this.httpClient.post(`/apps/${dto.appId}/bundles`, dto, {
|
|
23
|
+
const response = yield this.httpClient.post(`/v1/apps/${dto.appId}/bundles`, dto, {
|
|
24
24
|
headers: {
|
|
25
25
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
26
|
},
|
|
@@ -30,7 +30,7 @@ class AppBundlesServiceImpl {
|
|
|
30
30
|
}
|
|
31
31
|
update(dto) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const response = yield this.httpClient.patch(`/apps/${dto.appId}/bundles/${dto.appBundleId}`, dto, {
|
|
33
|
+
const response = yield this.httpClient.patch(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}`, dto, {
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
36
36
|
},
|
|
@@ -40,7 +40,7 @@ class AppBundlesServiceImpl {
|
|
|
40
40
|
}
|
|
41
41
|
delete(dto) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
yield this.httpClient.delete(`/apps/${dto.appId}/bundles/${dto.appBundleId}`, {
|
|
43
|
+
yield this.httpClient.delete(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}`, {
|
|
44
44
|
headers: {
|
|
45
45
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
46
46
|
},
|
|
@@ -20,7 +20,7 @@ class AppChannelsServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
create(dto) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const response = yield this.httpClient.post(`/apps/${dto.appId}/channels`, dto, {
|
|
23
|
+
const response = yield this.httpClient.post(`/v1/apps/${dto.appId}/channels`, dto, {
|
|
24
24
|
headers: {
|
|
25
25
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
26
|
},
|
|
@@ -30,7 +30,7 @@ class AppChannelsServiceImpl {
|
|
|
30
30
|
}
|
|
31
31
|
delete(data) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
yield this.httpClient.delete(`/apps/${data.appId}/channels`, {
|
|
33
|
+
yield this.httpClient.delete(`/v1/apps/${data.appId}/channels`, {
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
36
36
|
},
|
|
@@ -20,7 +20,7 @@ class AppDevicesServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
delete(data) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
yield this.httpClient.delete(`/apps/${data.appId}/devices/${data.deviceId}`, {
|
|
23
|
+
yield this.httpClient.delete(`/v1/apps/${data.appId}/devices/${data.deviceId}`, {
|
|
24
24
|
headers: {
|
|
25
25
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
26
|
},
|
package/dist/services/apps.js
CHANGED
|
@@ -20,7 +20,7 @@ class AppsServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
create(dto) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const response = yield this.httpClient.post(`/apps`, dto, {
|
|
23
|
+
const response = yield this.httpClient.post(`/v1/apps`, dto, {
|
|
24
24
|
headers: {
|
|
25
25
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
26
|
},
|
|
@@ -30,7 +30,7 @@ class AppsServiceImpl {
|
|
|
30
30
|
}
|
|
31
31
|
delete(dto) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
yield this.httpClient.delete(`/apps/${dto.id}`, {
|
|
33
|
+
yield this.httpClient.delete(`/v1/apps/${dto.id}`, {
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
36
36
|
},
|
|
@@ -39,7 +39,7 @@ class AppsServiceImpl {
|
|
|
39
39
|
}
|
|
40
40
|
findAll() {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const response = yield this.httpClient.get('/apps', {
|
|
42
|
+
const response = yield this.httpClient.get('/v1/apps', {
|
|
43
43
|
headers: {
|
|
44
44
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
45
45
|
},
|
package/dist/services/config.js
CHANGED
|
@@ -23,7 +23,8 @@ class ConfigServiceImpl {
|
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const { config } = yield (0, c12_1.loadConfig)({
|
|
25
25
|
defaults: {
|
|
26
|
-
|
|
26
|
+
API_BASE_URL: 'https://api.cloud.capawesome.io',
|
|
27
|
+
CONSOLE_BASE_URL: 'https://console.cloud.capawesome.io',
|
|
27
28
|
ENVIRONMENT: 'production',
|
|
28
29
|
},
|
|
29
30
|
name: 'capawesome',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const http_client_1 = __importDefault(require("../utils/http-client"));
|
|
16
|
+
class SessionCodesServiceImpl {
|
|
17
|
+
constructor(httpClient) {
|
|
18
|
+
this.httpClient = httpClient;
|
|
19
|
+
}
|
|
20
|
+
create() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const response = yield this.httpClient.post(`/v1/sessions/codes`, {});
|
|
23
|
+
return response.data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const sessionCodesService = new SessionCodesServiceImpl(http_client_1.default);
|
|
28
|
+
exports.default = sessionCodesService;
|
|
@@ -20,13 +20,13 @@ class SessionsServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
create(dto) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const response = yield this.httpClient.post(`/sessions`, dto);
|
|
23
|
+
const response = yield this.httpClient.post(`/v1/sessions`, dto);
|
|
24
24
|
return response.data;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
delete(dto) {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
yield this.httpClient.delete(`/sessions/${dto.id}`, {
|
|
29
|
+
yield this.httpClient.delete(`/v1/sessions/${dto.id}`, {
|
|
30
30
|
headers: {
|
|
31
31
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
32
32
|
},
|
package/dist/services/users.js
CHANGED
|
@@ -20,7 +20,7 @@ class UsersServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
me() {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const response = yield this.httpClient.get('/users/me', {
|
|
23
|
+
const response = yield this.httpClient.get('/v1/users/me', {
|
|
24
24
|
headers: {
|
|
25
25
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
26
|
},
|
package/dist/types/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./app-bundle"), exports);
|
|
|
19
19
|
__exportStar(require("./app-channel"), exports);
|
|
20
20
|
__exportStar(require("./app-device"), exports);
|
|
21
21
|
__exportStar(require("./session"), exports);
|
|
22
|
+
__exportStar(require("./session-code"), exports);
|
|
22
23
|
__exportStar(require("./user"), exports);
|
|
@@ -23,35 +23,35 @@ class HttpClientImpl {
|
|
|
23
23
|
}
|
|
24
24
|
delete(url, config) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const baseUrl = yield config_1.default.getValueForKey('
|
|
26
|
+
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
27
27
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
28
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) }));
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
get(url, config) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const baseUrl = yield config_1.default.getValueForKey('
|
|
33
|
+
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
34
34
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
35
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) }));
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
patch(url, data, config) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const baseUrl = yield config_1.default.getValueForKey('
|
|
40
|
+
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
41
41
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
42
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) }));
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
post(url, data, config) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const baseUrl = yield config_1.default.getValueForKey('
|
|
47
|
+
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
48
48
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
49
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) }));
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
put(url, data, config) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const baseUrl = yield config_1.default.getValueForKey('
|
|
54
|
+
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
55
55
|
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
56
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) }));
|
|
57
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "patch-package && rimraf ./dist && tsc",
|
|
@@ -41,15 +41,17 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@clack/prompts": "0.7.0",
|
|
44
|
-
"@sentry/node": "8.
|
|
44
|
+
"@sentry/node": "8.55.0",
|
|
45
45
|
"archiver": "7.0.1",
|
|
46
|
-
"axios": "1.
|
|
46
|
+
"axios": "1.8.4",
|
|
47
47
|
"c12": "2.0.1",
|
|
48
48
|
"citty": "0.1.6",
|
|
49
49
|
"consola": "3.3.0",
|
|
50
50
|
"form-data": "4.0.1",
|
|
51
|
+
"open": "10.1.0",
|
|
51
52
|
"rc9": "2.1.2",
|
|
52
|
-
"semver": "7.6.3"
|
|
53
|
+
"semver": "7.6.3",
|
|
54
|
+
"systeminformation": "5.25.11"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@ionic/prettier-config": "4.0.0",
|