@capgo/cli 4.12.1 → 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 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.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
+
5
12
  ### [4.12.1](https://github.com/Cap-go/CLI/compare/v4.12.0...v4.12.1) (2024-07-08)
6
13
 
7
14
 
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.1",
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",
@@ -90225,8 +90225,8 @@ async function uploadBundleToCapgoCloud(supabase, appid, bundle2, orgId, zipped,
90225
90225
  const uploadTime = ((endTime - startTime) / 1e3).toFixed(2);
90226
90226
  spinner.stop(`Bundle Uploaded \u{1F4AA} (${uploadTime} seconds)`);
90227
90227
  }
90228
- async function setVersionInChannel(supabase, options, bundle2, channel2, userId, orgId, appid, localConfig, permissions) {
90229
- const { data: versionId } = await supabase.rpc("get_app_versions", { apikey: options.apikey, name_version: bundle2, appid }).single();
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();
90230
90230
  if (versionId && hasOrganizationPerm(permissions, 3 /* write */)) {
90231
90231
  const { error: dbError3, data } = await updateOrCreateChannel(supabase, {
90232
90232
  name: channel2,
@@ -90245,7 +90245,7 @@ async function setVersionInChannel(supabase, options, bundle2, channel2, userId,
90245
90245
  f2.info("Your update is now available in your public channel \u{1F389}");
90246
90246
  else if (data?.id)
90247
90247
  f2.info(`Link device to this bundle to try it: ${bundleUrl}`);
90248
- if (options.bundleUrl) {
90248
+ if (displayBundleUrl) {
90249
90249
  f2.info(`Bundle url: ${bundleUrl}`);
90250
90250
  } else if (!versionId) {
90251
90251
  f2.warn("Cannot set bundle with upload key, use key with more rights for that");
@@ -90285,7 +90285,7 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
90285
90285
  const userId = await verifyUser(supabase, apikey, ["write", "all", "upload"]);
90286
90286
  const permissions = await checkAppExistsAndHasPermissionOrgErr(supabase, apikey, appid, 2 /* upload */);
90287
90287
  const orgId = await getOrganizationId(supabase, appid);
90288
- await checkPlanValid(supabase, orgId, options.apikey, appid, true);
90288
+ await checkPlanValid(supabase, orgId, apikey, appid, true);
90289
90289
  await checkTrial(supabase, orgId, localConfig);
90290
90290
  const { nativePackages, minUpdateVersion } = await verifyCompatibility(supabase, pm2, options, channel2, appid, bundle2);
90291
90291
  await checkVersionExists(supabase, appid, bundle2);
@@ -90330,7 +90330,7 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
90330
90330
  program.error("");
90331
90331
  }
90332
90332
  }
90333
- 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);
90334
90334
  await snag.track({
90335
90335
  channel: "app",
90336
90336
  event: "App Uploaded",
@@ -90347,19 +90347,19 @@ async function uploadBundle(preAppid, options, shouldExit = true) {
90347
90347
  }
90348
90348
  return true;
90349
90349
  }
90350
- async function uploadCommand(apikey, options) {
90350
+ async function uploadCommand(appid, options) {
90351
90351
  try {
90352
- await uploadBundle(apikey, options, true);
90352
+ await uploadBundle(appid, options, true);
90353
90353
  } catch (error) {
90354
90354
  f2.error(formatError(error));
90355
90355
  program.error("");
90356
90356
  }
90357
90357
  }
90358
- async function uploadDeprecatedCommand(apikey, options) {
90358
+ async function uploadDeprecatedCommand(appid, options) {
90359
90359
  const pm2 = getPMAndCommand();
90360
90360
  f2.warn(`\u26A0\uFE0F This command is deprecated, use "${pm2.runner} @capgo/cli bundle upload" instead \u26A0\uFE0F`);
90361
90361
  try {
90362
- await uploadBundle(apikey, options, true);
90362
+ await uploadBundle(appid, options, true);
90363
90363
  } catch (error) {
90364
90364
  f2.error(formatError(error));
90365
90365
  program.error("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.12.1",
3
+ "version": "4.12.2",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
@@ -343,7 +343,8 @@ async function uploadBundleToCapgoCloud(supabase: SupabaseType, appid: string, b
343
343
 
344
344
  async function setVersionInChannel(
345
345
  supabase: SupabaseType,
346
- options: Options,
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: options.apikey, name_version: bundle, appid })
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 (options.bundleUrl) {
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, options.apikey, appid, true)
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(apikey: string, options: Options) {
511
+ export async function uploadCommand(appid: string, options: Options) {
511
512
  try {
512
- await uploadBundle(apikey, options, true)
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(apikey: string, options: Options) {
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(apikey, options, true)
525
+ await uploadBundle(appid, options, true)
525
526
  }
526
527
  catch (error) {
527
528
  p.log.error(formatError(error))