@capgo/cli 4.10.12 → 4.10.14
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 +24 -16
- package/package.json +1 -1
- package/src/app/add.ts +2 -2
- package/src/app/delete.ts +1 -0
- package/src/app/set.ts +5 -3
- package/src/init.ts +19 -11
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.10.14](https://github.com/Cap-go/CLI/compare/v4.10.13...v4.10.14) (2024-06-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* better report error in init command ([af3dbf9](https://github.com/Cap-go/CLI/commit/af3dbf9e882e1dceb5d0b0ffb15484c1d4e01764))
|
|
11
|
+
|
|
12
|
+
### [4.10.13](https://github.com/Cap-go/CLI/compare/v4.10.12...v4.10.13) (2024-06-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* image upload ([cc42ebf](https://github.com/Cap-go/CLI/commit/cc42ebf8b297119383d5e08a73416515218bdbae))
|
|
18
|
+
|
|
5
19
|
### [4.10.12](https://github.com/Cap-go/CLI/compare/v4.10.11...v4.10.12) (2024-06-07)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.js
CHANGED
|
@@ -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.
|
|
110511
|
+
version: "4.10.14",
|
|
110512
110512
|
description: "A CLI to upload to capgo servers",
|
|
110513
110513
|
author: "github.com/riderx",
|
|
110514
110514
|
license: "Apache 2.0",
|
|
@@ -111868,7 +111868,7 @@ async function addAppInternal(appId, options, organization, throwErr = true) {
|
|
|
111868
111868
|
program.error("");
|
|
111869
111869
|
}
|
|
111870
111870
|
const supabase = await createSupabaseClient(options.apikey);
|
|
111871
|
-
|
|
111871
|
+
await verifyUser(supabase, options.apikey, ["write", "all"]);
|
|
111872
111872
|
const appExist = await checkAppExists(supabase, appId);
|
|
111873
111873
|
if (appExist) {
|
|
111874
111874
|
f2.error(`App ${appId} already exist`);
|
|
@@ -111914,7 +111914,7 @@ async function addAppInternal(appId, options, organization, throwErr = true) {
|
|
|
111914
111914
|
f2.error(`Could not add app ${formatError(error)}`);
|
|
111915
111915
|
program.error("");
|
|
111916
111916
|
}
|
|
111917
|
-
const { data: signedURLData } = await supabase.storage.from(`images/${
|
|
111917
|
+
const { data: signedURLData } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).getPublicUrl(fileName);
|
|
111918
111918
|
signedURL = signedURLData?.publicUrl || signedURL;
|
|
111919
111919
|
}
|
|
111920
111920
|
const { error: dbError } = await supabase.from("apps").insert({
|
|
@@ -112222,17 +112222,23 @@ async function initApp(apikeyCommand, appId, options) {
|
|
|
112222
112222
|
await verifyUser(supabase, apikey, ["upload", "all", "read", "write"]);
|
|
112223
112223
|
const organization = await getOrganization(supabase, ["admin", "super_admin"]);
|
|
112224
112224
|
const orgId = organization.gid;
|
|
112225
|
-
|
|
112226
|
-
|
|
112227
|
-
|
|
112228
|
-
|
|
112229
|
-
|
|
112230
|
-
|
|
112231
|
-
|
|
112232
|
-
|
|
112233
|
-
|
|
112234
|
-
|
|
112235
|
-
|
|
112225
|
+
try {
|
|
112226
|
+
await markStep(orgId, snag, 1);
|
|
112227
|
+
await step2(organization, snag, appId, options);
|
|
112228
|
+
await step3(orgId, snag, apikey, appId);
|
|
112229
|
+
await step4(orgId, snag, apikey, appId);
|
|
112230
|
+
await step5(orgId, snag, apikey, appId);
|
|
112231
|
+
await step6(orgId, snag, apikey, appId);
|
|
112232
|
+
await step7(orgId, snag, apikey, appId);
|
|
112233
|
+
await step8(orgId, snag, apikey, appId);
|
|
112234
|
+
await step9(orgId, snag);
|
|
112235
|
+
await step10(orgId, snag, apikey, appId);
|
|
112236
|
+
await markStep(orgId, snag, 0);
|
|
112237
|
+
} catch (e2) {
|
|
112238
|
+
console.error(e2);
|
|
112239
|
+
f2.error(`Error during onboarding, please try again later`);
|
|
112240
|
+
import_node_process16.default.exit(1);
|
|
112241
|
+
}
|
|
112236
112242
|
f2.info(`Welcome onboard \u2708\uFE0F!`);
|
|
112237
112243
|
f2.info(`Your Capgo update system is setup`);
|
|
112238
112244
|
f2.info(`Next time use \`${pm2.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`);
|
|
@@ -112926,6 +112932,8 @@ async function setApp(appId, options) {
|
|
|
112926
112932
|
program.error(``);
|
|
112927
112933
|
}
|
|
112928
112934
|
const supabase = await createSupabaseClient(options.apikey);
|
|
112935
|
+
const organization = await getOrganization(supabase, ["admin", "super_admin"]);
|
|
112936
|
+
const organizationUid = organization.gid;
|
|
112929
112937
|
const userId = await verifyUser(supabase, options.apikey, ["write", "all"]);
|
|
112930
112938
|
await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, 4 /* admin */);
|
|
112931
112939
|
const { name, icon, retention } = options;
|
|
@@ -112954,14 +112962,14 @@ async function setApp(appId, options) {
|
|
|
112954
112962
|
f2.warn(`Cannot find app icon in any of the following locations: ${icon}, ${newIconPath}`);
|
|
112955
112963
|
}
|
|
112956
112964
|
if (iconBuff && iconType) {
|
|
112957
|
-
const { error } = await supabase.storage.from(`images/${
|
|
112965
|
+
const { error } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).upload(fileName, iconBuff, {
|
|
112958
112966
|
contentType: iconType
|
|
112959
112967
|
});
|
|
112960
112968
|
if (error) {
|
|
112961
112969
|
f2.error(`Could not set app ${formatError(error)}`);
|
|
112962
112970
|
program.error(``);
|
|
112963
112971
|
}
|
|
112964
|
-
const { data: signedURLData } = await supabase.storage.from(`images/${
|
|
112972
|
+
const { data: signedURLData } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).getPublicUrl(fileName);
|
|
112965
112973
|
signedURL = signedURLData?.publicUrl || signedURL;
|
|
112966
112974
|
}
|
|
112967
112975
|
const { error: dbError } = await supabase.from("apps").update({
|
package/package.json
CHANGED
package/src/app/add.ts
CHANGED
|
@@ -48,7 +48,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
48
48
|
|
|
49
49
|
const supabase = await createSupabaseClient(options.apikey)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
52
52
|
|
|
53
53
|
// Check we have app access to this appId
|
|
54
54
|
const appExist = await checkAppExists(supabase, appId)
|
|
@@ -111,7 +111,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
111
111
|
}
|
|
112
112
|
const { data: signedURLData } = await supabase
|
|
113
113
|
.storage
|
|
114
|
-
.from(`images/${
|
|
114
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
115
115
|
.getPublicUrl(fileName)
|
|
116
116
|
signedURL = signedURLData?.publicUrl || signedURL
|
|
117
117
|
}
|
package/src/app/delete.ts
CHANGED
|
@@ -73,6 +73,7 @@ export async function deleteApp(appId: string, options: OptionsBase) {
|
|
|
73
73
|
p.log.error('Could not delete app logo')
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
// TODO: make the version delete in R2 too
|
|
76
77
|
const { error: delError } = await supabase
|
|
77
78
|
.storage
|
|
78
79
|
.from(`apps/${appId}/${userId}`)
|
package/src/app/set.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { program } from 'commander'
|
|
|
6
6
|
import * as p from '@clack/prompts'
|
|
7
7
|
import type { Options } from '../api/app'
|
|
8
8
|
import { checkAppExistsAndHasPermissionOrgErr, newIconPath } from '../api/app'
|
|
9
|
-
import { OrganizationPerm, createSupabaseClient, findSavedKey, formatError, getConfig, verifyUser } from '../utils'
|
|
9
|
+
import { OrganizationPerm, createSupabaseClient, findSavedKey, formatError, getConfig, getOrganization, verifyUser } from '../utils'
|
|
10
10
|
|
|
11
11
|
export async function setApp(appId: string, options: Options) {
|
|
12
12
|
p.intro(`Set app`)
|
|
@@ -23,6 +23,8 @@ export async function setApp(appId: string, options: Options) {
|
|
|
23
23
|
program.error(``)
|
|
24
24
|
}
|
|
25
25
|
const supabase = await createSupabaseClient(options.apikey)
|
|
26
|
+
const organization = await getOrganization(supabase, ['admin', 'super_admin'])
|
|
27
|
+
const organizationUid = organization.gid
|
|
26
28
|
|
|
27
29
|
const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
28
30
|
// Check we have app access to this appId
|
|
@@ -61,7 +63,7 @@ export async function setApp(appId: string, options: Options) {
|
|
|
61
63
|
}
|
|
62
64
|
if (iconBuff && iconType) {
|
|
63
65
|
const { error } = await supabase.storage
|
|
64
|
-
.from(`images/${
|
|
66
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
65
67
|
.upload(fileName, iconBuff, {
|
|
66
68
|
contentType: iconType,
|
|
67
69
|
})
|
|
@@ -71,7 +73,7 @@ export async function setApp(appId: string, options: Options) {
|
|
|
71
73
|
}
|
|
72
74
|
const { data: signedURLData } = await supabase
|
|
73
75
|
.storage
|
|
74
|
-
.from(`images/${
|
|
76
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
75
77
|
.getPublicUrl(fileName)
|
|
76
78
|
signedURL = signedURLData?.publicUrl || signedURL
|
|
77
79
|
}
|
package/src/init.ts
CHANGED
|
@@ -319,19 +319,27 @@ export async function initApp(apikeyCommand: string, appId: string, options: Sup
|
|
|
319
319
|
const organization = await getOrganization(supabase, ['admin', 'super_admin'])
|
|
320
320
|
const orgId = organization.gid
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
try {
|
|
323
|
+
await markStep(orgId, snag, 1)
|
|
323
324
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
325
|
+
await step2(organization, snag, appId, options)
|
|
326
|
+
await step3(orgId, snag, apikey, appId)
|
|
327
|
+
await step4(orgId, snag, apikey, appId)
|
|
328
|
+
await step5(orgId, snag, apikey, appId)
|
|
329
|
+
await step6(orgId, snag, apikey, appId)
|
|
330
|
+
await step7(orgId, snag, apikey, appId)
|
|
331
|
+
await step8(orgId, snag, apikey, appId)
|
|
332
|
+
await step9(orgId, snag)
|
|
333
|
+
await step10(orgId, snag, apikey, appId)
|
|
334
|
+
|
|
335
|
+
await markStep(orgId, snag, 0)
|
|
336
|
+
}
|
|
337
|
+
catch (e) {
|
|
338
|
+
console.error(e)
|
|
339
|
+
p.log.error(`Error during onboarding, please try again later`)
|
|
340
|
+
process.exit(1)
|
|
341
|
+
}
|
|
333
342
|
|
|
334
|
-
await markStep(orgId, snag, 0)
|
|
335
343
|
p.log.info(`Welcome onboard ✈️!`)
|
|
336
344
|
p.log.info(`Your Capgo update system is setup`)
|
|
337
345
|
p.log.info(`Next time use \`${pm.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`)
|