@capawesome/cli 4.4.0 → 4.5.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 +15 -0
- package/dist/commands/apps/builds/create.js +29 -4
- package/dist/commands/apps/certificates/create.js +186 -0
- package/dist/commands/apps/certificates/delete.js +79 -0
- package/dist/commands/apps/certificates/get.js +80 -0
- package/dist/commands/apps/certificates/list.js +43 -0
- package/dist/commands/apps/certificates/update.js +50 -0
- package/dist/commands/apps/destinations/create.js +312 -0
- package/dist/commands/apps/destinations/delete.js +75 -0
- package/dist/commands/apps/destinations/get.js +76 -0
- package/dist/commands/apps/destinations/list.js +41 -0
- package/dist/commands/apps/destinations/update.js +69 -0
- package/dist/commands/apps/liveupdates/generate-signing-key.js +3 -0
- package/dist/index.js +15 -5
- package/dist/services/app-apple-api-keys.js +22 -0
- package/dist/services/app-certificates.js +65 -4
- package/dist/services/app-destinations.js +46 -4
- package/dist/services/app-google-service-account-keys.js +22 -0
- package/dist/services/app-provisioning-profiles.js +33 -0
- package/dist/services/apps.js +3 -0
- package/dist/services/update.js +7 -2
- package/dist/types/app-apple-api-key.js +1 -0
- package/dist/types/app-google-service-account-key.js +1 -0
- package/dist/types/app-provisioning-profile.js +1 -0
- package/dist/types/index.js +5 -0
- package/dist/utils/prompt.js +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,62 @@
|
|
|
1
1
|
import authorizationService from '../services/authorization-service.js';
|
|
2
2
|
import httpClient from '../utils/http-client.js';
|
|
3
|
+
import FormData from 'form-data';
|
|
3
4
|
class AppCertificatesServiceImpl {
|
|
4
5
|
httpClient;
|
|
5
6
|
constructor(httpClient) {
|
|
6
7
|
this.httpClient = httpClient;
|
|
7
8
|
}
|
|
9
|
+
async create(dto) {
|
|
10
|
+
const formData = new FormData();
|
|
11
|
+
formData.append('file', dto.buffer, { filename: dto.fileName });
|
|
12
|
+
formData.append('name', dto.name);
|
|
13
|
+
formData.append('platform', dto.platform);
|
|
14
|
+
formData.append('type', dto.type);
|
|
15
|
+
if (dto.password) {
|
|
16
|
+
formData.append('password', dto.password);
|
|
17
|
+
}
|
|
18
|
+
if (dto.keyAlias) {
|
|
19
|
+
formData.append('keyAlias', dto.keyAlias);
|
|
20
|
+
}
|
|
21
|
+
if (dto.keyPassword) {
|
|
22
|
+
formData.append('keyPassword', dto.keyPassword);
|
|
23
|
+
}
|
|
24
|
+
const response = await this.httpClient.post(`/v1/apps/${dto.appId}/certificates`, formData, {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
27
|
+
...formData.getHeaders(),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return response.data;
|
|
31
|
+
}
|
|
32
|
+
async delete(dto) {
|
|
33
|
+
await this.httpClient.delete(`/v1/apps/${dto.appId}/certificates/${dto.certificateId}`, {
|
|
34
|
+
headers: {
|
|
35
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
8
39
|
async findAll(dto) {
|
|
9
|
-
const { appId, platform } = dto;
|
|
10
40
|
const params = {};
|
|
11
|
-
if (
|
|
12
|
-
params.
|
|
41
|
+
if (dto.limit !== undefined) {
|
|
42
|
+
params.limit = dto.limit.toString();
|
|
43
|
+
}
|
|
44
|
+
if (dto.offset !== undefined) {
|
|
45
|
+
params.offset = dto.offset.toString();
|
|
46
|
+
}
|
|
47
|
+
if (dto.name) {
|
|
48
|
+
params.name = dto.name;
|
|
13
49
|
}
|
|
14
|
-
|
|
50
|
+
if (dto.platform) {
|
|
51
|
+
params.platform = dto.platform;
|
|
52
|
+
}
|
|
53
|
+
if (dto.type) {
|
|
54
|
+
params.type = dto.type;
|
|
55
|
+
}
|
|
56
|
+
if (dto.query) {
|
|
57
|
+
params.query = dto.query;
|
|
58
|
+
}
|
|
59
|
+
const response = await this.httpClient.get(`/v1/apps/${dto.appId}/certificates`, {
|
|
15
60
|
headers: {
|
|
16
61
|
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
17
62
|
},
|
|
@@ -19,6 +64,22 @@ class AppCertificatesServiceImpl {
|
|
|
19
64
|
});
|
|
20
65
|
return response.data;
|
|
21
66
|
}
|
|
67
|
+
async findOneById(dto) {
|
|
68
|
+
const response = await this.httpClient.get(`/v1/apps/${dto.appId}/certificates/${dto.certificateId}`, {
|
|
69
|
+
headers: {
|
|
70
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
return response.data;
|
|
74
|
+
}
|
|
75
|
+
async update(dto) {
|
|
76
|
+
const response = await this.httpClient.patch(`/v1/apps/${dto.appId}/certificates/${dto.certificateId}`, dto, {
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
22
83
|
}
|
|
23
84
|
const appCertificatesService = new AppCertificatesServiceImpl(httpClient);
|
|
24
85
|
export default appCertificatesService;
|
|
@@ -5,13 +5,39 @@ class AppDestinationsServiceImpl {
|
|
|
5
5
|
constructor(httpClient) {
|
|
6
6
|
this.httpClient = httpClient;
|
|
7
7
|
}
|
|
8
|
+
async create(dto) {
|
|
9
|
+
const response = await this.httpClient.post(`/v1/apps/${dto.appId}/destinations`, dto, {
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
async delete(dto) {
|
|
17
|
+
await this.httpClient.delete(`/v1/apps/${dto.appId}/destinations/${dto.destinationId}`, {
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
8
23
|
async findAll(dto) {
|
|
9
|
-
const { appId, platform } = dto;
|
|
10
24
|
const params = {};
|
|
11
|
-
if (
|
|
12
|
-
params.
|
|
25
|
+
if (dto.limit !== undefined) {
|
|
26
|
+
params.limit = dto.limit.toString();
|
|
27
|
+
}
|
|
28
|
+
if (dto.offset !== undefined) {
|
|
29
|
+
params.offset = dto.offset.toString();
|
|
30
|
+
}
|
|
31
|
+
if (dto.name) {
|
|
32
|
+
params.name = dto.name;
|
|
33
|
+
}
|
|
34
|
+
if (dto.platform) {
|
|
35
|
+
params.platform = dto.platform;
|
|
13
36
|
}
|
|
14
|
-
|
|
37
|
+
if (dto.query) {
|
|
38
|
+
params.query = dto.query;
|
|
39
|
+
}
|
|
40
|
+
const response = await this.httpClient.get(`/v1/apps/${dto.appId}/destinations`, {
|
|
15
41
|
headers: {
|
|
16
42
|
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
17
43
|
},
|
|
@@ -19,6 +45,22 @@ class AppDestinationsServiceImpl {
|
|
|
19
45
|
});
|
|
20
46
|
return response.data;
|
|
21
47
|
}
|
|
48
|
+
async findOneById(dto) {
|
|
49
|
+
const response = await this.httpClient.get(`/v1/apps/${dto.appId}/destinations/${dto.destinationId}`, {
|
|
50
|
+
headers: {
|
|
51
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return response.data;
|
|
55
|
+
}
|
|
56
|
+
async update(dto) {
|
|
57
|
+
const response = await this.httpClient.patch(`/v1/apps/${dto.appId}/destinations/${dto.destinationId}`, dto, {
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
return response.data;
|
|
63
|
+
}
|
|
22
64
|
}
|
|
23
65
|
const appDestinationsService = new AppDestinationsServiceImpl(httpClient);
|
|
24
66
|
export default appDestinationsService;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import authorizationService from '../services/authorization-service.js';
|
|
2
|
+
import httpClient from '../utils/http-client.js';
|
|
3
|
+
import FormData from 'form-data';
|
|
4
|
+
class AppGoogleServiceAccountKeysServiceImpl {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
async create(dto) {
|
|
10
|
+
const formData = new FormData();
|
|
11
|
+
formData.append('file', dto.buffer, { filename: dto.fileName });
|
|
12
|
+
const response = await this.httpClient.post(`/v1/apps/${dto.appId}/google-service-account-keys`, formData, {
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
15
|
+
...formData.getHeaders(),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const appGoogleServiceAccountKeysService = new AppGoogleServiceAccountKeysServiceImpl(httpClient);
|
|
22
|
+
export default appGoogleServiceAccountKeysService;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import authorizationService from '../services/authorization-service.js';
|
|
2
|
+
import httpClient from '../utils/http-client.js';
|
|
3
|
+
import FormData from 'form-data';
|
|
4
|
+
class AppProvisioningProfilesServiceImpl {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
async create(dto) {
|
|
10
|
+
const formData = new FormData();
|
|
11
|
+
formData.append('file', dto.buffer, { filename: dto.fileName });
|
|
12
|
+
if (dto.certificateId) {
|
|
13
|
+
formData.append('certificateId', dto.certificateId);
|
|
14
|
+
}
|
|
15
|
+
const response = await this.httpClient.post(`/v1/apps/${dto.appId}/provisioning-profiles`, formData, {
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
18
|
+
...formData.getHeaders(),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return response.data;
|
|
22
|
+
}
|
|
23
|
+
async updateMany(dto) {
|
|
24
|
+
const ids = dto.ids.join(',');
|
|
25
|
+
await this.httpClient.patch(`/v1/apps/${dto.appId}/provisioning-profiles?ids=${ids}`, { appCertificateId: dto.appCertificateId }, {
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const appProvisioningProfilesService = new AppProvisioningProfilesServiceImpl(httpClient);
|
|
33
|
+
export default appProvisioningProfilesService;
|
package/dist/services/apps.js
CHANGED
|
@@ -24,6 +24,9 @@ class AppsServiceImpl {
|
|
|
24
24
|
}
|
|
25
25
|
async findAll(dto) {
|
|
26
26
|
const params = new URLSearchParams({ organizationId: dto.organizationId });
|
|
27
|
+
if (dto.limit !== undefined) {
|
|
28
|
+
params.append('limit', dto.limit.toString());
|
|
29
|
+
}
|
|
27
30
|
const response = await this.httpClient.get(`/v1/apps?${params.toString()}`, {
|
|
28
31
|
headers: {
|
|
29
32
|
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
package/dist/services/update.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import httpClient from '../utils/http-client.js';
|
|
2
2
|
import consola from 'consola';
|
|
3
|
+
import { createRequire } from 'module';
|
|
3
4
|
import * as semver from 'semver';
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
5
6
|
const pkg = require('../../package.json');
|
|
6
|
-
import httpClient from '../utils/http-client.js';
|
|
7
7
|
class UpdateServiceImpl {
|
|
8
8
|
httpClient;
|
|
9
9
|
constructor(httpClient) {
|
|
@@ -13,6 +13,11 @@ class UpdateServiceImpl {
|
|
|
13
13
|
try {
|
|
14
14
|
const response = await this.httpClient.get(`https://registry.npmjs.org/${pkg.name}/latest`);
|
|
15
15
|
const latestVersion = response.data.version;
|
|
16
|
+
if (pkg.version.includes('-dev')) {
|
|
17
|
+
console.log(''); // Add an empty line for better readability
|
|
18
|
+
consola.info(`You are using a development version of Capawesome CLI (${pkg.version}). The latest stable version is ${latestVersion}.`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
16
21
|
if (semver.gt(latestVersion, pkg.version)) {
|
|
17
22
|
consola.warn(`New version of Capawesome CLI available: ${pkg.name}@${latestVersion}. Please update to receive the latest features and bug fixes.`);
|
|
18
23
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
export * from './app-apple-api-key.js';
|
|
1
2
|
export * from './app-bundle.js';
|
|
3
|
+
export * from './app-certificate.js';
|
|
2
4
|
export * from './app-channel.js';
|
|
5
|
+
export * from './app-destination.js';
|
|
3
6
|
export * from './app-device.js';
|
|
7
|
+
export * from './app-google-service-account-key.js';
|
|
8
|
+
export * from './app-provisioning-profile.js';
|
|
4
9
|
export * from './app.js';
|
|
5
10
|
export * from './organization.js';
|
|
6
11
|
export * from './session-code.js';
|
package/dist/utils/prompt.js
CHANGED
|
@@ -39,7 +39,7 @@ export const promptOrganizationSelection = async (options) => {
|
|
|
39
39
|
};
|
|
40
40
|
export const promptAppSelection = async (organizationId, options) => {
|
|
41
41
|
const appsService = await import('../services/apps.js').then((mod) => mod.default);
|
|
42
|
-
let apps = await appsService.findAll({ organizationId });
|
|
42
|
+
let apps = await appsService.findAll({ organizationId, limit: 50 });
|
|
43
43
|
if (apps.length === 0) {
|
|
44
44
|
if (options?.allowCreate) {
|
|
45
45
|
const shouldCreate = await prompt('No apps found. Do you want to create one now?', {
|