@capgo/cli 4.12.0 → 4.12.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 +14 -0
- package/dist/index.js +13 -11
- package/package.json +1 -1
- package/src/bundle/upload.ts +10 -9
- package/src/types/supabase.types.ts +5 -0
- package/src/utils.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.12.2](https://github.com/Cap-go/CLI/compare/v4.12.1...v4.12.2) (2024-07-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* issue with upload ([ca08aec](https://github.com/Cap-go/CLI/commit/ca08aec7f38e1ae9c431ba35764f8659b23692e1))
|
|
11
|
+
|
|
12
|
+
### [4.12.1](https://github.com/Cap-go/CLI/compare/v4.12.0...v4.12.1) (2024-07-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* types ([3ee5a38](https://github.com/Cap-go/CLI/commit/3ee5a3872d2b74894e42b26c492a572edae2baa3))
|
|
18
|
+
|
|
5
19
|
## [4.12.0](https://github.com/Cap-go/CLI/compare/v4.11.7...v4.12.0) (2024-07-08)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.js
CHANGED
|
@@ -87381,7 +87381,7 @@ var {
|
|
|
87381
87381
|
// package.json
|
|
87382
87382
|
var package_default = {
|
|
87383
87383
|
name: "@capgo/cli",
|
|
87384
|
-
version: "4.12.
|
|
87384
|
+
version: "4.12.2",
|
|
87385
87385
|
description: "A CLI to upload to capgo servers",
|
|
87386
87386
|
author: "github.com/riderx",
|
|
87387
87387
|
license: "Apache 2.0",
|
|
@@ -89188,7 +89188,9 @@ async function getLocalDepenencies() {
|
|
|
89188
89188
|
return dependenciesObject;
|
|
89189
89189
|
}
|
|
89190
89190
|
async function getRemoteChecksums(supabase, appId, channel2) {
|
|
89191
|
-
const { data, error } = await supabase.from("channels").select(`version (
|
|
89191
|
+
const { data, error } = await supabase.from("channels").select(`version (
|
|
89192
|
+
checksum
|
|
89193
|
+
)`).eq("name", channel2).eq("app_id", appId).single();
|
|
89192
89194
|
if (error || data === null || !data.version || !data.version.checksum) {
|
|
89193
89195
|
f2.error(`Cannot get remote checksum for channel ${channel2}`);
|
|
89194
89196
|
f2.error(`Error: ${error?.message}`);
|
|
@@ -90223,8 +90225,8 @@ async function uploadBundleToCapgoCloud(supabase, appid, bundle2, orgId, zipped,
|
|
|
90223
90225
|
const uploadTime = ((endTime - startTime) / 1e3).toFixed(2);
|
|
90224
90226
|
spinner.stop(`Bundle Uploaded \u{1F4AA} (${uploadTime} seconds)`);
|
|
90225
90227
|
}
|
|
90226
|
-
async function setVersionInChannel(supabase,
|
|
90227
|
-
const { data: versionId } = await supabase.rpc("get_app_versions", { apikey
|
|
90228
|
+
async function setVersionInChannel(supabase, apikey, displayBundleUrl, bundle2, channel2, userId, orgId, appid, localConfig, permissions) {
|
|
90229
|
+
const { data: versionId } = await supabase.rpc("get_app_versions", { apikey, name_version: bundle2, appid }).single();
|
|
90228
90230
|
if (versionId && hasOrganizationPerm(permissions, 3 /* write */)) {
|
|
90229
90231
|
const { error: dbError3, data } = await updateOrCreateChannel(supabase, {
|
|
90230
90232
|
name: channel2,
|
|
@@ -90243,7 +90245,7 @@ async function setVersionInChannel(supabase, options, bundle2, channel2, userId,
|
|
|
90243
90245
|
f2.info("Your update is now available in your public channel \u{1F389}");
|
|
90244
90246
|
else if (data?.id)
|
|
90245
90247
|
f2.info(`Link device to this bundle to try it: ${bundleUrl}`);
|
|
90246
|
-
if (
|
|
90248
|
+
if (displayBundleUrl) {
|
|
90247
90249
|
f2.info(`Bundle url: ${bundleUrl}`);
|
|
90248
90250
|
} else if (!versionId) {
|
|
90249
90251
|
f2.warn("Cannot set bundle with upload key, use key with more rights for that");
|
|
@@ -90283,7 +90285,7 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
|
|
|
90283
90285
|
const userId = await verifyUser(supabase, apikey, ["write", "all", "upload"]);
|
|
90284
90286
|
const permissions = await checkAppExistsAndHasPermissionOrgErr(supabase, apikey, appid, 2 /* upload */);
|
|
90285
90287
|
const orgId = await getOrganizationId(supabase, appid);
|
|
90286
|
-
await checkPlanValid(supabase, orgId,
|
|
90288
|
+
await checkPlanValid(supabase, orgId, apikey, appid, true);
|
|
90287
90289
|
await checkTrial(supabase, orgId, localConfig);
|
|
90288
90290
|
const { nativePackages, minUpdateVersion } = await verifyCompatibility(supabase, pm2, options, channel2, appid, bundle2);
|
|
90289
90291
|
await checkVersionExists(supabase, appid, bundle2);
|
|
@@ -90328,7 +90330,7 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
|
|
|
90328
90330
|
program.error("");
|
|
90329
90331
|
}
|
|
90330
90332
|
}
|
|
90331
|
-
await setVersionInChannel(supabase, options, bundle2, channel2, userId, orgId, appid, localConfig, permissions);
|
|
90333
|
+
await setVersionInChannel(supabase, apikey, !!options.bundleUrl, bundle2, channel2, userId, orgId, appid, localConfig, permissions);
|
|
90332
90334
|
await snag.track({
|
|
90333
90335
|
channel: "app",
|
|
90334
90336
|
event: "App Uploaded",
|
|
@@ -90345,19 +90347,19 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
|
|
|
90345
90347
|
}
|
|
90346
90348
|
return true;
|
|
90347
90349
|
}
|
|
90348
|
-
async function uploadCommand(
|
|
90350
|
+
async function uploadCommand(appid, options) {
|
|
90349
90351
|
try {
|
|
90350
|
-
await uploadBundle(
|
|
90352
|
+
await uploadBundle(appid, options, true);
|
|
90351
90353
|
} catch (error) {
|
|
90352
90354
|
f2.error(formatError(error));
|
|
90353
90355
|
program.error("");
|
|
90354
90356
|
}
|
|
90355
90357
|
}
|
|
90356
|
-
async function uploadDeprecatedCommand(
|
|
90358
|
+
async function uploadDeprecatedCommand(appid, options) {
|
|
90357
90359
|
const pm2 = getPMAndCommand();
|
|
90358
90360
|
f2.warn(`\u26A0\uFE0F This command is deprecated, use "${pm2.runner} @capgo/cli bundle upload" instead \u26A0\uFE0F`);
|
|
90359
90361
|
try {
|
|
90360
|
-
await uploadBundle(
|
|
90362
|
+
await uploadBundle(appid, options, true);
|
|
90361
90363
|
} catch (error) {
|
|
90362
90364
|
f2.error(formatError(error));
|
|
90363
90365
|
program.error("");
|
package/package.json
CHANGED
package/src/bundle/upload.ts
CHANGED
|
@@ -343,7 +343,8 @@ async function uploadBundleToCapgoCloud(supabase: SupabaseType, appid: string, b
|
|
|
343
343
|
|
|
344
344
|
async function setVersionInChannel(
|
|
345
345
|
supabase: SupabaseType,
|
|
346
|
-
|
|
346
|
+
apikey: string,
|
|
347
|
+
displayBundleUrl: boolean,
|
|
347
348
|
bundle: string,
|
|
348
349
|
channel: string,
|
|
349
350
|
userId: string,
|
|
@@ -353,7 +354,7 @@ async function setVersionInChannel(
|
|
|
353
354
|
permissions: OrganizationPerm,
|
|
354
355
|
) {
|
|
355
356
|
const { data: versionId } = await supabase
|
|
356
|
-
.rpc('get_app_versions', { apikey
|
|
357
|
+
.rpc('get_app_versions', { apikey, name_version: bundle, appid })
|
|
357
358
|
.single()
|
|
358
359
|
|
|
359
360
|
if (versionId && hasOrganizationPerm(permissions, OrganizationPerm.write)) {
|
|
@@ -375,7 +376,7 @@ async function setVersionInChannel(
|
|
|
375
376
|
else if (data?.id)
|
|
376
377
|
p.log.info(`Link device to this bundle to try it: ${bundleUrl}`)
|
|
377
378
|
|
|
378
|
-
if (
|
|
379
|
+
if (displayBundleUrl) {
|
|
379
380
|
p.log.info(`Bundle url: ${bundleUrl}`)
|
|
380
381
|
}
|
|
381
382
|
else if (!versionId) {
|
|
@@ -436,7 +437,7 @@ export async function uploadBundle(preAppid: string, options: Options, shouldExi
|
|
|
436
437
|
|
|
437
438
|
// Now if it does exist we will fetch the org id
|
|
438
439
|
const orgId = await getOrganizationId(supabase, appid)
|
|
439
|
-
await checkPlanValid(supabase, orgId,
|
|
440
|
+
await checkPlanValid(supabase, orgId, apikey, appid, true)
|
|
440
441
|
await checkTrial(supabase, orgId, localConfig)
|
|
441
442
|
const { nativePackages, minUpdateVersion } = await verifyCompatibility(supabase, pm, options, channel, appid, bundle)
|
|
442
443
|
await checkVersionExists(supabase, appid, bundle)
|
|
@@ -488,7 +489,7 @@ export async function uploadBundle(preAppid: string, options: Options, shouldExi
|
|
|
488
489
|
}
|
|
489
490
|
}
|
|
490
491
|
|
|
491
|
-
await setVersionInChannel(supabase, options, bundle, channel, userId, orgId, appid, localConfig, permissions)
|
|
492
|
+
await setVersionInChannel(supabase, apikey, !!options.bundleUrl, bundle, channel, userId, orgId, appid, localConfig, permissions)
|
|
492
493
|
|
|
493
494
|
await snag.track({
|
|
494
495
|
channel: 'app',
|
|
@@ -507,9 +508,9 @@ export async function uploadBundle(preAppid: string, options: Options, shouldExi
|
|
|
507
508
|
return true
|
|
508
509
|
}
|
|
509
510
|
|
|
510
|
-
export async function uploadCommand(
|
|
511
|
+
export async function uploadCommand(appid: string, options: Options) {
|
|
511
512
|
try {
|
|
512
|
-
await uploadBundle(
|
|
513
|
+
await uploadBundle(appid, options, true)
|
|
513
514
|
}
|
|
514
515
|
catch (error) {
|
|
515
516
|
p.log.error(formatError(error))
|
|
@@ -517,11 +518,11 @@ export async function uploadCommand(apikey: string, options: Options) {
|
|
|
517
518
|
}
|
|
518
519
|
}
|
|
519
520
|
|
|
520
|
-
export async function uploadDeprecatedCommand(
|
|
521
|
+
export async function uploadDeprecatedCommand(appid: string, options: Options) {
|
|
521
522
|
const pm = getPMAndCommand()
|
|
522
523
|
p.log.warn(`⚠️ This command is deprecated, use "${pm.runner} @capgo/cli bundle upload" instead ⚠️`)
|
|
523
524
|
try {
|
|
524
|
-
await uploadBundle(
|
|
525
|
+
await uploadBundle(appid, options, true)
|
|
525
526
|
}
|
|
526
527
|
catch (error) {
|
|
527
528
|
p.log.error(formatError(error))
|
|
@@ -1053,6 +1053,7 @@ export interface Database {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
users: {
|
|
1055
1055
|
Row: {
|
|
1056
|
+
ban_time: string | null
|
|
1056
1057
|
billing_email: string | null
|
|
1057
1058
|
country: string | null
|
|
1058
1059
|
created_at: string | null
|
|
@@ -1068,6 +1069,7 @@ export interface Database {
|
|
|
1068
1069
|
updated_at: string | null
|
|
1069
1070
|
}
|
|
1070
1071
|
Insert: {
|
|
1072
|
+
ban_time?: string | null
|
|
1071
1073
|
billing_email?: string | null
|
|
1072
1074
|
country?: string | null
|
|
1073
1075
|
created_at?: string | null
|
|
@@ -1083,6 +1085,7 @@ export interface Database {
|
|
|
1083
1085
|
updated_at?: string | null
|
|
1084
1086
|
}
|
|
1085
1087
|
Update: {
|
|
1088
|
+
ban_time?: string | null
|
|
1086
1089
|
billing_email?: string | null
|
|
1087
1090
|
country?: string | null
|
|
1088
1091
|
created_at?: string | null
|
|
@@ -1985,6 +1988,8 @@ export interface Database {
|
|
|
1985
1988
|
| 'cannotGetBundle'
|
|
1986
1989
|
| 'checksum_fail'
|
|
1987
1990
|
| 'NoChannelOrOverride'
|
|
1991
|
+
| 'setChannel'
|
|
1992
|
+
| 'getChannel'
|
|
1988
1993
|
stripe_status:
|
|
1989
1994
|
| 'created'
|
|
1990
1995
|
| 'succeeded'
|
package/src/utils.ts
CHANGED
|
@@ -920,7 +920,9 @@ export async function getLocalDepenencies() {
|
|
|
920
920
|
export async function getRemoteChecksums(supabase: SupabaseClient<Database>, appId: string, channel: string) {
|
|
921
921
|
const { data, error } = await supabase
|
|
922
922
|
.from('channels')
|
|
923
|
-
.select(`version (
|
|
923
|
+
.select(`version (
|
|
924
|
+
checksum
|
|
925
|
+
)`)
|
|
924
926
|
.eq('name', channel)
|
|
925
927
|
.eq('app_id', appId)
|
|
926
928
|
.single()
|