@capawesome/cli 1.13.1 → 1.14.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 +14 -0
- package/dist/commands/apps/bundles/create.js +18 -1
- package/dist/commands/apps/bundles/delete.js +18 -1
- package/dist/commands/apps/bundles/update.js +18 -1
- package/dist/commands/apps/channels/create.js +18 -1
- package/dist/commands/apps/channels/delete.js +18 -1
- package/dist/commands/apps/channels/update.js +18 -1
- package/dist/commands/apps/create.js +23 -1
- package/dist/commands/apps/delete.js +18 -1
- package/dist/commands/apps/devices/delete.js +18 -1
- package/dist/services/apps.js +5 -3
- package/dist/services/organizations.js +33 -0
- package/dist/types/index.js +1 -0
- package/dist/types/organization.js +2 -0
- package/dist/utils/error.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.14.0](https://github.com/capawesome-team/cli/compare/v1.13.2...v1.14.0) (2025-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* support multiple organizations ([#58](https://github.com/capawesome-team/cli/issues/58)) ([09cc225](https://github.com/capawesome-team/cli/commit/09cc2258d4b6a2a619651166a1ac290baa7a3b67))
|
|
11
|
+
|
|
12
|
+
## [1.13.2](https://github.com/capawesome-team/cli/compare/v1.13.1...v1.13.2) (2025-07-28)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* do not print empty error messages ([f6a65c5](https://github.com/capawesome-team/cli/commit/f6a65c530c8f30230991190fc18928fb4e648052))
|
|
18
|
+
|
|
5
19
|
## [1.13.1](https://github.com/capawesome-team/cli/compare/v1.13.0...v1.13.1) (2025-06-02)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -20,6 +20,7 @@ const app_bundle_files_1 = __importDefault(require("../../../services/app-bundle
|
|
|
20
20
|
const app_bundles_1 = __importDefault(require("../../../services/app-bundles"));
|
|
21
21
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
22
22
|
const authorization_service_1 = __importDefault(require("../../../services/authorization-service"));
|
|
23
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
23
24
|
const buffer_1 = require("../../../utils/buffer");
|
|
24
25
|
const error_1 = require("../../../utils/error");
|
|
25
26
|
const file_1 = require("../../../utils/file");
|
|
@@ -185,7 +186,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
185
186
|
process.exit(1);
|
|
186
187
|
}
|
|
187
188
|
if (!appId) {
|
|
188
|
-
const
|
|
189
|
+
const organizations = yield organizations_1.default.findAll();
|
|
190
|
+
if (organizations.length === 0) {
|
|
191
|
+
consola_1.default.error('You must create an organization before creating a bundle.');
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
195
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app for which you want to create a bundle.', {
|
|
196
|
+
type: 'select',
|
|
197
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
198
|
+
});
|
|
199
|
+
if (!organizationId) {
|
|
200
|
+
consola_1.default.error('You must select the organization of an app for which you want to create a bundle.');
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
const apps = yield apps_1.default.findAll({
|
|
204
|
+
organizationId,
|
|
205
|
+
});
|
|
189
206
|
if (apps.length === 0) {
|
|
190
207
|
consola_1.default.error('You must create an app before creating a bundle.');
|
|
191
208
|
process.exit(1);
|
|
@@ -16,6 +16,7 @@ const citty_1 = require("citty");
|
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const app_bundles_1 = __importDefault(require("../../../services/app-bundles"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
19
20
|
const error_1 = require("../../../utils/error");
|
|
20
21
|
const prompt_1 = require("../../../utils/prompt");
|
|
21
22
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -37,7 +38,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
37
38
|
let appId = ctx.args.appId;
|
|
38
39
|
let bundleId = ctx.args.bundleId;
|
|
39
40
|
if (!appId) {
|
|
40
|
-
const
|
|
41
|
+
const organizations = yield organizations_1.default.findAll();
|
|
42
|
+
if (organizations.length === 0) {
|
|
43
|
+
consola_1.default.error('You must create an organization before deleting a bundle.');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
47
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app from which you want to delete a bundle.', {
|
|
48
|
+
type: 'select',
|
|
49
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
50
|
+
});
|
|
51
|
+
if (!organizationId) {
|
|
52
|
+
consola_1.default.error('You must select the organization of an app from which you want to delete a bundle.');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
const apps = yield apps_1.default.findAll({
|
|
56
|
+
organizationId,
|
|
57
|
+
});
|
|
41
58
|
if (!apps.length) {
|
|
42
59
|
consola_1.default.error('You must create an app before deleting a bundle.');
|
|
43
60
|
process.exit(1);
|
|
@@ -17,6 +17,7 @@ const consola_1 = __importDefault(require("consola"));
|
|
|
17
17
|
const app_bundles_1 = __importDefault(require("../../../services/app-bundles"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
19
|
const authorization_service_1 = __importDefault(require("../../../services/authorization-service"));
|
|
20
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
20
21
|
const error_1 = require("../../../utils/error");
|
|
21
22
|
const prompt_1 = require("../../../utils/prompt");
|
|
22
23
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -63,7 +64,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
63
64
|
let appId = ctx.args.appId;
|
|
64
65
|
let bundleId = ctx.args.bundleId;
|
|
65
66
|
if (!appId) {
|
|
66
|
-
const
|
|
67
|
+
const organizations = yield organizations_1.default.findAll();
|
|
68
|
+
if (organizations.length === 0) {
|
|
69
|
+
consola_1.default.error('You must create an organization before updating a bundle.');
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
73
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app for which you want to update a bundle.', {
|
|
74
|
+
type: 'select',
|
|
75
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
76
|
+
});
|
|
77
|
+
if (!organizationId) {
|
|
78
|
+
consola_1.default.error('You must select the organization of an app for which you want to update a bundle.');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const apps = yield apps_1.default.findAll({
|
|
82
|
+
organizationId,
|
|
83
|
+
});
|
|
67
84
|
if (!apps.length) {
|
|
68
85
|
consola_1.default.error('You must create an app before updating a bundle.');
|
|
69
86
|
process.exit(1);
|
|
@@ -16,6 +16,7 @@ const citty_1 = require("citty");
|
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const app_channels_1 = __importDefault(require("../../../services/app-channels"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
19
20
|
const error_1 = require("../../../utils/error");
|
|
20
21
|
const prompt_1 = require("../../../utils/prompt");
|
|
21
22
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -51,7 +52,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
51
52
|
}
|
|
52
53
|
// Validate the app ID
|
|
53
54
|
if (!appId) {
|
|
54
|
-
const
|
|
55
|
+
const organizations = yield organizations_1.default.findAll();
|
|
56
|
+
if (organizations.length === 0) {
|
|
57
|
+
consola_1.default.error('You must create an organization before creating a channel.');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
61
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app for which you want to create a channel.', {
|
|
62
|
+
type: 'select',
|
|
63
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
64
|
+
});
|
|
65
|
+
if (!organizationId) {
|
|
66
|
+
consola_1.default.error('You must select the organization of an app for which you want to create a channel.');
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const apps = yield apps_1.default.findAll({
|
|
70
|
+
organizationId,
|
|
71
|
+
});
|
|
55
72
|
if (!apps.length) {
|
|
56
73
|
consola_1.default.error('You must create an app before creating a channel.');
|
|
57
74
|
process.exit(1);
|
|
@@ -16,6 +16,7 @@ const citty_1 = require("citty");
|
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const app_channels_1 = __importDefault(require("../../../services/app-channels"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
19
20
|
const ci_1 = require("../../../utils/ci");
|
|
20
21
|
const error_1 = require("../../../utils/error");
|
|
21
22
|
const prompt_1 = require("../../../utils/prompt");
|
|
@@ -42,7 +43,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
42
43
|
let channelId = ctx.args.channelId;
|
|
43
44
|
let channelName = ctx.args.name;
|
|
44
45
|
if (!appId) {
|
|
45
|
-
const
|
|
46
|
+
const organizations = yield organizations_1.default.findAll();
|
|
47
|
+
if (organizations.length === 0) {
|
|
48
|
+
consola_1.default.error('You must create an organization before deleting a channel.');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
52
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app from which you want to delete a channel.', {
|
|
53
|
+
type: 'select',
|
|
54
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
55
|
+
});
|
|
56
|
+
if (!organizationId) {
|
|
57
|
+
consola_1.default.error('You must select the organization of an app from which you want to delete a channel.');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
const apps = yield apps_1.default.findAll({
|
|
61
|
+
organizationId,
|
|
62
|
+
});
|
|
46
63
|
if (!apps.length) {
|
|
47
64
|
consola_1.default.error('You must create an app before deleting a channel.');
|
|
48
65
|
process.exit(1);
|
|
@@ -17,6 +17,7 @@ const consola_1 = __importDefault(require("consola"));
|
|
|
17
17
|
const app_channels_1 = __importDefault(require("../../../services/app-channels"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
19
|
const authorization_service_1 = __importDefault(require("../../../services/authorization-service"));
|
|
20
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
20
21
|
const error_1 = require("../../../utils/error");
|
|
21
22
|
const prompt_1 = require("../../../utils/prompt");
|
|
22
23
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -60,7 +61,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
if (!appId) {
|
|
63
|
-
const
|
|
64
|
+
const organizations = yield organizations_1.default.findAll();
|
|
65
|
+
if (organizations.length === 0) {
|
|
66
|
+
consola_1.default.error('You must create an organization before updating a channel.');
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
70
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app for which you want to update a channel.', {
|
|
71
|
+
type: 'select',
|
|
72
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
73
|
+
});
|
|
74
|
+
if (!organizationId) {
|
|
75
|
+
consola_1.default.error('You must select the organization of an app for which you want to update a channel.');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
const apps = yield apps_1.default.findAll({
|
|
79
|
+
organizationId,
|
|
80
|
+
});
|
|
64
81
|
if (!apps.length) {
|
|
65
82
|
consola_1.default.error('You must create an app before updating a channel.');
|
|
66
83
|
process.exit(1);
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const citty_1 = require("citty");
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const apps_1 = __importDefault(require("../../services/apps"));
|
|
18
|
+
const organizations_1 = __importDefault(require("../../services/organizations"));
|
|
18
19
|
const error_1 = require("../../utils/error");
|
|
19
20
|
const prompt_1 = require("../../utils/prompt");
|
|
20
21
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -26,14 +27,35 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
26
27
|
type: 'string',
|
|
27
28
|
description: 'Name of the app.',
|
|
28
29
|
},
|
|
30
|
+
organizationId: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'ID of the organization to create the app in.',
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
let organizationId = ctx.args.organizationId;
|
|
37
|
+
if (!organizationId) {
|
|
38
|
+
const organizations = yield organizations_1.default.findAll();
|
|
39
|
+
if (organizations.length === 0) {
|
|
40
|
+
consola_1.default.error('You must create an organization before creating an app.');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
44
|
+
organizationId = yield (0, prompt_1.prompt)('Which organization do you want to create the app in?', {
|
|
45
|
+
type: 'select',
|
|
46
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
47
|
+
});
|
|
48
|
+
if (!organizationId) {
|
|
49
|
+
consola_1.default.error('You must select an organization to create the app in.');
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
31
53
|
let name = ctx.args.name;
|
|
32
54
|
if (!name) {
|
|
33
55
|
name = yield (0, prompt_1.prompt)('Enter the name of the app:', { type: 'text' });
|
|
34
56
|
}
|
|
35
57
|
try {
|
|
36
|
-
const response = yield apps_1.default.create({ name });
|
|
58
|
+
const response = yield apps_1.default.create({ name, organizationId });
|
|
37
59
|
consola_1.default.success('App created successfully.');
|
|
38
60
|
consola_1.default.info(`App ID: ${response.id}`);
|
|
39
61
|
}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const citty_1 = require("citty");
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const apps_1 = __importDefault(require("../../services/apps"));
|
|
18
|
+
const organizations_1 = __importDefault(require("../../services/organizations"));
|
|
18
19
|
const error_1 = require("../../utils/error");
|
|
19
20
|
const prompt_1 = require("../../utils/prompt");
|
|
20
21
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -30,7 +31,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
30
31
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
32
|
let appId = ctx.args.appId;
|
|
32
33
|
if (!appId) {
|
|
33
|
-
const
|
|
34
|
+
const organizations = yield organizations_1.default.findAll();
|
|
35
|
+
if (organizations.length === 0) {
|
|
36
|
+
consola_1.default.error('You must create an organization before deleting an app.');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
40
|
+
const organizationId = yield (0, prompt_1.prompt)('Which organization do you want to delete the app from?', {
|
|
41
|
+
type: 'select',
|
|
42
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
43
|
+
});
|
|
44
|
+
if (!organizationId) {
|
|
45
|
+
consola_1.default.error('You must select an organization to delete the app from.');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
const apps = yield apps_1.default.findAll({
|
|
49
|
+
organizationId,
|
|
50
|
+
});
|
|
34
51
|
if (!apps.length) {
|
|
35
52
|
consola_1.default.error('You must create an app before deleting it.');
|
|
36
53
|
process.exit(1);
|
|
@@ -16,6 +16,7 @@ const citty_1 = require("citty");
|
|
|
16
16
|
const consola_1 = __importDefault(require("consola"));
|
|
17
17
|
const app_devices_1 = __importDefault(require("../../../services/app-devices"));
|
|
18
18
|
const apps_1 = __importDefault(require("../../../services/apps"));
|
|
19
|
+
const organizations_1 = __importDefault(require("../../../services/organizations"));
|
|
19
20
|
const error_1 = require("../../../utils/error");
|
|
20
21
|
const prompt_1 = require("../../../utils/prompt");
|
|
21
22
|
exports.default = (0, citty_1.defineCommand)({
|
|
@@ -35,7 +36,23 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
35
36
|
run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
37
|
let appId = ctx.args.appId;
|
|
37
38
|
if (!appId) {
|
|
38
|
-
const
|
|
39
|
+
const organizations = yield organizations_1.default.findAll();
|
|
40
|
+
if (organizations.length === 0) {
|
|
41
|
+
consola_1.default.error('You must create an organization before deleting a device.');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
45
|
+
const organizationId = yield (0, prompt_1.prompt)('Select the organization of the app from which you want to delete a device.', {
|
|
46
|
+
type: 'select',
|
|
47
|
+
options: organizations.map((organization) => ({ label: organization.name, value: organization.id })),
|
|
48
|
+
});
|
|
49
|
+
if (!organizationId) {
|
|
50
|
+
consola_1.default.error('You must select the organization of an app from which you want to delete a device.');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
const apps = yield apps_1.default.findAll({
|
|
54
|
+
organizationId,
|
|
55
|
+
});
|
|
39
56
|
if (!apps.length) {
|
|
40
57
|
consola_1.default.error('You must create an app before deleting a device.');
|
|
41
58
|
process.exit(1);
|
package/dist/services/apps.js
CHANGED
|
@@ -20,7 +20,8 @@ class AppsServiceImpl {
|
|
|
20
20
|
}
|
|
21
21
|
create(dto) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const
|
|
23
|
+
const params = new URLSearchParams({ organizationId: dto.organizationId });
|
|
24
|
+
const response = yield this.httpClient.post(`/v1/apps?${params.toString()}`, dto, {
|
|
24
25
|
headers: {
|
|
25
26
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
27
|
},
|
|
@@ -37,9 +38,10 @@ class AppsServiceImpl {
|
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
findAll() {
|
|
41
|
+
findAll(dto) {
|
|
41
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const
|
|
43
|
+
const params = new URLSearchParams({ organizationId: dto.organizationId });
|
|
44
|
+
const response = yield this.httpClient.get(`/v1/apps?${params.toString()}`, {
|
|
43
45
|
headers: {
|
|
44
46
|
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
45
47
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
const authorization_service_1 = __importDefault(require("./authorization-service"));
|
|
17
|
+
class OrganizationsServiceImpl {
|
|
18
|
+
constructor(httpClient) {
|
|
19
|
+
this.httpClient = httpClient;
|
|
20
|
+
}
|
|
21
|
+
findAll() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const response = yield this.httpClient.get(`/v1/organizations`, {
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return response.data;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const organizationsService = new OrganizationsServiceImpl(http_client_1.default);
|
|
33
|
+
exports.default = organizationsService;
|
package/dist/types/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./app"), exports);
|
|
|
18
18
|
__exportStar(require("./app-bundle"), exports);
|
|
19
19
|
__exportStar(require("./app-channel"), exports);
|
|
20
20
|
__exportStar(require("./app-device"), exports);
|
|
21
|
+
__exportStar(require("./organization"), exports);
|
|
21
22
|
__exportStar(require("./session"), exports);
|
|
22
23
|
__exportStar(require("./session-code"), exports);
|
|
23
24
|
__exportStar(require("./user"), exports);
|
package/dist/utils/error.js
CHANGED
|
@@ -14,7 +14,7 @@ const getMessageFromUnknownError = (error) => {
|
|
|
14
14
|
};
|
|
15
15
|
exports.getMessageFromUnknownError = getMessageFromUnknownError;
|
|
16
16
|
const getErrorMessageFromAxiosError = (error) => {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
18
18
|
let message = 'An unknown network error has occurred.';
|
|
19
19
|
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
20
20
|
message = 'Your token is no longer valid. Please sign in again.';
|
|
@@ -25,7 +25,7 @@ const getErrorMessageFromAxiosError = (error) => {
|
|
|
25
25
|
else if ((_j = (_h = (_g = (_f = error.response) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.error) === null || _h === void 0 ? void 0 : _h.issues[0]) === null || _j === void 0 ? void 0 : _j.message) {
|
|
26
26
|
message = ((_k = error.response) === null || _k === void 0 ? void 0 : _k.data).error.issues[0].message;
|
|
27
27
|
}
|
|
28
|
-
else if (
|
|
28
|
+
else if (((_l = error.response) === null || _l === void 0 ? void 0 : _l.data) && typeof ((_m = error.response) === null || _m === void 0 ? void 0 : _m.data) === 'string') {
|
|
29
29
|
message = error.response.data;
|
|
30
30
|
}
|
|
31
31
|
return message;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"c12": "2.0.1",
|
|
48
48
|
"citty": "0.1.6",
|
|
49
49
|
"consola": "3.3.0",
|
|
50
|
-
"form-data": "4.0.
|
|
50
|
+
"form-data": "4.0.4",
|
|
51
51
|
"mime": "3.0.0",
|
|
52
52
|
"open": "8.4.2",
|
|
53
53
|
"rc9": "2.1.2",
|