@capgo/cli 4.10.16 → 4.10.17

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 [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.10.17](https://github.com/Cap-go/CLI/compare/v4.10.16...v4.10.17) (2024-06-13)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * remove old userId ([b263deb](https://github.com/Cap-go/CLI/commit/b263debe9b13fd68841c3a176f660863160a3872))
11
+
5
12
  ### [4.10.16](https://github.com/Cap-go/CLI/compare/v4.10.15...v4.10.16) (2024-06-13)
6
13
 
7
14
 
package/dist/index.js CHANGED
@@ -110243,7 +110243,7 @@ async function deletedFailedVersion(supabase, appId, name) {
110243
110243
  try {
110244
110244
  const pathFailed = "private/delete_failed_version";
110245
110245
  const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: "DELETE" });
110246
- return res.data.url;
110246
+ return res.data.status;
110247
110247
  } catch (error) {
110248
110248
  f2.error(`Cannot delete failed version ${formatError(error)}`);
110249
110249
  return Promise.reject(new Error("Cannot delete failed version"));
@@ -110508,7 +110508,7 @@ async function getUserId(options) {
110508
110508
  // package.json
110509
110509
  var package_default = {
110510
110510
  name: "@capgo/cli",
110511
- version: "4.10.16",
110511
+ version: "4.10.17",
110512
110512
  description: "A CLI to upload to capgo servers",
110513
110513
  author: "github.com/riderx",
110514
110514
  license: "Apache 2.0",
@@ -112288,7 +112288,7 @@ async function deleteAppVersion(supabase, appid, bundle2) {
112288
112288
  program.error("");
112289
112289
  }
112290
112290
  }
112291
- async function deleteSpecificVersion(supabase, appid, _userId, bundle2) {
112291
+ async function deleteSpecificVersion(supabase, appid, bundle2) {
112292
112292
  const versionData = await getVersionData(supabase, appid, bundle2);
112293
112293
  await checkVersionNotUsedInChannel(supabase, appid, versionData);
112294
112294
  await checkVersionNotUsedInDeviceOverride(supabase, appid, versionData);
@@ -112312,7 +112312,7 @@ function displayBundles(data) {
112312
112312
  });
112313
112313
  f2.success(t.render());
112314
112314
  }
112315
- async function getActiveAppVersions(supabase, appid, _userId) {
112315
+ async function getActiveAppVersions(supabase, appid) {
112316
112316
  const { data, error: vError } = await supabase.from("app_versions").select().eq("app_id", appid).eq("deleted", false).order("created_at", { ascending: false });
112317
112317
  if (vError) {
112318
112318
  f2.error(`App ${appid} not found in database`);
@@ -112353,10 +112353,10 @@ async function listBundle(appId, options) {
112353
112353
  program.error("");
112354
112354
  }
112355
112355
  const supabase = await createSupabaseClient(options.apikey);
112356
- const userId = await verifyUser(supabase, options.apikey, ["write", "all", "read", "upload"]);
112356
+ await verifyUser(supabase, options.apikey, ["write", "all", "read", "upload"]);
112357
112357
  f2.info(`Querying available versions of: ${appId} in Capgo`);
112358
112358
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, 1 /* read */);
112359
- const allVersions = await getActiveAppVersions(supabase, appId, userId);
112359
+ const allVersions = await getActiveAppVersions(supabase, appId);
112360
112360
  f2.info(`Active versions in Capgo: ${allVersions?.length}`);
112361
112361
  displayBundles(allVersions);
112362
112362
  $e(`Done \u2705`);
@@ -112529,7 +112529,7 @@ async function deleteBundle(bundleId, appId, options) {
112529
112529
  program.error("");
112530
112530
  }
112531
112531
  const supabase = await createSupabaseClient(options.apikey);
112532
- const userId = await verifyUser(supabase, options.apikey, ["write", "all"]);
112532
+ await verifyUser(supabase, options.apikey, ["write", "all"]);
112533
112533
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, 3 /* write */);
112534
112534
  appId = appId || config?.app?.appId;
112535
112535
  if (!options.apikey) {
@@ -112545,7 +112545,7 @@ async function deleteBundle(bundleId, appId, options) {
112545
112545
  program.error("");
112546
112546
  }
112547
112547
  f2.info(`Deleting bundle ${appId}@${bundleId} from Capgo`);
112548
- await deleteSpecificVersion(supabase, appId, userId, bundleId);
112548
+ await deleteSpecificVersion(supabase, appId, bundleId);
112549
112549
  f2.success(`Bundle ${appId}@${bundleId} deleted in Capgo`);
112550
112550
  $e(`Done`);
112551
112551
  import_node_process22.default.exit();
@@ -112754,10 +112754,10 @@ var import_node_process26 = __toESM(require("node:process"));
112754
112754
  var import_preload = __toESM(require_preload());
112755
112755
  var import_prompt_sync = __toESM(require_prompt_sync());
112756
112756
  var prompt = (0, import_prompt_sync.default)();
112757
- async function removeVersions(toRemove, supabase, appid, userId) {
112757
+ async function removeVersions(toRemove, supabase, appid) {
112758
112758
  for await (const row of toRemove) {
112759
112759
  f2.warn(`Removing ${row.name} created on ${getHumanDate(row.created_at)}`);
112760
- await deleteSpecificVersion(supabase, appid, userId, row.name);
112760
+ await deleteSpecificVersion(supabase, appid, row.name);
112761
112761
  }
112762
112762
  }
112763
112763
  function getRemovableVersionsInSemverRange(data, bundle2, nextMajor) {
@@ -112785,10 +112785,10 @@ async function cleanupBundle(appid, options) {
112785
112785
  program.error("");
112786
112786
  }
112787
112787
  const supabase = await createSupabaseClient(options.apikey);
112788
- const userId = await verifyUser(supabase, options.apikey, ["write", "all"]);
112788
+ await verifyUser(supabase, options.apikey, ["write", "all"]);
112789
112789
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appid, 3 /* write */);
112790
112790
  f2.info(`Querying all available versions in Capgo`);
112791
- let allVersions = await getActiveAppVersions(supabase, appid, userId);
112791
+ let allVersions = await getActiveAppVersions(supabase, appid);
112792
112792
  const versionInUse = await getChannelsVersion(supabase, appid);
112793
112793
  f2.info(`Total active versions in Capgo: ${allVersions?.length}`);
112794
112794
  if (allVersions?.length === 0) {
@@ -112829,7 +112829,7 @@ async function cleanupBundle(appid, options) {
112829
112829
  }
112830
112830
  }
112831
112831
  f2.success("You have confirmed removal, removing versions now");
112832
- await removeVersions(toRemove, supabase, appid, userId);
112832
+ await removeVersions(toRemove, supabase, appid);
112833
112833
  $e(`Done \u2705`);
112834
112834
  import_node_process26.default.exit();
112835
112835
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.10.16",
3
+ "version": "4.10.17",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
@@ -24,7 +24,7 @@ export async function deleteAppVersion(supabase: SupabaseClient<Database>, appid
24
24
  }
25
25
  }
26
26
 
27
- export async function deleteSpecificVersion(supabase: SupabaseClient<Database>, appid: string, _userId: string, bundle: string) {
27
+ export async function deleteSpecificVersion(supabase: SupabaseClient<Database>, appid: string, bundle: string) {
28
28
  const versionData = await getVersionData(supabase, appid, bundle)
29
29
  await checkVersionNotUsedInChannel(supabase, appid, versionData)
30
30
  await checkVersionNotUsedInDeviceOverride(supabase, appid, versionData)
@@ -55,12 +55,11 @@ export function displayBundles(data: (Database['public']['Tables']['app_versions
55
55
  p.log.success(t.render())
56
56
  }
57
57
 
58
- export async function getActiveAppVersions(supabase: SupabaseClient<Database>, appid: string, _userId: string) {
58
+ export async function getActiveAppVersions(supabase: SupabaseClient<Database>, appid: string) {
59
59
  const { data, error: vError } = await supabase
60
60
  .from('app_versions')
61
61
  .select()
62
62
  .eq('app_id', appid)
63
- // .eq('user_id', userId)
64
63
  .eq('deleted', false)
65
64
  .order('created_at', { ascending: false })
66
65
 
@@ -20,11 +20,11 @@ interface Options extends OptionsBase {
20
20
 
21
21
  const prompt = promptSync()
22
22
 
23
- async function removeVersions(toRemove: Database['public']['Tables']['app_versions']['Row'][], supabase: SupabaseClient<Database>, appid: string, userId: string) {
23
+ async function removeVersions(toRemove: Database['public']['Tables']['app_versions']['Row'][], supabase: SupabaseClient<Database>, appid: string) {
24
24
  // call deleteSpecificVersion one by one from toRemove sync
25
25
  for await (const row of toRemove) {
26
26
  p.log.warn(`Removing ${row.name} created on ${(getHumanDate(row.created_at))}`)
27
- await deleteSpecificVersion(supabase, appid, userId, row.name)
27
+ await deleteSpecificVersion(supabase, appid, row.name)
28
28
  }
29
29
  }
30
30
 
@@ -57,14 +57,14 @@ export async function cleanupBundle(appid: string, options: Options) {
57
57
  }
58
58
  const supabase = await createSupabaseClient(options.apikey)
59
59
 
60
- const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
60
+ await verifyUser(supabase, options.apikey, ['write', 'all'])
61
61
 
62
62
  // Check we have app access to this appId
63
63
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appid, OrganizationPerm.write)
64
64
  p.log.info(`Querying all available versions in Capgo`)
65
65
 
66
66
  // Get all active app versions we might possibly be able to cleanup
67
- let allVersions: (Database['public']['Tables']['app_versions']['Row'] & { keep?: string })[] = await getActiveAppVersions(supabase, appid, userId)
67
+ let allVersions: (Database['public']['Tables']['app_versions']['Row'] & { keep?: string })[] = await getActiveAppVersions(supabase, appid)
68
68
 
69
69
  const versionInUse = await getChannelsVersion(supabase, appid)
70
70
 
@@ -121,7 +121,7 @@ export async function cleanupBundle(appid: string, options: Options) {
121
121
 
122
122
  // Yes, lets clean it up
123
123
  p.log.success('You have confirmed removal, removing versions now')
124
- await removeVersions(toRemove, supabase, appid, userId)
124
+ await removeVersions(toRemove, supabase, appid)
125
125
  p.outro(`Done ✅`)
126
126
  process.exit()
127
127
  }
@@ -26,7 +26,7 @@ export async function deleteBundle(bundleId: string, appId: string, options: Opt
26
26
  }
27
27
  const supabase = await createSupabaseClient(options.apikey)
28
28
 
29
- const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
29
+ await verifyUser(supabase, options.apikey, ['write', 'all'])
30
30
  // Check we have app access to this appId
31
31
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, OrganizationPerm.write)
32
32
 
@@ -46,7 +46,7 @@ export async function deleteBundle(bundleId: string, appId: string, options: Opt
46
46
 
47
47
  p.log.info(`Deleting bundle ${appId}@${bundleId} from Capgo`)
48
48
 
49
- await deleteSpecificVersion(supabase, appId, userId, bundleId)
49
+ await deleteSpecificVersion(supabase, appId, bundleId)
50
50
  p.log.success(`Bundle ${appId}@${bundleId} deleted in Capgo`)
51
51
  p.outro(`Done`)
52
52
  process.exit()
@@ -25,7 +25,7 @@ export async function listBundle(appId: string, options: OptionsBase) {
25
25
 
26
26
  const supabase = await createSupabaseClient(options.apikey)
27
27
 
28
- const userId = await verifyUser(supabase, options.apikey, ['write', 'all', 'read', 'upload'])
28
+ await verifyUser(supabase, options.apikey, ['write', 'all', 'read', 'upload'])
29
29
 
30
30
  p.log.info(`Querying available versions of: ${appId} in Capgo`)
31
31
 
@@ -33,7 +33,7 @@ export async function listBundle(appId: string, options: OptionsBase) {
33
33
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, OrganizationPerm.read)
34
34
 
35
35
  // Get all active app versions we might possibly be able to cleanup
36
- const allVersions = await getActiveAppVersions(supabase, appId, userId)
36
+ const allVersions = await getActiveAppVersions(supabase, appId)
37
37
 
38
38
  p.log.info(`Active versions in Capgo: ${allVersions?.length}`)
39
39
 
package/src/utils.ts CHANGED
@@ -589,7 +589,7 @@ export async function deletedFailedVersion(supabase: SupabaseClient<Database>, a
589
589
  try {
590
590
  const pathFailed = 'private/delete_failed_version'
591
591
  const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: 'DELETE' })
592
- return res.data.url
592
+ return res.data.status
593
593
  }
594
594
  catch (error) {
595
595
  p.log.error(`Cannot delete failed version ${formatError(error)}`)