@capgo/cli 4.9.2 → 4.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.9.2",
3
+ "version": "4.10.0",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
package/src/app/add.ts CHANGED
@@ -53,13 +53,10 @@ export async function addAppInternal(appId: string, options: Options, organizati
53
53
 
54
54
  // Check we have app access to this appId
55
55
  const appExist = await checkAppExists(supabase, appId)
56
- if (throwErr && appExist) {
56
+ if (appExist) {
57
57
  p.log.error(`App ${appId} already exist`)
58
58
  program.error('')
59
59
  }
60
- else if (appExist) {
61
- return false
62
- }
63
60
 
64
61
  if (!organization)
65
62
  organization = await getOrganization(supabase, ['admin', 'super_admin'])
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { program } from 'commander'
2
+ import { getUserId } from 'user/account'
2
3
  import pack from '../package.json'
3
4
  import { zipBundle } from './bundle/zip'
4
5
  import { initApp } from './init'
@@ -293,4 +294,14 @@ program
293
294
  'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel',
294
295
  )
295
296
 
297
+ const user = program
298
+ .command('user')
299
+ .description('Manage user')
300
+
301
+ user.command('account')
302
+ .alias('a')
303
+ .description('Get your account ID')
304
+ .action(getUserId)
305
+ .option('-a, --apikey <apikey>', 'apikey to link to your account')
306
+
296
307
  program.parseAsync()
@@ -0,0 +1,11 @@
1
+ import * as p from '@clack/prompts'
2
+ import { createSupabaseClient, findSavedKey, verifyUser } from '../utils'
3
+ import type { Options } from '../api/app'
4
+
5
+ export async function getUserId(options: Options) {
6
+ p.intro(`Getting user id`)
7
+ options.apikey = options.apikey || findSavedKey()
8
+ const supabase = await createSupabaseClient(options.apikey)
9
+ const userId = await verifyUser(supabase, options.apikey, ['read'])
10
+ p.outro(`Done ✅: ${userId}`)
11
+ }