@capgo/cli 4.3.6 → 4.4.2

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,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.4.2](https://github.com/Cap-go/CLI/compare/v4.4.1...v4.4.2) (2024-04-23)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * downgrade min version to node 18 ([b2da10b](https://github.com/Cap-go/CLI/commit/b2da10bd3fdc54a43d01c1700cfa08937ea278fa))
11
+
12
+ ### [4.4.1](https://github.com/Cap-go/CLI/compare/v4.4.0...v4.4.1) (2024-04-21)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * lint issue auto delete ([3d343e2](https://github.com/Cap-go/CLI/commit/3d343e29522b4de725836965c9ec2aabcf469171))
18
+
19
+ ## [4.4.0](https://github.com/Cap-go/CLI/compare/v4.3.6...v4.4.0) (2024-04-21)
20
+
21
+
22
+ ### Features
23
+
24
+ * add auto delete Failed Versions upload ([8ba691c](https://github.com/Cap-go/CLI/commit/8ba691c116b92ababa2870fd5ed9479b9286242d))
25
+
5
26
  ### [4.3.6](https://github.com/Cap-go/CLI/compare/v4.3.5...v4.3.6) (2024-04-21)
6
27
 
7
28
 
package/dist/index.js CHANGED
@@ -91634,7 +91634,7 @@ var {
91634
91634
  // package.json
91635
91635
  var package_default = {
91636
91636
  name: "@capgo/cli",
91637
- version: "4.3.6",
91637
+ version: "4.4.2",
91638
91638
  description: "A CLI to upload to capgo servers",
91639
91639
  main: "dist/index.js",
91640
91640
  bin: {
@@ -91650,7 +91650,7 @@ var package_default = {
91650
91650
  homepage: "https://github.com/Cap-go/CLIl#readme",
91651
91651
  engines: {
91652
91652
  npm: ">=8.0.0",
91653
- node: ">=20.0.0"
91653
+ node: ">=18.0.0"
91654
91654
  },
91655
91655
  keywords: [
91656
91656
  "appflow alternative",
@@ -93079,6 +93079,20 @@ async function uploadUrl(supabase, appId, name) {
93079
93079
  }
93080
93080
  return "";
93081
93081
  }
93082
+ async function deletedFailedVersion(supabase, appId, name) {
93083
+ const data = {
93084
+ app_id: appId,
93085
+ name
93086
+ };
93087
+ try {
93088
+ const pathFailed = "private/delete_failed_version";
93089
+ const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: "DELETE" });
93090
+ return res.data.url;
93091
+ } catch (error) {
93092
+ f2.error(`Cannot delete failed version ${formatError(error)}`);
93093
+ return Promise.reject(new Error("Cannot delete failed version"));
93094
+ }
93095
+ }
93082
93096
  async function updateOrCreateChannel(supabase, update) {
93083
93097
  if (!update.app_id || !update.name || !update.created_by) {
93084
93098
  f2.error("missing app_id, name, or created_by");
@@ -94214,7 +94228,7 @@ The app size is ${mbSize} Mb, this may take a while to download for users
94214
94228
  }
94215
94229
  try {
94216
94230
  await distribution_default.put(url, {
94217
- timeout: 6e4,
94231
+ timeout: 2e4,
94218
94232
  retry: 5,
94219
94233
  body: zipped,
94220
94234
  headers: !localS3 ? {
@@ -94225,6 +94239,7 @@ The app size is ${mbSize} Mb, this may take a while to download for users
94225
94239
  });
94226
94240
  } catch (errorUpload) {
94227
94241
  f2.error(`Cannot upload bundle ${formatError(errorUpload)}`);
94242
+ await deletedFailedVersion(supabase, appid, bundle2);
94228
94243
  program.error("");
94229
94244
  }
94230
94245
  versionData.storage_provider = "r2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.3.6",
3
+ "version": "4.4.2",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "homepage": "https://github.com/Cap-go/CLIl#readme",
17
17
  "engines": {
18
18
  "npm": ">=8.0.0",
19
- "node": ">=20.0.0"
19
+ "node": ">=18.0.0"
20
20
  },
21
21
  "keywords": [
22
22
  "appflow alternative",
@@ -26,6 +26,7 @@ import {
26
26
  checkPlanValid,
27
27
  convertAppName,
28
28
  createSupabaseClient,
29
+ deletedFailedVersion,
29
30
  findSavedKey,
30
31
  formatError,
31
32
  getAppOwner,
@@ -388,7 +389,7 @@ It will be also visible in your dashboard\n`)
388
389
  }
389
390
  try {
390
391
  await ky.put(url, {
391
- timeout: 60000,
392
+ timeout: 20000,
392
393
  retry: 5,
393
394
  body: zipped,
394
395
  headers: (!localS3
@@ -402,6 +403,8 @@ It will be also visible in your dashboard\n`)
402
403
  }
403
404
  catch (errorUpload) {
404
405
  p.log.error(`Cannot upload bundle ${formatError(errorUpload)}`)
406
+ // call delete version on path /delete_failed_version to delete the version
407
+ await deletedFailedVersion(supabase, appid, bundle)
405
408
  program.error('')
406
409
  }
407
410
  versionData.storage_provider = 'r2'
package/src/utils.ts CHANGED
@@ -426,6 +426,22 @@ export async function uploadUrl(supabase: SupabaseClient<Database>, appId: strin
426
426
  return ''
427
427
  }
428
428
 
429
+ export async function deletedFailedVersion(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<void> {
430
+ const data = {
431
+ app_id: appId,
432
+ name,
433
+ }
434
+ try {
435
+ const pathFailed = 'private/delete_failed_version'
436
+ const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: 'DELETE' })
437
+ return res.data.url
438
+ }
439
+ catch (error) {
440
+ p.log.error(`Cannot delete failed version ${formatError(error)}`)
441
+ return Promise.reject(new Error('Cannot delete failed version'))
442
+ }
443
+ }
444
+
429
445
  export async function updateOrCreateChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']) {
430
446
  // console.log('updateOrCreateChannel', update)
431
447
  if (!update.app_id || !update.name || !update.created_by) {