@capawesome/cli 4.23.0 → 4.23.1

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,13 @@
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
+ ## [4.23.1](https://github.com/capawesome-team/cli/compare/v4.23.0...v4.23.1) (2026-10-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * resend the request body when retrying uploads ([#234](https://github.com/capawesome-team/cli/issues/234)) ([be2dc8f](https://github.com/capawesome-team/cli/commit/be2dc8f210a26e230ab9cbffe6b50de2c5cc7514))
11
+
5
12
  ## [4.23.0](https://github.com/capawesome-team/cli/compare/v4.22.0...v4.23.0) (2026-09-30)
6
13
 
7
14
 
@@ -126,6 +126,37 @@ describe('apps-liveupdates-upload', () => {
126
126
  expect(mockConsola.info).toHaveBeenCalledWith(`Build Artifact ID: ${bundleId}`);
127
127
  expect(mockConsola.success).toHaveBeenCalledWith('Live Update successfully uploaded.');
128
128
  });
129
+ it('should resend the file after a network error', async () => {
130
+ const appId = 'app-123';
131
+ const bundleId = 'bundle-456';
132
+ const options = {
133
+ appId,
134
+ path: './dist',
135
+ artifactType: 'zip',
136
+ rollout: 1,
137
+ };
138
+ mockIsReadable.mockResolvedValue(true);
139
+ mockIsDirectory.mockResolvedValue(true);
140
+ mockGetFilesInDirectoryAndSubdirectories.mockResolvedValue([
141
+ { href: 'index.html', mimeType: 'text/html', name: 'index.html', path: 'index.html' },
142
+ ]);
143
+ const mockZip = await import('../../../utils/zip.js');
144
+ const mockHash = await import('../../../utils/hash.js');
145
+ vi.mocked(mockZip.default.isZipped).mockReturnValue(false);
146
+ vi.mocked(mockZip.default.zipFolder).mockResolvedValue(Buffer.from('test'));
147
+ vi.mocked(mockHash.createHash).mockResolvedValue('test-hash');
148
+ nock(DEFAULT_API_BASE_URL).get(`/v1/apps/${appId}`).reply(200, { id: appId, name: 'Test App' });
149
+ nock(DEFAULT_API_BASE_URL).post(`/v1/apps/${appId}/bundles`).reply(201, { id: bundleId });
150
+ const uploadScope = nock(DEFAULT_API_BASE_URL)
151
+ .post(`/v1/apps/${appId}/bundles/${bundleId}/files`)
152
+ .replyWithError(Object.assign(new Error('socket hang up'), { code: 'ECONNRESET' }))
153
+ .post(`/v1/apps/${appId}/bundles/${bundleId}/files`, (body) => body.includes('test-hash'))
154
+ .reply(201, { id: 'file-123' });
155
+ nock(DEFAULT_API_BASE_URL).patch(`/v1/apps/${appId}/bundles/${bundleId}`).reply(200, { id: bundleId });
156
+ await uploadCommand.action(options, undefined);
157
+ expect(uploadScope.isDone()).toBe(true);
158
+ expect(mockConsola.success).toHaveBeenCalledWith('Live Update successfully uploaded.');
159
+ });
129
160
  it('should pass gitRef to API when provided', async () => {
130
161
  const appId = 'app-123';
131
162
  const bundlePath = './dist';
@@ -9,7 +9,7 @@ class AppAppleApiKeysServiceImpl {
9
9
  async create(dto) {
10
10
  const formData = new FormData();
11
11
  formData.append('file', dto.buffer, { filename: dto.fileName });
12
- const response = await this.httpClient.post(`/v1/apps/${dto.appId}/apple-api-keys`, formData, {
12
+ const response = await this.httpClient.post(`/v1/apps/${dto.appId}/apple-api-keys`, formData.getBuffer(), {
13
13
  headers: {
14
14
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
15
15
  ...formData.getHeaders(),
@@ -53,7 +53,7 @@ class AppBuildSourcesServiceImpl {
53
53
  formData.append('blob', dto.buffer, { filename: dto.name });
54
54
  formData.append('partNumber', dto.partNumber.toString());
55
55
  return this.httpClient
56
- .put(`/v1/apps/${dto.appId}/build-sources/${dto.appBuildSourceId}/upload?action=mpu-uploadpart&uploadId=${dto.uploadId}`, formData, {
56
+ .put(`/v1/apps/${dto.appId}/build-sources/${dto.appBuildSourceId}/upload?action=mpu-uploadpart&uploadId=${dto.uploadId}`, formData.getBuffer(), {
57
57
  headers: {
58
58
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
59
59
  ...formData.getHeaders(),
@@ -24,7 +24,7 @@ class AppBundleFilesServiceImpl {
24
24
  formData.append('signature', dto.signature);
25
25
  }
26
26
  formData.append('sizeInBytes', sizeInBytes.toString());
27
- const response = await this.httpClient.post(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}/files`, formData, {
27
+ const response = await this.httpClient.post(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}/files`, formData.getBuffer(), {
28
28
  headers: {
29
29
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
30
30
  ...formData.getHeaders(),
@@ -66,7 +66,7 @@ class AppBundleFilesServiceImpl {
66
66
  formData.append('blob', dto.buffer, { filename: dto.name });
67
67
  formData.append('partNumber', dto.partNumber.toString());
68
68
  return this.httpClient
69
- .put(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}/files/${dto.appBundleFileId}/upload?action=mpu-uploadpart&uploadId=${dto.uploadId}`, formData, {
69
+ .put(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}/files/${dto.appBundleFileId}/upload?action=mpu-uploadpart&uploadId=${dto.uploadId}`, formData.getBuffer(), {
70
70
  headers: {
71
71
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
72
72
  ...formData.getHeaders(),
@@ -20,7 +20,7 @@ class AppCertificatesServiceImpl {
20
20
  if (dto.keyPassword) {
21
21
  formData.append('keyPassword', dto.keyPassword);
22
22
  }
23
- const response = await this.httpClient.post(`/v1/apps/${dto.appId}/certificates`, formData, {
23
+ const response = await this.httpClient.post(`/v1/apps/${dto.appId}/certificates`, formData.getBuffer(), {
24
24
  headers: {
25
25
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
26
26
  ...formData.getHeaders(),
@@ -9,7 +9,7 @@ class AppGoogleServiceAccountKeysServiceImpl {
9
9
  async create(dto) {
10
10
  const formData = new FormData();
11
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, {
12
+ const response = await this.httpClient.post(`/v1/apps/${dto.appId}/google-service-account-keys`, formData.getBuffer(), {
13
13
  headers: {
14
14
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
15
15
  ...formData.getHeaders(),
@@ -12,7 +12,7 @@ class AppProvisioningProfilesServiceImpl {
12
12
  if (dto.certificateId) {
13
13
  formData.append('certificateId', dto.certificateId);
14
14
  }
15
- const response = await this.httpClient.post(`/v1/apps/${dto.appId}/provisioning-profiles`, formData, {
15
+ const response = await this.httpClient.post(`/v1/apps/${dto.appId}/provisioning-profiles`, formData.getBuffer(), {
16
16
  headers: {
17
17
  Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
18
18
  ...formData.getHeaders(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "4.23.0",
3
+ "version": "4.23.1",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "type": "module",
6
6
  "scripts": {