@capawesome/cli 4.3.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 +24 -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/channels/create.js +1 -6
- package/dist/commands/apps/channels/create.test.js +6 -11
- 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/devices/forcechannel.js +66 -0
- package/dist/commands/apps/devices/unforcechannel.js +40 -0
- package/dist/commands/apps/liveupdates/generate-signing-key.js +3 -0
- package/dist/commands/apps/liveupdates/register.js +1 -6
- package/dist/commands/apps/liveupdates/upload.js +2 -6
- package/dist/index.js +16 -4
- 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-devices.js +7 -0
- 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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import appDevicesService from '../../../services/app-devices.js';
|
|
2
|
+
import { withAuth } from '../../../utils/auth.js';
|
|
3
|
+
import { isInteractive } from '../../../utils/environment.js';
|
|
4
|
+
import { prompt, promptAppSelection, promptOrganizationSelection } from '../../../utils/prompt.js';
|
|
5
|
+
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
6
|
+
import consola from 'consola';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export default defineCommand({
|
|
9
|
+
description: 'Remove the forced channel from a device.',
|
|
10
|
+
options: defineOptions(z.object({
|
|
11
|
+
appId: z.string().uuid({ message: 'App ID must be a UUID.' }).optional().describe('ID of the app.'),
|
|
12
|
+
deviceId: z.string().optional().describe('ID of the device.'),
|
|
13
|
+
})),
|
|
14
|
+
action: withAuth(async (options, args) => {
|
|
15
|
+
let { appId, deviceId } = options;
|
|
16
|
+
if (!appId) {
|
|
17
|
+
if (!isInteractive()) {
|
|
18
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const organizationId = await promptOrganizationSelection();
|
|
22
|
+
appId = await promptAppSelection(organizationId);
|
|
23
|
+
}
|
|
24
|
+
if (!deviceId) {
|
|
25
|
+
if (!isInteractive()) {
|
|
26
|
+
consola.error('You must provide the device ID when running in non-interactive environment.');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
deviceId = await prompt('Enter the device ID:', {
|
|
30
|
+
type: 'text',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
await appDevicesService.update({
|
|
34
|
+
appId,
|
|
35
|
+
deviceId,
|
|
36
|
+
forcedAppChannelId: null,
|
|
37
|
+
});
|
|
38
|
+
consola.success('Forced channel removed from device successfully.');
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
@@ -43,6 +43,9 @@ export default defineCommand({
|
|
|
43
43
|
// Resolve absolute paths
|
|
44
44
|
const absolutePublicKeyPath = pathModule.resolve(process.cwd(), publicKeyPath);
|
|
45
45
|
const absolutePrivateKeyPath = pathModule.resolve(process.cwd(), privateKeyPath);
|
|
46
|
+
// Ensure parent directories exist
|
|
47
|
+
await fs.mkdir(pathModule.dirname(absolutePublicKeyPath), { recursive: true });
|
|
48
|
+
await fs.mkdir(pathModule.dirname(absolutePrivateKeyPath), { recursive: true });
|
|
46
49
|
// Write the keys to files
|
|
47
50
|
await fs.writeFile(absolutePublicKeyPath, publicKey, 'utf8');
|
|
48
51
|
await fs.writeFile(absolutePrivateKeyPath, privateKey, 'utf8');
|
|
@@ -102,12 +102,8 @@ export default defineCommand({
|
|
|
102
102
|
}), { y: 'yes' }),
|
|
103
103
|
action: withAuth(async (options, args) => {
|
|
104
104
|
let { androidEq, androidMax, androidMin, appId, channel, commitMessage, commitRef, commitSha, customProperty, expiresInDays, gitRef, iosEq, iosMax, iosMin, path, privateKey, rolloutPercentage, url, } = options;
|
|
105
|
-
// Calculate the expiration date
|
|
106
|
-
let expiresAt;
|
|
107
105
|
if (expiresInDays) {
|
|
108
|
-
|
|
109
|
-
expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDays);
|
|
110
|
-
expiresAt = expiresAtDate.toISOString();
|
|
106
|
+
consola.warn('The `--expires-in-days` option is deprecated and will be removed in a future version. Bundle expiration is now managed by the data retention policy of your organization billing plan.');
|
|
111
107
|
}
|
|
112
108
|
// Prompt for url if not provided
|
|
113
109
|
if (!url) {
|
|
@@ -226,7 +222,6 @@ export default defineCommand({
|
|
|
226
222
|
gitCommitSha: commitSha,
|
|
227
223
|
gitRef,
|
|
228
224
|
customProperties: parseCustomProperties(customProperty),
|
|
229
|
-
expiresAt,
|
|
230
225
|
url,
|
|
231
226
|
maxAndroidAppVersionCode: androidMax,
|
|
232
227
|
maxIosAppVersionCode: iosMax,
|
|
@@ -115,12 +115,8 @@ export default defineCommand({
|
|
|
115
115
|
}), { y: 'yes' }),
|
|
116
116
|
action: withAuth(async (options, args) => {
|
|
117
117
|
let { androidEq, androidMax, androidMin, appId, artifactType, channel, commitMessage, commitRef, commitSha, customProperty, expiresInDays, gitRef, iosEq, iosMax, iosMin, path, privateKey, rolloutPercentage, } = options;
|
|
118
|
-
// Calculate the expiration date
|
|
119
|
-
let expiresAt;
|
|
120
118
|
if (expiresInDays) {
|
|
121
|
-
|
|
122
|
-
expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDays);
|
|
123
|
-
expiresAt = expiresAtDate.toISOString();
|
|
119
|
+
consola.warn('The `--expires-in-days` option is deprecated and will be removed in a future version. Bundle expiration is now managed by the data retention policy of your organization billing plan.');
|
|
124
120
|
}
|
|
125
121
|
// Prompt for path if not provided
|
|
126
122
|
if (!path) {
|
|
@@ -167,6 +163,7 @@ export default defineCommand({
|
|
|
167
163
|
consola.error('The path must be a folder when creating a bundle with an artifact type of `manifest`.');
|
|
168
164
|
process.exit(1);
|
|
169
165
|
}
|
|
166
|
+
consola.warn('The `zip` artifact type is faster and more efficient for most apps. The `manifest` type can result in longer downloads and more network requests if your files change frequently between builds. Learn more: https://capawesome.io/cloud/live-updates/advanced/delta-updates/');
|
|
170
167
|
}
|
|
171
168
|
// Prompt for appId if not provided
|
|
172
169
|
if (!appId) {
|
|
@@ -247,7 +244,6 @@ export default defineCommand({
|
|
|
247
244
|
gitCommitSha: commitSha,
|
|
248
245
|
gitRef,
|
|
249
246
|
customProperties: parseCustomProperties(customProperty),
|
|
250
|
-
expiresAt,
|
|
251
247
|
maxAndroidAppVersionCode: androidMax,
|
|
252
248
|
maxIosAppVersionCode: iosMax,
|
|
253
249
|
minAndroidAppVersionCode: androidMin,
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,11 @@ const config = defineConfig({
|
|
|
30
30
|
'apps:bundles:create': await import('./commands/apps/bundles/create.js').then((mod) => mod.default),
|
|
31
31
|
'apps:bundles:delete': await import('./commands/apps/bundles/delete.js').then((mod) => mod.default),
|
|
32
32
|
'apps:bundles:update': await import('./commands/apps/bundles/update.js').then((mod) => mod.default),
|
|
33
|
+
'apps:certificates:create': await import('./commands/apps/certificates/create.js').then((mod) => mod.default),
|
|
34
|
+
'apps:certificates:delete': await import('./commands/apps/certificates/delete.js').then((mod) => mod.default),
|
|
35
|
+
'apps:certificates:get': await import('./commands/apps/certificates/get.js').then((mod) => mod.default),
|
|
36
|
+
'apps:certificates:list': await import('./commands/apps/certificates/list.js').then((mod) => mod.default),
|
|
37
|
+
'apps:certificates:update': await import('./commands/apps/certificates/update.js').then((mod) => mod.default),
|
|
33
38
|
'apps:channels:create': await import('./commands/apps/channels/create.js').then((mod) => mod.default),
|
|
34
39
|
'apps:channels:delete': await import('./commands/apps/channels/delete.js').then((mod) => mod.default),
|
|
35
40
|
'apps:channels:get': await import('./commands/apps/channels/get.js').then((mod) => mod.default),
|
|
@@ -37,15 +42,22 @@ const config = defineConfig({
|
|
|
37
42
|
'apps:channels:pause': await import('./commands/apps/channels/pause.js').then((mod) => mod.default),
|
|
38
43
|
'apps:channels:resume': await import('./commands/apps/channels/resume.js').then((mod) => mod.default),
|
|
39
44
|
'apps:channels:update': await import('./commands/apps/channels/update.js').then((mod) => mod.default),
|
|
45
|
+
'apps:deployments:create': await import('./commands/apps/deployments/create.js').then((mod) => mod.default),
|
|
46
|
+
'apps:deployments:cancel': await import('./commands/apps/deployments/cancel.js').then((mod) => mod.default),
|
|
47
|
+
'apps:deployments:logs': await import('./commands/apps/deployments/logs.js').then((mod) => mod.default),
|
|
48
|
+
'apps:destinations:create': await import('./commands/apps/destinations/create.js').then((mod) => mod.default),
|
|
49
|
+
'apps:destinations:delete': await import('./commands/apps/destinations/delete.js').then((mod) => mod.default),
|
|
50
|
+
'apps:destinations:get': await import('./commands/apps/destinations/get.js').then((mod) => mod.default),
|
|
51
|
+
'apps:destinations:list': await import('./commands/apps/destinations/list.js').then((mod) => mod.default),
|
|
52
|
+
'apps:destinations:update': await import('./commands/apps/destinations/update.js').then((mod) => mod.default),
|
|
53
|
+
'apps:devices:delete': await import('./commands/apps/devices/delete.js').then((mod) => mod.default),
|
|
54
|
+
'apps:devices:forcechannel': await import('./commands/apps/devices/forcechannel.js').then((mod) => mod.default),
|
|
55
|
+
'apps:devices:unforcechannel': await import('./commands/apps/devices/unforcechannel.js').then((mod) => mod.default),
|
|
40
56
|
'apps:environments:create': await import('./commands/apps/environments/create.js').then((mod) => mod.default),
|
|
41
57
|
'apps:environments:delete': await import('./commands/apps/environments/delete.js').then((mod) => mod.default),
|
|
42
58
|
'apps:environments:list': await import('./commands/apps/environments/list.js').then((mod) => mod.default),
|
|
43
59
|
'apps:environments:set': await import('./commands/apps/environments/set.js').then((mod) => mod.default),
|
|
44
60
|
'apps:environments:unset': await import('./commands/apps/environments/unset.js').then((mod) => mod.default),
|
|
45
|
-
'apps:deployments:create': await import('./commands/apps/deployments/create.js').then((mod) => mod.default),
|
|
46
|
-
'apps:deployments:cancel': await import('./commands/apps/deployments/cancel.js').then((mod) => mod.default),
|
|
47
|
-
'apps:deployments:logs': await import('./commands/apps/deployments/logs.js').then((mod) => mod.default),
|
|
48
|
-
'apps:devices:delete': await import('./commands/apps/devices/delete.js').then((mod) => mod.default),
|
|
49
61
|
'apps:liveupdates:bundle': await import('./commands/apps/liveupdates/bundle.js').then((mod) => mod.default),
|
|
50
62
|
'apps:liveupdates:generatesigningkey': await import('./commands/apps/liveupdates/generate-signing-key.js').then((mod) => mod.default),
|
|
51
63
|
'apps:liveupdates:rollback': await import('./commands/apps/liveupdates/rollback.js').then((mod) => mod.default),
|
|
@@ -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 AppAppleApiKeysServiceImpl {
|
|
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}/apple-api-keys`, formData, {
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
15
|
+
...formData.getHeaders(),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const appAppleApiKeysService = new AppAppleApiKeysServiceImpl(httpClient);
|
|
22
|
+
export default appAppleApiKeysService;
|
|
@@ -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;
|
|
@@ -12,6 +12,13 @@ class AppDevicesServiceImpl {
|
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
async update(data) {
|
|
16
|
+
await this.httpClient.patch(`/v1/apps/${data.appId}/devices/${data.deviceId}`, { forcedAppChannelId: data.forcedAppChannelId }, {
|
|
17
|
+
headers: {
|
|
18
|
+
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
15
22
|
}
|
|
16
23
|
const appDevicesService = new AppDevicesServiceImpl(httpClient);
|
|
17
24
|
export default appDevicesService;
|
|
@@ -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?', {
|