@capgo/cli 4.10.7 → 4.10.10

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.10.7",
3
+ "version": "4.10.10",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
@@ -43,20 +43,20 @@
43
43
  "lint": "eslint \"src/**/*.ts\" --fix"
44
44
  },
45
45
  "dependencies": {
46
- "@aws-sdk/client-s3": "^3.574.0",
46
+ "@aws-sdk/client-s3": "^3.588.0",
47
47
  "@capacitor/cli": "6.0.0",
48
48
  "@capgo/find-package-manager": "^0.0.17",
49
49
  "@clack/prompts": "^0.7.0",
50
50
  "@manypkg/find-root": "^2.2.1",
51
- "@supabase/supabase-js": "^2.43.1",
51
+ "@supabase/supabase-js": "^2.43.4",
52
52
  "@tomasklaen/checksum": "^1.1.0",
53
53
  "@trufflesuite/spinnies": "^0.1.1",
54
- "adm-zip": "^0.5.12",
54
+ "adm-zip": "^0.5.13",
55
55
  "ci-info": "^4.0.0",
56
- "commander": "12.0.0",
56
+ "commander": "12.1.0",
57
57
  "console-table-printer": "^2.12.0",
58
58
  "get-latest-version": "^5.1.0",
59
- "ky": "^1.2.4",
59
+ "ky": "^1.3.0",
60
60
  "logsnag": "1.0.0",
61
61
  "mime": "^4.0.3",
62
62
  "node-dir": "^0.1.17",
@@ -66,19 +66,19 @@
66
66
  "semver": "^7.6.2"
67
67
  },
68
68
  "devDependencies": {
69
- "@antfu/eslint-config": "^2.17.0",
69
+ "@antfu/eslint-config": "^2.20.0",
70
70
  "@types/adm-zip": "0.5.5",
71
71
  "@types/mime": "^4.0.0",
72
- "@types/node": "^20.12.7",
72
+ "@types/node": "^20.14.0",
73
73
  "@types/node-dir": "^0.0.37",
74
74
  "@types/npmcli__ci-detect": "^2.0.3",
75
75
  "@types/prettyjson": "^0.0.33",
76
76
  "@types/prompt-sync": "^4.2.3",
77
77
  "@types/semver": "^7.5.8",
78
- "@typescript-eslint/eslint-plugin": "^7.8.0",
79
- "@typescript-eslint/parser": "^7.8.0",
80
- "esbuild": "^0.21.2",
81
- "eslint": "9.1.1",
78
+ "@typescript-eslint/eslint-plugin": "^7.12.0",
79
+ "@typescript-eslint/parser": "^7.12.0",
80
+ "esbuild": "^0.21.4",
81
+ "eslint": "9.4.0",
82
82
  "git-format-staged": "3.1.1",
83
83
  "husky": "^9.0.11",
84
84
  "pkg": "5.8.1",
@@ -8,7 +8,7 @@ import { program } from 'commander'
8
8
  import * as p from '@clack/prompts'
9
9
  import { checksum as getChecksum } from '@tomasklaen/checksum'
10
10
  import ciDetect from 'ci-info'
11
- import ky from 'ky'
11
+ import ky, { HTTPError } from 'ky'
12
12
  import {
13
13
  PutObjectCommand,
14
14
  S3Client,
@@ -395,7 +395,6 @@ It will be also visible in your dashboard\n`)
395
395
  p.log.error(`Cannot get upload url`)
396
396
  program.error('')
397
397
  }
398
-
399
398
  await ky.put(url, {
400
399
  timeout: options.timeout || UPLOAD_TIMEOUT,
401
400
  retry: 5,
@@ -415,6 +414,11 @@ It will be also visible in your dashboard\n`)
415
414
  const uploadTime = ((endTime - startTime) / 1000).toFixed(2)
416
415
  spinner.stop(`Failed to upload bundle ( after ${uploadTime} seconds)`)
417
416
  p.log.error(`Cannot upload bundle ${formatError(errorUpload)}`)
417
+ if (errorUpload instanceof HTTPError) {
418
+ const body = await errorUpload.response.text()
419
+ p.log.error(`Response: ${formatError(body)}`)
420
+ program.error('')
421
+ }
418
422
  // call delete version on path /delete_failed_version to delete the version
419
423
  await deletedFailedVersion(supabase, appid, bundle)
420
424
  program.error('')
@@ -411,129 +411,6 @@ export interface Database {
411
411
  },
412
412
  ]
413
413
  }
414
- clickhouse_app_usage_parm: {
415
- Row: {
416
- _app_list: string | null
417
- _end_date: string | null
418
- _start_date: string | null
419
- app_id: string | null
420
- bandwidth: number | null
421
- date: string | null
422
- fail: number | null
423
- get: number | null
424
- install: number | null
425
- mau: number | null
426
- storage_added: number | null
427
- storage_deleted: number | null
428
- uninstall: number | null
429
- }
430
- Insert: {
431
- _app_list?: string | null
432
- _end_date?: string | null
433
- _start_date?: string | null
434
- app_id?: string | null
435
- bandwidth?: number | null
436
- date?: string | null
437
- fail?: number | null
438
- get?: number | null
439
- install?: number | null
440
- mau?: number | null
441
- storage_added?: number | null
442
- storage_deleted?: number | null
443
- uninstall?: number | null
444
- }
445
- Update: {
446
- _app_list?: string | null
447
- _end_date?: string | null
448
- _start_date?: string | null
449
- app_id?: string | null
450
- bandwidth?: number | null
451
- date?: string | null
452
- fail?: number | null
453
- get?: number | null
454
- install?: number | null
455
- mau?: number | null
456
- storage_added?: number | null
457
- storage_deleted?: number | null
458
- uninstall?: number | null
459
- }
460
- Relationships: []
461
- }
462
- clickhouse_devices: {
463
- Row: {
464
- app_id: string | null
465
- created_at: string | null
466
- custom_id: string | null
467
- device_id: string | null
468
- is_emulator: boolean | null
469
- is_prod: boolean | null
470
- os_version: string | null
471
- platform: string | null
472
- plugin_version: string | null
473
- updated_at: string | null
474
- version: number | null
475
- version_build: string | null
476
- }
477
- Insert: {
478
- app_id?: string | null
479
- created_at?: string | null
480
- custom_id?: string | null
481
- device_id?: string | null
482
- is_emulator?: boolean | null
483
- is_prod?: boolean | null
484
- os_version?: string | null
485
- platform?: string | null
486
- plugin_version?: string | null
487
- updated_at?: string | null
488
- version?: number | null
489
- version_build?: string | null
490
- }
491
- Update: {
492
- app_id?: string | null
493
- created_at?: string | null
494
- custom_id?: string | null
495
- device_id?: string | null
496
- is_emulator?: boolean | null
497
- is_prod?: boolean | null
498
- os_version?: string | null
499
- platform?: string | null
500
- plugin_version?: string | null
501
- updated_at?: string | null
502
- version?: number | null
503
- version_build?: string | null
504
- }
505
- Relationships: []
506
- }
507
- clickhouse_logs: {
508
- Row: {
509
- action: string | null
510
- app_id: string | null
511
- created_at: string | null
512
- device_id: string | null
513
- platform: string | null
514
- version: number | null
515
- version_build: string | null
516
- }
517
- Insert: {
518
- action?: string | null
519
- app_id?: string | null
520
- created_at?: string | null
521
- device_id?: string | null
522
- platform?: string | null
523
- version?: number | null
524
- version_build?: string | null
525
- }
526
- Update: {
527
- action?: string | null
528
- app_id?: string | null
529
- created_at?: string | null
530
- device_id?: string | null
531
- platform?: string | null
532
- version?: number | null
533
- version_build?: string | null
534
- }
535
- Relationships: []
536
- }
537
414
  daily_bandwidth: {
538
415
  Row: {
539
416
  app_id: string
@@ -669,13 +546,12 @@ export interface Database {
669
546
  devices: {
670
547
  Row: {
671
548
  app_id: string
672
- created_at: string
673
549
  custom_id: string
674
550
  device_id: string
675
551
  is_emulator: boolean | null
676
552
  is_prod: boolean | null
677
553
  os_version: string | null
678
- platform: Database['public']['Enums']['platform_os'] | null
554
+ platform: Database['public']['Enums']['platform_os']
679
555
  plugin_version: string
680
556
  updated_at: string
681
557
  version: number
@@ -683,13 +559,12 @@ export interface Database {
683
559
  }
684
560
  Insert: {
685
561
  app_id: string
686
- created_at: string
687
562
  custom_id?: string
688
563
  device_id: string
689
564
  is_emulator?: boolean | null
690
565
  is_prod?: boolean | null
691
566
  os_version?: string | null
692
- platform?: Database['public']['Enums']['platform_os'] | null
567
+ platform: Database['public']['Enums']['platform_os']
693
568
  plugin_version?: string
694
569
  updated_at: string
695
570
  version: number
@@ -697,13 +572,12 @@ export interface Database {
697
572
  }
698
573
  Update: {
699
574
  app_id?: string
700
- created_at?: string
701
575
  custom_id?: string
702
576
  device_id?: string
703
577
  is_emulator?: boolean | null
704
578
  is_prod?: boolean | null
705
579
  os_version?: string | null
706
- platform?: Database['public']['Enums']['platform_os'] | null
580
+ platform?: Database['public']['Enums']['platform_os']
707
581
  plugin_version?: string
708
582
  updated_at?: string
709
583
  version?: number
@@ -1072,31 +946,25 @@ export interface Database {
1072
946
  }
1073
947
  stats: {
1074
948
  Row: {
1075
- action: string
949
+ action: Database['public']['Enums']['stats_action']
1076
950
  app_id: string
1077
951
  created_at: string
1078
952
  device_id: string
1079
- platform: Database['public']['Enums']['platform_os']
1080
953
  version: number
1081
- version_build: string
1082
954
  }
1083
955
  Insert: {
1084
- action: string
956
+ action: Database['public']['Enums']['stats_action']
1085
957
  app_id: string
1086
958
  created_at: string
1087
959
  device_id: string
1088
- platform: Database['public']['Enums']['platform_os']
1089
960
  version: number
1090
- version_build: string
1091
961
  }
1092
962
  Update: {
1093
- action?: string
963
+ action?: Database['public']['Enums']['stats_action']
1094
964
  app_id?: string
1095
965
  created_at?: string
1096
966
  device_id?: string
1097
- platform?: Database['public']['Enums']['platform_os']
1098
967
  version?: number
1099
- version_build?: string
1100
968
  }
1101
969
  Relationships: []
1102
970
  }
@@ -1266,19 +1134,19 @@ export interface Database {
1266
1134
  }
1267
1135
  version_usage: {
1268
1136
  Row: {
1269
- action: string
1137
+ action: Database['public']['Enums']['version_action']
1270
1138
  app_id: string
1271
1139
  timestamp: string
1272
1140
  version_id: number
1273
1141
  }
1274
1142
  Insert: {
1275
- action: string
1143
+ action: Database['public']['Enums']['version_action']
1276
1144
  app_id: string
1277
1145
  timestamp?: string
1278
1146
  version_id: number
1279
1147
  }
1280
1148
  Update: {
1281
- action?: string
1149
+ action?: Database['public']['Enums']['version_action']
1282
1150
  app_id?: string
1283
1151
  timestamp?: string
1284
1152
  version_id?: number
@@ -1608,6 +1476,13 @@ export interface Database {
1608
1476
  role: Database['public']['Enums']['user_min_right']
1609
1477
  }[]
1610
1478
  }
1479
+ get_org_owner_id: {
1480
+ Args: {
1481
+ apikey: string
1482
+ app_id: string
1483
+ }
1484
+ Returns: string
1485
+ }
1611
1486
  get_org_perm_for_apikey: {
1612
1487
  Args: {
1613
1488
  apikey: string
@@ -1717,16 +1592,6 @@ export interface Database {
1717
1592
  uninstall: number
1718
1593
  }[]
1719
1594
  }
1720
- get_total_stats_v5_org: {
1721
- Args: {
1722
- orgid: string
1723
- }
1724
- Returns: {
1725
- mau: number
1726
- bandwidth: number
1727
- storage: number
1728
- }[]
1729
- }
1730
1595
  get_total_storage_size:
1731
1596
  | {
1732
1597
  Args: {
@@ -1798,6 +1663,14 @@ export interface Database {
1798
1663
  }
1799
1664
  Returns: boolean
1800
1665
  }
1666
+ http_post_helper: {
1667
+ Args: {
1668
+ function_name: string
1669
+ function_type: string
1670
+ body: Json
1671
+ }
1672
+ Returns: number
1673
+ }
1801
1674
  invite_user_to_org: {
1802
1675
  Args: {
1803
1676
  email: string
@@ -1846,27 +1719,6 @@ export interface Database {
1846
1719
  }
1847
1720
  Returns: boolean
1848
1721
  }
1849
- | {
1850
- Args: {
1851
- apikey: string
1852
- keymode: Database['public']['Enums']['key_mode'][]
1853
- app_id: string
1854
- channel_id: number
1855
- right: Database['public']['Enums']['user_min_right']
1856
- user_id: string
1857
- }
1858
- Returns: boolean
1859
- }
1860
- | {
1861
- Args: {
1862
- apikey: string
1863
- keymode: Database['public']['Enums']['key_mode'][]
1864
- app_id: string
1865
- right: Database['public']['Enums']['user_min_right']
1866
- user_id: string
1867
- }
1868
- Returns: boolean
1869
- }
1870
1722
  is_app_owner:
1871
1723
  | {
1872
1724
  Args: {
@@ -2061,6 +1913,32 @@ export interface Database {
2061
1913
  pay_as_you_go_type: 'base' | 'units'
2062
1914
  platform_os: 'ios' | 'android'
2063
1915
  queue_job_status: 'inserted' | 'requested' | 'failed'
1916
+ stats_action:
1917
+ | 'delete'
1918
+ | 'reset'
1919
+ | 'set'
1920
+ | 'get'
1921
+ | 'set_fail'
1922
+ | 'update_fail'
1923
+ | 'download_fail'
1924
+ | 'windows_path_fail'
1925
+ | 'canonical_path_fail'
1926
+ | 'directory_path_fail'
1927
+ | 'unzip_fail'
1928
+ | 'low_mem_fail'
1929
+ | 'download_10'
1930
+ | 'download_20'
1931
+ | 'download_30'
1932
+ | 'download_40'
1933
+ | 'download_50'
1934
+ | 'download_60'
1935
+ | 'download_70'
1936
+ | 'download_80'
1937
+ | 'download_90'
1938
+ | 'download_complete'
1939
+ | 'decrypt_fail'
1940
+ | 'app_moved_to_foreground'
1941
+ | 'app_moved_to_background'
2064
1942
  stripe_status:
2065
1943
  | 'created'
2066
1944
  | 'succeeded'
@@ -2081,6 +1959,7 @@ export interface Database {
2081
1959
  | 'admin'
2082
1960
  | 'super_admin'
2083
1961
  user_role: 'read' | 'upload' | 'write' | 'admin'
1962
+ version_action: 'get' | 'fail' | 'install' | 'uninstall'
2084
1963
  }
2085
1964
  CompositeTypes: {
2086
1965
  match_plan: {
package/src/utils.ts CHANGED
@@ -27,7 +27,7 @@ export type ArrayElement<ArrayType extends readonly unknown[]> =
27
27
  ArrayType extends readonly (infer ElementType)[] ? ElementType : never
28
28
  export type Organization = ArrayElement<Database['public']['Functions']['get_orgs_v5']['Returns']>
29
29
 
30
- export const regexSemver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
30
+ export const regexSemver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i
31
31
  export const formatError = (error: any) => error ? `\n${prettyjson.render(error)}` : ''
32
32
 
33
33
  export interface OptionsBase {
@@ -74,7 +74,7 @@ export async function getLocalConfig() {
74
74
  }
75
75
  }
76
76
  }
77
-
77
+ // eslint-disable-next-line regexp/no-unused-capturing-group
78
78
  const nativeFileRegex = /([A-Za-z0-9]+)\.(java|swift|kt|scala)$/
79
79
 
80
80
  interface CapgoConfig {
@@ -134,13 +134,6 @@ export async function checkKey(supabase: SupabaseClient<Database>, apikey: strin
134
134
  }
135
135
  }
136
136
 
137
- export async function isGoodPlan(supabase: SupabaseClient<Database>, userId: string): Promise<boolean> {
138
- const { data } = await supabase
139
- .rpc('is_good_plan_v5', { userid: userId })
140
- .single()
141
- return data || false
142
- }
143
-
144
137
  export async function isPayingOrg(supabase: SupabaseClient<Database>, orgId: string): Promise<boolean> {
145
138
  const { data } = await supabase
146
139
  .rpc('is_paying_org', { orgid: orgId })
@@ -326,10 +319,13 @@ async function* getFiles(dir: string): AsyncGenerator<string> {
326
319
  if (dirent.isDirectory()
327
320
  && !dirent.name.startsWith('.')
328
321
  && !dirent.name.startsWith('node_modules')
329
- && !dirent.name.startsWith('dist'))
322
+ && !dirent.name.startsWith('dist')) {
330
323
  yield * getFiles(res)
331
- else
324
+ }
325
+
326
+ else {
332
327
  yield res
328
+ }
333
329
  }
334
330
  }
335
331
 
@@ -418,6 +414,7 @@ export async function findBuildCommandForProjectType(projectType: string) {
418
414
  }
419
415
 
420
416
  export async function findMainFile() {
417
+ // eslint-disable-next-line regexp/no-unused-capturing-group
421
418
  const mainRegex = /(main|index)\.(ts|tsx|js|jsx)$/
422
419
  // search for main.ts or main.js in local dir and subdirs
423
420
  let mainFile = ''