@capawesome/cli 1.11.0 → 1.12.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 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.12.0](https://github.com/capawesome-team/cli/compare/v1.11.1...v1.12.0) (2025-05-22)
6
+
7
+
8
+ ### Features
9
+
10
+ * add `apps:channels:list` command ([87234f2](https://github.com/capawesome-team/cli/commit/87234f28b8daf487f7f06c2b87060499596025e2))
11
+
12
+ ## [1.11.1](https://github.com/capawesome-team/cli/compare/v1.11.0...v1.11.1) (2025-05-05)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * `File must be a File object` error ([bd154a3](https://github.com/capawesome-team/cli/commit/bd154a3d418093b471d58830a7ab2e150b7d33c3))
18
+
5
19
  ## [1.11.0](https://github.com/capawesome-team/cli/compare/v1.10.0...v1.11.0) (2025-05-04)
6
20
 
7
21
 
@@ -19,7 +19,7 @@ const authorization_service_1 = __importDefault(require("../../../services/autho
19
19
  const error_1 = require("../../../utils/error");
20
20
  exports.default = (0, citty_1.defineCommand)({
21
21
  meta: {
22
- description: 'Update an existing app channel.',
22
+ description: 'Get an existing app channel.',
23
23
  },
24
24
  args: {
25
25
  appId: {
@@ -0,0 +1,90 @@
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 app_channels_1 = __importDefault(require("../../../services/app-channels"));
18
+ const authorization_service_1 = __importDefault(require("../../../services/authorization-service"));
19
+ const error_1 = require("../../../utils/error");
20
+ exports.default = (0, citty_1.defineCommand)({
21
+ meta: {
22
+ description: 'Retrieve a list of existing app channels.',
23
+ },
24
+ args: {
25
+ appId: {
26
+ type: 'string',
27
+ description: 'ID of the app.',
28
+ },
29
+ json: {
30
+ type: 'boolean',
31
+ description: 'Output in JSON format.',
32
+ },
33
+ limit: {
34
+ type: 'string',
35
+ description: 'Limit for pagination.',
36
+ },
37
+ offset: {
38
+ type: 'string',
39
+ description: 'Offset for pagination.',
40
+ },
41
+ },
42
+ run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
43
+ if (!authorization_service_1.default.hasAuthorizationToken()) {
44
+ consola_1.default.error('You must be logged in to run this command.');
45
+ process.exit(1);
46
+ }
47
+ let appId = ctx.args.appId;
48
+ let json = ctx.args.json;
49
+ const limit = ctx.args.limit;
50
+ const offset = ctx.args.offset;
51
+ // Convert limit and offset to numbers
52
+ const limitAsNumber = limit ? parseInt(limit, 10) : undefined;
53
+ const offsetAsNumber = offset ? parseInt(offset, 10) : undefined;
54
+ // Convert json to boolean
55
+ if (typeof json === 'string') {
56
+ json = json.toLowerCase() === 'true';
57
+ }
58
+ if (!appId) {
59
+ consola_1.default.error('You must provide an app ID.');
60
+ process.exit(1);
61
+ }
62
+ try {
63
+ const foundChannels = yield app_channels_1.default.findAll({
64
+ appId,
65
+ limit: limitAsNumber,
66
+ offset: offsetAsNumber,
67
+ });
68
+ const logData = foundChannels.map((channel) => ({
69
+ id: channel.id,
70
+ name: channel.name,
71
+ totalAppBundleLimit: channel.totalAppBundleLimit,
72
+ appId: channel.appId,
73
+ createdAt: channel.createdAt,
74
+ updatedAt: channel.updatedAt,
75
+ }));
76
+ if (json) {
77
+ console.log(JSON.stringify(logData, null, 2));
78
+ }
79
+ else {
80
+ console.table(logData);
81
+ consola_1.default.success('Channels retrieved successfully.');
82
+ }
83
+ }
84
+ catch (error) {
85
+ const message = (0, error_1.getMessageFromUnknownError)(error);
86
+ consola_1.default.error(message);
87
+ process.exit(1);
88
+ }
89
+ }),
90
+ });
package/dist/index.js CHANGED
@@ -68,6 +68,7 @@ const main = (0, citty_1.defineCommand)({
68
68
  'apps:channels:create': Promise.resolve().then(() => __importStar(require('./commands/apps/channels/create'))).then((mod) => mod.default),
69
69
  'apps:channels:delete': Promise.resolve().then(() => __importStar(require('./commands/apps/channels/delete'))).then((mod) => mod.default),
70
70
  'apps:channels:get': Promise.resolve().then(() => __importStar(require('./commands/apps/channels/get'))).then((mod) => mod.default),
71
+ 'apps:channels:list': Promise.resolve().then(() => __importStar(require('./commands/apps/channels/list'))).then((mod) => mod.default),
71
72
  'apps:channels:update': Promise.resolve().then(() => __importStar(require('./commands/apps/channels/update'))).then((mod) => mod.default),
72
73
  'apps:devices:delete': Promise.resolve().then(() => __importStar(require('./commands/apps/devices/delete'))).then((mod) => mod.default),
73
74
  'manifests:generate': Promise.resolve().then(() => __importStar(require('./commands/manifests/generate'))).then((mod) => mod.default),
@@ -49,13 +49,19 @@ class AppChannelsServiceImpl {
49
49
  }
50
50
  });
51
51
  }
52
- findAll(data) {
52
+ findAll(dto) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  const queryParams = new URLSearchParams();
55
- if (data.name) {
56
- queryParams.append('name', data.name);
55
+ if (dto.limit) {
56
+ queryParams.append('limit', dto.limit.toString());
57
57
  }
58
- const response = yield this.httpClient.get(`/v1/apps/${data.appId}/channels?${queryParams}`, {
58
+ if (dto.name) {
59
+ queryParams.append('name', dto.name);
60
+ }
61
+ if (dto.offset) {
62
+ queryParams.append('offset', dto.offset.toString());
63
+ }
64
+ const response = yield this.httpClient.get(`/v1/apps/${dto.appId}/channels?${queryParams}`, {
59
65
  headers: {
60
66
  Authorization: `Bearer ${authorization_service_1.default.getCurrentAuthorizationToken()}`,
61
67
  },
@@ -18,7 +18,6 @@ const config_1 = __importDefault(require("../services/config"));
18
18
  class HttpClientImpl {
19
19
  constructor() {
20
20
  this.baseHeaders = {
21
- 'Content-Type': 'application/json',
22
21
  'User-Agent': `Capawesome CLI v${package_json_1.version}`,
23
22
  };
24
23
  }
@@ -26,35 +25,35 @@ class HttpClientImpl {
26
25
  return __awaiter(this, void 0, void 0, function* () {
27
26
  const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
28
27
  const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
29
- 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) }));
28
+ return axios_1.default.delete(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
30
29
  });
31
30
  }
32
31
  get(url, config) {
33
32
  return __awaiter(this, void 0, void 0, function* () {
34
33
  const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
35
34
  const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
36
- 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) }));
35
+ return axios_1.default.get(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
37
36
  });
38
37
  }
39
38
  patch(url, data, config) {
40
39
  return __awaiter(this, void 0, void 0, function* () {
41
40
  const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
42
41
  const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
43
- 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) }));
42
+ return axios_1.default.patch(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
44
43
  });
45
44
  }
46
45
  post(url, data, config) {
47
46
  return __awaiter(this, void 0, void 0, function* () {
48
47
  const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
49
48
  const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
50
- 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) }));
49
+ return axios_1.default.post(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
51
50
  });
52
51
  }
53
52
  put(url, data, config) {
54
53
  return __awaiter(this, void 0, void 0, function* () {
55
54
  const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
56
55
  const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
57
- 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) }));
56
+ return axios_1.default.put(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
58
57
  });
59
58
  }
60
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "1.11.0",
3
+ "version": "1.12.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",